Skip to contentSkip to conversation

i2c: Remove I2C_CLASS_SPD

PATCH Applied Heiner Kallweit 3 participants 9 messages Apr 15, 2024 – Apr 17, 2024

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

cover i2c: Remove I2C_CLASS_SPD

Only remaining client driver supporting I2C_CLASS_SPD is jc42. This type of thermal sensor can be found on several DDR3/DDR4 modules. i2c_register_spd() instantiates also such thermal sensor i2c devices. Since 71b494e043d2 ("i2c: i801: Call i2c_register_spd for muxed child segments") i2c_register_spd() is called also for the remaining use case, systems with muxed SMBUS segments for SPD EEPROMs. i801 was the last bus driver supporting I2C_CLASS_SPD.
Therefore I2C_CLASS_SPD class-based instantiation isn't needed any longer, and we can remove it completely.

I propose to handle this series via the I2C tree.

Heiner Kallweit (4):
i2c: i801: Remove usage of I2C_CLASS_SPD
i2c: mux: gpio: remove support for class-based device instantiation
hwmon: jc42: Remove I2C_CLASS_SPD support
i2c: Remove I2C_CLASS_SPD

 drivers/hwmon/jc42.c                       | 2 +-
 drivers/i2c/busses/i2c-i801.c              | 4 ----
 drivers/i2c/muxes/i2c-mux-gpio.c           | 3 +--
 include/linux/i2c.h                        | 1 -
 include/linux/platform_data/i2c-mux-gpio.h | 2 --
 5 files changed, 2 insertions(+), 10 deletions(-)
Signature · 1 line
2.44.0
#1 lore raw

PATCH 1/4 i2c: i801: Remove usage of I2C_CLASS_SPD

Only remaining client driver supporting I2C_CLASS_SPD is jc42. This type of thermal sensor can be found on several DDR3/DDR4 modules. i2c_register_spd() instantiates also such thermal sensor i2c devices. Since 71b494e043d2 ("i2c: i801: Call i2c_register_spd for muxed child segments") i2c_register_spd() is called also for the remaining use case, systems with muxed SMBUS segments for SPD EEPROMs.
Therefore I2C_CLASS_SPD class-based instantiation isn't needed any longer in this driver, so remove it.

---
 drivers/i2c/busses/i2c-i801.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/i2c/busses/i2c-i801.c +0 -4
index ab17e76e3..e577abc77 100644
@@ -264,7 +264,6 @@ struct i801_mux_config {
 	char *gpio_chip;
 	unsigned values[3];
 	int n_values;
-	unsigned classes[3];
 	unsigned gpios[2];		/* Relative to gpio_chip->base */
 	int n_gpios;
 };
@@ -1315,7 +1314,6 @@ static struct i801_mux_config i801_mux_config_asus_z8_d12 = {
 	.gpio_chip = "gpio_ich",
 	.values = { 0x02, 0x03 },
 	.n_values = 2,
-	.classes = { I2C_CLASS_SPD, I2C_CLASS_SPD },
 	.gpios = { 52, 53 },
 	.n_gpios = 2,
 };
@@ -1324,7 +1322,6 @@ static struct i801_mux_config i801_mux_config_asus_z8_d18 = {
 	.gpio_chip = "gpio_ich",
 	.values = { 0x02, 0x03, 0x01 },
 	.n_values = 3,
-	.classes = { I2C_CLASS_SPD, I2C_CLASS_SPD, I2C_CLASS_SPD },
 	.gpios = { 52, 53 },
 	.n_gpios = 2,
 };
@@ -1434,7 +1431,6 @@ static void i801_add_mux(struct i801_priv *priv)
 	gpio_data.parent = priv->adapter.nr;
 	gpio_data.values = mux_config->values;
 	gpio_data.n_values = mux_config->n_values;
-	gpio_data.classes = mux_config->classes;
 	gpio_data.idle = I2C_MUX_GPIO_NO_IDLE;
 
 	/* Register GPIO descriptor lookup table */
Signature · 1 line
2.44.0
#2 lore raw

PATCH 2/4 i2c: mux: gpio: remove support for class-based device instantiation

In reply to Heiner Kallweit

i801 as only user of gpio i2c mux removed support for class-based device instantiation on muxed busses. Class-based device instantiation is a legacy mechanism and shouldn't be used in new code, therefore remove support also here.

---
 drivers/i2c/muxes/i2c-mux-gpio.c           | 3 +--
 include/linux/platform_data/i2c-mux-gpio.h | 2 --
 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/i2c/muxes/i2c-mux-gpio.c +1 -2
index 6b979a0a6..0fbb33a3d 100644
@@ -206,9 +206,8 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
 
 	for (i = 0; i < mux->data.n_values; i++) {
 		u32 nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
-		unsigned int class = mux->data.classes ? mux->data.classes[i] : 0;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
 		if (ret)
 			goto add_adapter_failed;
 	}
include/linux/platform_data/i2c-mux-gpio.h +0 -2
index 5e4c2c272..816a4cd3c 100644
@@ -18,7 +18,6 @@
  * @values: Array of bitmasks of GPIO settings (low/high) for each
  *	position
  * @n_values: Number of multiplexer positions (busses to instantiate)
- * @classes: Optional I2C auto-detection classes
  * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
  */
 struct i2c_mux_gpio_platform_data {
@@ -26,7 +25,6 @@ struct i2c_mux_gpio_platform_data {
 	int base_nr;
 	const unsigned *values;
 	int n_values;
-	const unsigned *classes;
 	unsigned idle;
 };
 
Signature · 1 line
2.44.0
#3 lore raw

PATCH 3/4 hwmon: jc42: Remove I2C_CLASS_SPD support

In reply to Heiner Kallweit

Last host driver supporting I2C_CLASS_SPD was i801. Now that I2C_CLASS_SPD support has been removed there, we can remove it here too.

---
 drivers/hwmon/jc42.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/jc42.c +1 -1
index 75dc25df0..a00168fe5 100644
@@ -623,7 +623,7 @@ MODULE_DEVICE_TABLE(of, jc42_of_ids);
 #endif
 
 static struct i2c_driver jc42_driver = {
-	.class		= I2C_CLASS_SPD | I2C_CLASS_HWMON,
+	.class		= I2C_CLASS_HWMON,
 	.driver = {
 		.name	= "jc42",
 		.pm = JC42_DEV_PM_OPS,
Signature · 1 line
2.44.0
maintainer Applied
#4 lore raw

Re: [PATCH 3/4] hwmon: jc42: Remove I2C_CLASS_SPD support

Quoted 4 lines · Heiner Kallweit

Last host driver supporting I2C_CLASS_SPD was i801. Now that I2C_CLASS_SPD support has been removed there, we can remove it here too.

Applied to hwmon-next.

Thanks,
Guenter

#5 lore raw

PATCH 4/4 i2c: Remove I2C_CLASS_SPD

In reply to Heiner Kallweit

Remove this class after all users have been gone.

---
 include/linux/i2c.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/i2c.h +0 -1
index 5e6cd43a6..970953737 100644
@@ -852,7 +852,6 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap)
 
 /* i2c adapter classes (bitmask) */
 #define I2C_CLASS_HWMON		(1<<0)	/* lm_sensors, ... */
-#define I2C_CLASS_SPD		(1<<7)	/* Memory modules */
 /* Warn users that the adapter doesn't support classes anymore */
 #define I2C_CLASS_DEPRECATED	(1<<8)
 
Signature · 1 line
2.44.0
maintainer
#6 lore raw

Hi Heiner and Guenter,

Quoted 12 lines · Heiner Kallweit

Remove this class after all users have been gone.

---
 include/linux/i2c.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/i2c.h +0 -0
index 5e6cd43a6..970953737 100644

include/linux/i2c.h static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) · line 855

Quoted 4 lines
include/linux/i2c.h +0 -1
@@ -852,7 +852,6 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap)
 
 /* i2c adapter classes (bitmask) */
 #define I2C_CLASS_HWMON		(1<<0)	/* lm_sensors, ... */
-#define I2C_CLASS_SPD		(1<<7)	/* Memory modules */

I missed the fact that we need some synchronization, as I'm getting a build failure.

I will revert this and apply it after Guenter has merged his part into the mainline.

Guenter, if you have a spare Post-it, could you please note to CC me when this part is sent as a pull request?

Andi

Quoted 7 lines
include/linux/i2c.h +0 -0
 /* Warn users that the adapter doesn't support classes anymore */
 #define I2C_CLASS_DEPRECATED	(1<<8)
 
Signature · 1 line
2.44.0
#7 lore raw
Quoted 24 lines · Andi Shyti

Hi Heiner and Guenter,

Quoted 12 lines · Heiner Kallweit

Remove this class after all users have been gone.

---
 include/linux/i2c.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/i2c.h +0 -0
index 5e6cd43a6..970953737 100644

include/linux/i2c.h static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap) · line 855

Quoted 4 lines
include/linux/i2c.h +0 -1
@@ -852,7 +852,6 @@ static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap)
 
 /* i2c adapter classes (bitmask) */
 #define I2C_CLASS_HWMON              (1<<0)  /* lm_sensors, ... */
-#define I2C_CLASS_SPD                (1<<7)  /* Memory modules */

I missed the fact that we need some synchronization, as I'm getting a build failure.

Quoted 3 lines

I will revert this and apply it after Guenter has merged his part into the mainline.

In order to cope with this dependency I proposed in the cover letter to handle the full series via i2c tree. With Guenter's Ab for the hwmon patch. Maybe this can still be done as an alternative. Whatever is easier for both of you.

Quoted 12 lines

Guenter, if you have a spare Post-it, could you please note to CC me when this part is sent as a pull request?

Andi

Quoted 7 lines
include/linux/i2c.h +0 -1
 /* Warn users that the adapter doesn't support classes anymore */
 #define I2C_CLASS_DEPRECATED (1<<8)
 
--

2.44.0

maintainer Applied
#8 lore raw

Re: (subset) [PATCH 0/4] i2c: Remove I2C_CLASS_SPD

In reply to Heiner Kallweit

Hi

Quoted 11 lines · Heiner Kallweit

Only remaining client driver supporting I2C_CLASS_SPD is jc42. This type of thermal sensor can be found on several DDR3/DDR4 modules. i2c_register_spd() instantiates also such thermal sensor i2c devices. Since 71b494e043d2 ("i2c: i801: Call i2c_register_spd for muxed child segments") i2c_register_spd() is called also for the remaining use case, systems with muxed SMBUS segments for SPD EEPROMs. i801 was the last bus driver supporting I2C_CLASS_SPD.
Therefore I2C_CLASS_SPD class-based instantiation isn't needed any longer, and we can remove it completely.

[...]

Applied to i2c/i2c-host on

git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Thank you,
Andi

Patches applied
===============
[1/4] i2c: i801: Remove usage of I2C_CLASS_SPD

      commit: 8bae811210b77e2cd1b62d9fb20d2e6126103135
[2/4] i2c: mux: gpio: remove support for class-based device instantiation
      commit: 1dfb192a687fded0f5e92518024baa673c297885
[4/4] i2c: Remove I2C_CLASS_SPD
      commit: f7ece6320f6f028873649b9aa836c5bc5abf2cb3