Skip to contentSkip to conversation

media: i2c: ds90ub960: Remove of_node assignment

PATCH In review Andy Shevchenko 2 participants 4 messages Mar 12, 2025 – Apr 7, 2025

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

PATCH 1/1 media: i2c: ds90ub960: Remove of_node assignment

Remove of_node assignment which duplicates fwnode in struct i2c_board_info. In general drivers must not set both, it's quite confusing. The I²C core will consider fwnode with a priority and of_node is subject to remove from above mentioned data structure.

---
 drivers/media/i2c/ds90ub960.c | 1 -
 1 file changed, 1 deletion(-)
drivers/media/i2c/ds90ub960.c +0 -1
index 5dde8452739b..5afdbbad9ff4 100644
@@ -1682,7 +1682,6 @@ static int ub960_rxport_add_serializer(struct ub960_data *priv, u8 nport)
 	struct device *dev = &priv->client->dev;
 	struct ds90ub9xx_platform_data *ser_pdata = &rxport->ser.pdata;
 	struct i2c_board_info ser_info = {
-		.of_node = to_of_node(rxport->ser.fwnode),
 		.fwnode = rxport->ser.fwnode,
 		.platform_data = ser_pdata,
 	};
Signature · 1 line
2.47.2
maintainer
#1 lore raw

Hi,

Quoted 15 lines · Andy Shevchenko

Remove of_node assignment which duplicates fwnode in struct i2c_board_info. In general drivers must not set both, it's quite confusing. The I²C core will consider fwnode with a priority and of_node is subject to remove from above mentioned data structure.

---
  drivers/media/i2c/ds90ub960.c | 1 -
  1 file changed, 1 deletion(-)
drivers/media/i2c/ds90ub960.c +0 -0
index 5dde8452739b..5afdbbad9ff4 100644

drivers/media/i2c/ds90ub960.c static int ub960_rxport_add_serializer(struct ub960_data *priv, u8 nport) · line 1687

Quoted 7 lines
drivers/media/i2c/ds90ub960.c +0 -1
@@ -1682,7 +1682,6 @@ static int ub960_rxport_add_serializer(struct ub960_data *priv, u8 nport)
  	struct device *dev = &priv->client->dev;
  	struct ds90ub9xx_platform_data *ser_pdata = &rxport->ser.pdata;
  	struct i2c_board_info ser_info = {
-		.of_node = to_of_node(rxport->ser.fwnode),
  		.fwnode = rxport->ser.fwnode,
  		.platform_data = ser_pdata,
  	};

This sounds logical, but breaks the driver for me. I also couldn't find this documented and didn't immediately find this from the i2c core implementation side.

Or am I missing some patch (running on v6.14)?

Tomi

#2 lore raw
Quoted 5 lines · Tomi Valkeinen
Quoted 4 lines · Andy Shevchenko

Remove of_node assignment which duplicates fwnode in struct i2c_board_info. In general drivers must not set both, it's quite confusing. The I²C core will consider fwnode with a priority and of_node is subject to remove from above mentioned data structure.

...

Quoted 9 lines

drivers/media/i2c/ds90ub960.c static int ub960_rxport_add_serializer(struct ub960_data *priv, u8 nport) · line 1687

Quoted 7 lines
  	struct device *dev = &priv->client->dev;
  	struct ds90ub9xx_platform_data *ser_pdata = &rxport->ser.pdata;
  	struct i2c_board_info ser_info = {
drivers/media/i2c/ds90ub960.c +0 -1
-		.of_node = to_of_node(rxport->ser.fwnode),
  		.fwnode = rxport->ser.fwnode,
  		.platform_data = ser_pdata,
  	};

This sounds logical, but breaks the driver for me.

The above assignments are still confusing, but I think I understand what's going on. You run on OF based environment and some code uses of_*() APIs instead of fwnode ones. That's why the current implementation in the I²C core doesn't work.

Quoted 2 lines

I also couldn't find this documented and didn't immediately find this from the i2c core implementation side.

The current code does this:

	client->dev.of_node = of_node_get(info->of_node);
	client->dev.fwnode = info->fwnode;

when it should do something like device_set_node() instead.

Quoted 1 line

Or am I missing some patch (running on v6.14)?

Yeah, there is a series in the mailing list [1], but it has no comments and no move so far...

TL;DR: it seems in this change is incomplete.

[1]: https://lore.kernel.org/r/[email protected]

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Tomi Valkeinen
Quoted 4 lines · Andy Shevchenko

Remove of_node assignment which duplicates fwnode in struct i2c_board_info. In general drivers must not set both, it's quite confusing. The I²C core will consider fwnode with a priority and of_node is subject to remove from above mentioned data structure.

FWIW, this patch had been send as part of the i2c conversion series. Please, do not apply it standalone (at least without that i2c stuff being accepted and applied first).

Signature · 2 lines
With Best Regards,
Andy Shevchenko