[PATCH] of_i2c: Honour "status=disabled" property of device

Alexander Sverdlin asv at sysgo.com
Thu Nov 29 01:21:14 EST 2012


From: Alexander Sverdlin <alexander.sverdlin at sysgo.com>

of_i2c: Honour "status=disabled" property of device

Currently of_i2c_register_devices() function registers all i2c devices,
independently from their status property in device tree. According to
"ePAPR 1.1" spec, device should only be registered if there is no
"status" property, or it has "ok" (or "okay") value (see
of_device_is_available()). In case of "platform devices",
of_platform_device_create_pdata() checks for "status" and ensures
that disabled devices are not populated. But such check for i2c buses
was missing until now. Fix it.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin at sysgo.com>
---
--- linux.orig/drivers/of/of_i2c.c
+++ linux/drivers/of/of_i2c.c
@@ -29,7 +29,7 @@ void of_i2c_register_devices(struct i2c_
 
 	dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
 
-	for_each_child_of_node(adap->dev.of_node, node) {
+	for_each_available_child_of_node(adap->dev.of_node, node) {
 		struct i2c_board_info info = {};
 		struct dev_archdata dev_ad = {};
 		const __be32 *addr;


More information about the devicetree-discuss mailing list