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.me...@koalo.de>
Suggested-by: Stephen Warren <swar...@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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to