[PATCH] i2c: Fallback to of_node of parent
Florian Meier
florian.meier at koalo.de
Sat Nov 16 07:40:31 PST 2013
Many busses (e.g. tegra, omap, bcm2835)
need to set the of_node of the adapter
device to the one of the parent device, i.e.
adap->dev.of_node = pdev->dev.of_node;
As suggested by Stephen Warren, this could also
be done in the i2c core and it is a common mistake
to forget this line:
I2C: BCM2835: Linking platform nodes to adapter nodes
i2c: Fix device tree binding for i2c-cbus-gpio
Signed-off-by: Florian Meier <florian.meier at koalo.de>
Suggested-by: Stephen Warren <swarren at wwwdotorg.org>
---
drivers/i2c/i2c-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 430c001..c8e33a5 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1310,6 +1310,9 @@ int i2c_add_adapter(struct i2c_adapter *adapter)
struct device *dev = &adapter->dev;
int id;
+ if (!dev->of_node && dev->parent)
+ dev->of_node = dev->parent->of_node;
+
if (dev->of_node) {
id = of_alias_get_id(dev->of_node, "i2c");
if (id >= 0) {
--
1.7.9.5
More information about the linux-rpi-kernel
mailing list