Skip to content

Commit 6f34be7

Browse files
geertuWolfram Sang
authored andcommitted
i2c: core: Fix probing of i2c slaves without interrupts
Since commit 2fd36c5 ("i2c: core: Map OF IRQ at probe time"), i2c slaves without interrupts (e.g. da9210 and at24 on r8a7791/koelsch) fail to probe: at24: probe of 2-0050 failed with error -22 da9210: probe of 6-0068 failed with error -22 This happens because the call to of_irq_get() in i2c_device_probe() returns -EINVAL. If a device node does not have an "interrupts" property, of_irq_parse_one() fails. Unlike irq_of_parse_and_map(), of_irq_get() does not ignore errors from of_irq_parse_one(), but forwards them. Make i2c_device_probe() ignore all errors but -EPROBE_DEFER to fix this, just like platform_get_irq() and platform_get_irq_byname() already do. Fixes: 2fd36c5 ("i2c: core: Map OF IRQ at probe time") Signed-off-by: Geert Uytterhoeven <[email protected]> Tested-by: Fabio Estevam <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 27bce45 commit 6f34be7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/i2c/i2c-core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,10 @@ static int i2c_device_probe(struct device *dev)
629629
if (!client->irq && dev->of_node) {
630630
int irq = of_irq_get(dev->of_node, 0);
631631

632-
if (irq < 0)
632+
if (irq == -EPROBE_DEFER)
633633
return irq;
634+
if (irq < 0)
635+
irq = 0;
634636

635637
client->irq = irq;
636638
}

0 commit comments

Comments
 (0)