Skip to contentSkip to conversation

i2c: Mark I2C_CLASS_DDC as deprecated and emit warning if adapters declare support for it

PATCH In review Heiner Kallweit 2 participants 5 messages Oct 11, 2023 – Oct 31, 2023

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

PATCH 1/1 i2c: Mark I2C_CLASS_DDC as deprecated and emit warning if adapters declare support for it

With removal of the legacy eeprom driver the only i2c client device driver with I2C_CLASS_DDC is gone, so it's time to mark I2C_CLASS_DDC as deprecated.
Use pr_warn_once, because graphics adapters can have several i2c busses and we may see the warning multiple times otherwise.

Note:
Driver staging/olpc_dcon declares support for classes HWMON and DDC, but only HWMON is used with the scx200_acb adapter driver on olpc devices.

---
 drivers/i2c/i2c-core-base.c | 4 ++++
 include/linux/i2c.h         | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +4 -0
index 60746652f..34b475823 100644
@@ -1487,6 +1487,10 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 		goto out_list;
 	}
 
+	if (adap->class & I2C_CLASS_DDC)
+		pr_warn_once("adapter '%s': Probing for class DDC devices is deprecated\n",
+			     adap->name);
+
 	if (!adap->lock_ops)
 		adap->lock_ops = &i2c_adapter_lock_ops;
 
include/linux/i2c.h +1 -1
index 0dae9db27..dfbd121b7 100644
@@ -850,7 +850,7 @@ 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_DDC		(1<<3)	/* DDC bus on graphics adapters */
+#define I2C_CLASS_DDC		(1<<3)	/* Deprecated: DDC bus on graphics adapters */
 #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.42.0
#1 lore raw

Hi Heiner!

Quoted 3 lines

With removal of the legacy eeprom driver the only i2c client device driver with I2C_CLASS_DDC is gone, so it's time to mark I2C_CLASS_DDC as deprecated.

OK, but I will need to wait until the eeprom-removal hits mainline.

Quoted 7 lines

Use pr_warn_once, because graphics adapters can have several i2c busses and we may see the warning multiple times otherwise.

Note:
Driver staging/olpc_dcon declares support for classes HWMON and DDC, but only HWMON is used with the scx200_acb adapter driver on olpc devices.

And why don't we remove its DDC declaration here in this patch?

Thanks for cleaning this up!

Regards,

Wolfram

#2 lore raw
Quoted 11 lines · Wolfram Sang

Hi Heiner!

Quoted 3 lines

With removal of the legacy eeprom driver the only i2c client device driver with I2C_CLASS_DDC is gone, so it's time to mark I2C_CLASS_DDC as deprecated.

OK, but I will need to wait until the eeprom-removal hits mainline.

Quoted 3 lines

Use pr_warn_once, because graphics adapters can have several i2c busses and we may see the warning multiple times otherwise.

Quoted 7 lines
Quoted 4 lines

Note:
Driver staging/olpc_dcon declares support for classes HWMON and DDC, but only HWMON is used with the scx200_acb adapter driver on olpc devices.

And why don't we remove its DDC declaration here in this patch?

OK, will submit this as follow-up.

Quoted 6 lines

Thanks for cleaning this up!

Regards,

Wolfram

#3 lore raw
In reply to Wolfram Sang
Quoted 11 lines · Wolfram Sang

Hi Heiner!

Quoted 3 lines

With removal of the legacy eeprom driver the only i2c client device driver with I2C_CLASS_DDC is gone, so it's time to mark I2C_CLASS_DDC as deprecated.

OK, but I will need to wait until the eeprom-removal hits mainline.

Quoted 3 lines

Use pr_warn_once, because graphics adapters can have several i2c busses and we may see the warning multiple times otherwise.

Quoted 7 lines
Quoted 4 lines

Note:
Driver staging/olpc_dcon declares support for classes HWMON and DDC, but only HWMON is used with the scx200_acb adapter driver on olpc devices.

And why don't we remove its DDC declaration here in this patch?

Both changes should reach mainline in the next days. 0210a684cdb2 ("staging: olpc_dcon: Remove I2C_CLASS_DDC support") 0113a99b8a75 ("eeprom: Remove deprecated legacy eeprom driver")

I reactivated my rudimentary Coccinelle skills and think I'll prepare a series that removes definition of I2C_CLASS_DDC and all its users. Means you can drop the patch introducing a depreciation warning.

Quoted 6 lines

Thanks for cleaning this up!

Regards,

Wolfram

Heiner

#4 lore raw
Quoted 4 lines

I reactivated my rudimentary Coccinelle skills and think I'll prepare a series that removes definition of I2C_CLASS_DDC and all its users. Means you can drop the patch introducing a depreciation warning.

Okay, cool!