summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-10-30 15:59:38 +0200
committerWolfram Sang <wsa@the-dreams.de>2014-11-10 09:34:58 +0100
commit2fd36c55264926e268deb50f6de5f43fa5e490f7 (patch)
treec168e12f6e984893a1ed9b9d1ac0e0028a64d309 /drivers/i2c
parent9eb08fb3d15896bfff57fcd4c87e3fd5b19d8581 (diff)
downloadlinux-2fd36c55264926e268deb50f6de5f43fa5e490f7.tar.gz
linux-2fd36c55264926e268deb50f6de5f43fa5e490f7.tar.bz2
linux-2fd36c55264926e268deb50f6de5f43fa5e490f7.zip
i2c: core: Map OF IRQ at probe time
I2C clients instantiated from OF get their IRQ mapped at device registration time. This leads to the IRQ being silently ignored if the related irqchip hasn't been proved yet. Fix this by moving IRQ mapping at probe time using of_get_irq(). The function operates as irq_of_parse_and_map() but additionally returns -EPROBE_DEFER if the irqchip isn't available, allowing us to defer I2C client probing. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-core.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index f43b4e11647a..a0768d6dffc2 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -626,6 +626,15 @@ static int i2c_device_probe(struct device *dev)
if (!client)
return 0;
+ if (!client->irq && dev->of_node) {
+ int irq = of_irq_get(dev->of_node, 0);
+
+ if (irq < 0)
+ return irq;
+
+ client->irq = irq;
+ }
+
driver = to_i2c_driver(dev->driver);
if (!driver->probe || !driver->id_table)
return -ENODEV;
@@ -1407,7 +1416,6 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
continue;
}
- info.irq = irq_of_parse_and_map(node, 0);
info.of_node = of_node_get(node);
info.archdata = &dev_ad;
@@ -1421,7 +1429,6 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
dev_err(&adap->dev, "of_i2c: Failure registering %s\n",
node->full_name);
of_node_put(node);
- irq_dispose_mapping(info.irq);
continue;
}
}