Skip to contentSkip to conversation

of_i2c: Honour "status=disabled" property of device

PATCH In review Alexander Sverdlin 5 participants 6 messages Nov 28, 2012 – Nov 29, 2012 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of_i2c: Honour "status=disabled" property of device

From: Alexander Sverdlin <[email protected]>

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.

---

drivers/of/of_i2c.c +1 -1
@@ -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;

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 10 lines · Alexander Sverdlin

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.

Do SPI and other buses (e.g. MDIO/MDIO mux?) need a similar change?

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi!

Quoted 12 lines · Stephen Warren
Quoted 10 lines · Alexander Sverdlin

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.

Quoted 1 line

Do SPI and other buses (e.g. MDIO/MDIO mux?) need a similar change?

You are right, of_register_spi_devices() and of_mdiobus_register() both have exactly the same issue. Should it be a follow-up patch, or better to combine them to one patch?

Signature · 2 lines
Best regards,
Alexander Sverdlin.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 15 lines · Alexander Sverdlin

Hi!

Quoted 12 lines · Stephen Warren
Quoted 10 lines · Alexander Sverdlin

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.

Quoted 4 lines
Quoted 1 line

Do SPI and other buses (e.g. MDIO/MDIO mux?) need a similar change?

You are right, of_register_spi_devices() and of_mdiobus_register() both have exactly the same issue. Should it be a follow-up patch, or better to combine them to one patch?

Separate please in case there is some reason to revert. Also, I already have a patch for i2c that does the same thing in my tree. However, your patch is better, so I'll probably replace it with yours.

Rob

Acked-by
#7 lore raw
In reply to a message not in the archive
Quoted 13 lines · Alexander Sverdlin

From: Alexander Sverdlin <[email protected]>

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.

Quoted 1 line

Seems like Rob wants to pick it, so:

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Reviewed-by
#8 lore raw
In reply to a message not in the archive
Quoted 23 lines

-----Original Message-----
From: devicetree-discuss [mailto:[email protected]] On Behalf Of Alexander Sverdlin
Sent: Wednesday, November 28, 2012 10:21 PM
To: Jochen Friedrich; Jon Smirl; [email protected]; [email protected]; Rob Herring; Grant Likely
Cc: alexander sverdlin
Subject: [PATCH] of_i2c: Honour "status=disabled" property of device

From: Alexander Sverdlin <[email protected]>

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.

Quoted 2 lines

---

drivers/of/of_i2c.c void of_i2c_register_devices(struct i2c_ · line 35

Quoted 11 lines
drivers/of/of_i2c.c +1 -1
@@ -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;

Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog