Skip to content

Commit fc832ac

Browse files
Minghao Chi (CGEL ZTE)Lee Jones
authored andcommitted
mfd: Use platform_get_irq() to get the interrupt
It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ) for requesting IRQ's resources any more, as they can be not ready yet in case of DT-booting. platform_get_irq() instead is a recommended way for getting IRQ even if it was not retrieved earlier. It also makes code simpler because we're getting "int" value right away and no conversion from resource to int is required. The print function dev_err() is redundant because platform_get_irq() already prints an error. Reported-by: Zeal Robot <[email protected]> Signed-off-by: Minghao Chi (CGEL ZTE) <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 553f685 commit fc832ac

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/mfd/ab8500-core.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,9 +1022,9 @@ static int ab8500_probe(struct platform_device *pdev)
10221022
enum ab8500_version version = AB8500_VERSION_UNDEFINED;
10231023
struct device_node *np = pdev->dev.of_node;
10241024
struct ab8500 *ab8500;
1025-
struct resource *resource;
10261025
int ret;
10271026
int i;
1027+
int irq;
10281028
u8 value;
10291029

10301030
ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL);
@@ -1033,13 +1033,11 @@ static int ab8500_probe(struct platform_device *pdev)
10331033

10341034
ab8500->dev = &pdev->dev;
10351035

1036-
resource = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1037-
if (!resource) {
1038-
dev_err(&pdev->dev, "no IRQ resource\n");
1039-
return -ENODEV;
1040-
}
1036+
irq = platform_get_irq(pdev, 0);
1037+
if (irq < 0)
1038+
return irq;
10411039

1042-
ab8500->irq = resource->start;
1040+
ab8500->irq = irq;
10431041

10441042
ab8500->read = ab8500_prcmu_read;
10451043
ab8500->write = ab8500_prcmu_write;

0 commit comments

Comments
 (0)