lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <528791EF.9060505@koalo.de>
Date:	Sat, 16 Nov 2013 16:40:31 +0100
From:	Florian Meier <florian.meier@...lo.de>
To:	Wolfram Sang <wsa@...-dreams.de>,
	Stephen Warren <swarren@...dotorg.org>
CC:	linux-i2c@...r.kernel.org,
	linux-rpi-kernel <linux-rpi-kernel@...ts.infradead.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] i2c: Fallback to of_node of parent

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@...lo.de>
Suggested-by: Stephen Warren <swarren@...dotorg.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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ