[PATCH] i2c: Fallback to of_node of parent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
Suggested-by: Stephen Warren <swarren@xxxxxxxxxxxxx>
---
 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-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux