Skip to contentSkip to conversation

net: Drop explicit initialization of struct i2c_device_id::driver_data to 0

PATCH Applied Uwe Kleine-König 6 participants 6 messages Jun 25, 2024 – Jun 26, 2024

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

PATCH 1/1 net: Drop explicit initialization of struct i2c_device_id::driver_data to 0

These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own.

While add it, also remove commas after the sentinel entries.

---
Hello,

I'm unsure if I should have split this patch further; per subdir of drivers/net or even per driver. If you want it split, please tell me.

Best regards
Uwe

 drivers/net/dsa/lan9303_i2c.c                 | 2 +-
 drivers/net/dsa/microchip/ksz9477_i2c.c       | 4 ++--
 drivers/net/dsa/xrs700x/xrs700x_i2c.c         | 4 ++--
 drivers/net/ethernet/mellanox/mlxsw/minimal.c | 4 ++--
 drivers/net/mctp/mctp-i2c.c                   | 4 ++--
 drivers/net/pse-pd/pd692x0.c                  | 4 ++--
 drivers/net/pse-pd/tps23881.c                 | 4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/dsa/lan9303_i2c.c +1 -1
index bbbec322bc4f..c62d27cdc117 100644
@@ -89,7 +89,7 @@ static void lan9303_i2c_shutdown(struct i2c_client *client)
 /*-------------------------------------------------------------------------*/
 
 static const struct i2c_device_id lan9303_i2c_id[] = {
-	{ "lan9303", 0 },
+	{ "lan9303" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(i2c, lan9303_i2c_id);
drivers/net/dsa/microchip/ksz9477_i2c.c +2 -2
index 82bebee4615c..7d7560f23a73 100644
@@ -72,8 +72,8 @@ static void ksz9477_i2c_shutdown(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id ksz9477_i2c_id[] = {
-	{ "ksz9477-switch", 0 },
-	{},
+	{ "ksz9477-switch" },
+	{}
 };
 
 MODULE_DEVICE_TABLE(i2c, ksz9477_i2c_id);
drivers/net/dsa/xrs700x/xrs700x_i2c.c +2 -2
index c1179d7311f7..9b731dea78c1 100644
@@ -127,8 +127,8 @@ static void xrs700x_i2c_shutdown(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id xrs700x_i2c_id[] = {
-	{ "xrs700x-switch", 0 },
-	{},
+	{ "xrs700x-switch" },
+	{}
 };
 
 MODULE_DEVICE_TABLE(i2c, xrs700x_i2c_id);
drivers/net/ethernet/mellanox/mlxsw/minimal.c +2 -2
index f0ceb196a6ce..431accdc6213 100644
@@ -702,8 +702,8 @@ static struct mlxsw_driver mlxsw_m_driver = {
 };
 
 static const struct i2c_device_id mlxsw_m_i2c_id[] = {
-	{ "mlxsw_minimal", 0},
-	{ },
+	{ "mlxsw_minimal" },
+	{ }
 };
 
 static struct i2c_driver mlxsw_m_i2c_driver = {
drivers/net/mctp/mctp-i2c.c +2 -2
index b37a9e4bade4..f9afea25044f 100644
@@ -1042,8 +1042,8 @@ static struct notifier_block mctp_i2c_notifier = {
 };
 
 static const struct i2c_device_id mctp_i2c_id[] = {
-	{ "mctp-i2c-interface", 0 },
-	{},
+	{ "mctp-i2c-interface" },
+	{}
 };
 MODULE_DEVICE_TABLE(i2c, mctp_i2c_id);
 
drivers/net/pse-pd/pd692x0.c +2 -2
index 6488b941703c..820358b71f0f 100644
@@ -1194,8 +1194,8 @@ static void pd692x0_i2c_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id pd692x0_id[] = {
-	{ PD692X0_PSE_NAME, 0 },
-	{ },
+	{ PD692X0_PSE_NAME },
+	{ }
 };
 MODULE_DEVICE_TABLE(i2c, pd692x0_id);
 
drivers/net/pse-pd/tps23881.c +2 -2
index 98ffbb1bbf13..61f6ad9c1934 100644
@@ -794,8 +794,8 @@ static int tps23881_i2c_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id tps23881_id[] = {
-	{ "tps23881", 0 },
-	{ },
+	{ "tps23881" },
+	{ }
 };
 MODULE_DEVICE_TABLE(i2c, tps23881_id);
 

base-commit: 62c97045b8f720c2eac807a5f38e26c9ed512371

Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Uwe Kleine-König

These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own.

While add it, also remove commas after the sentinel entries.

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Uwe Kleine-König
Quoted 10 lines · On Tue, 25 Jun 2024 10:38:53 +0200 Uwe Kleine-König…

These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own.

While add it, also remove commas after the sentinel entries.

For PSE drivers:

---
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Uwe Kleine-König

Hi Uwe,

Quoted 10 lines

These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own.

While add it, also remove commas after the sentinel entries.

Thanks!

Cheers,

Jeremy

maintainer Reviewed-by Acked-by on v1 1/1
#4 lore raw
In reply to Uwe Kleine-König

Hi Uwe,

Quoted 13 lines · Uwe Kleine-König

These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own.

While add it, also remove commas after the sentinel entries.

---
Hello,

Quoted 8 lines

I'm unsure if I should have split this patch further; per subdir of drivers/net or even per driver. If you want it split, please tell me.

Best regards
Uwe

 drivers/net/dsa/lan9303_i2c.c                 | 2 +-
 drivers/net/dsa/microchip/ksz9477_i2c.c       | 4 ++--
Quoted 2 lines
 drivers/net/pse-pd/pd692x0.c                  | 4 ++--
 drivers/net/pse-pd/tps23881.c                 | 4 ++--

Thank you!

Regards,
Oleksij

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#5 lore raw
In reply to Uwe Kleine-König
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 25 Jun 2024 10:38:53 +0200 you wrote:

These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own.

[...]

Here is the summary with links:
- [net-next] net: Drop explicit initialization of struct i2c_device_id::driver_data to 0

    https://git.kernel.org/netdev/net-next/c/a6a6a9809411

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html