Skip to contentSkip to conversation

i2c: mux: Remove class argument from i2c_mux_add_adapter()

PATCH Applied Heiner Kallweit 7 participants 8 messages Apr 18, 2024 – May 13, 2024

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

PATCH 1/1 i2c: mux: Remove class argument from i2c_mux_add_adapter()

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

---
 drivers/gpu/drm/bridge/sii902x.c           |  2 +-
 drivers/i2c/i2c-mux.c                      | 24 +---------------------
 drivers/i2c/muxes/i2c-arb-gpio-challenge.c |  2 +-
 drivers/i2c/muxes/i2c-mux-gpio.c           |  2 +-
 drivers/i2c/muxes/i2c-mux-gpmux.c          |  2 +-
 drivers/i2c/muxes/i2c-mux-ltc4306.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-mlxcpld.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca9541.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca954x.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pinctrl.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-reg.c            |  2 +-
 drivers/iio/gyro/mpu3050-i2c.c             |  2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  2 +-
 drivers/media/dvb-frontends/af9013.c       |  2 +-
 drivers/media/dvb-frontends/lgdt3306a.c    |  2 +-
 drivers/media/dvb-frontends/m88ds3103.c    |  2 +-
 drivers/media/dvb-frontends/rtl2830.c      |  2 +-
 drivers/media/dvb-frontends/rtl2832.c      |  2 +-
 drivers/media/dvb-frontends/si2168.c       |  2 +-
 drivers/media/i2c/max9286.c                |  2 +-
 drivers/media/usb/cx231xx/cx231xx-i2c.c    |  5 +----
 drivers/of/unittest.c                      |  2 +-
 include/linux/i2c-mux.h                    |  3 +--
 23 files changed, 23 insertions(+), 49 deletions(-)
drivers/gpu/drm/bridge/sii902x.c +1 -1
index 8f84e9824..2fbeda902 100644
@@ -1092,7 +1092,7 @@ static int sii902x_init(struct sii902x *sii902x)
 	}
 
 	sii902x->i2cmux->priv = sii902x;
-	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0);
+	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0);
 	if (ret)
 		goto err_unreg_audio;
 
drivers/i2c/i2c-mux.c +1 -23
index 57ff09f18..fda72e8be 100644
@@ -127,19 +127,6 @@ static u32 i2c_mux_functionality(struct i2c_adapter *adap)
 	return parent->algo->functionality(parent);
 }
 
-/* Return all parent classes, merged */
-static unsigned int i2c_mux_parent_classes(struct i2c_adapter *parent)
-{
-	unsigned int class = 0;
-
-	do {
-		class |= parent->class;
-		parent = i2c_parent_is_i2c_adapter(parent);
-	} while (parent);
-
-	return class;
-}
-
 static void i2c_mux_lock_bus(struct i2c_adapter *adapter, unsigned int flags)
 {
 	struct i2c_mux_priv *priv = adapter->algo_data;
@@ -281,8 +268,7 @@ static const struct i2c_lock_operations i2c_parent_lock_ops = {
 };
 
 int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class)
+			u32 force_nr, u32 chan_id)
 {
 	struct i2c_adapter *parent = muxc->parent;
 	struct i2c_mux_priv *priv;
@@ -340,14 +326,6 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
 	else
 		priv->adap.lock_ops = &i2c_parent_lock_ops;
 
-	/* Sanity check on class */
-	if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
-		dev_err(&parent->dev,
-			"Segment %d behind mux can't share classes with ancestors\n",
-			chan_id);
-	else
-		priv->adap.class = class;
-
 	/*
 	 * Try to populate the mux adapter's of_node, expands to
 	 * nothing if !CONFIG_OF.
drivers/i2c/muxes/i2c-arb-gpio-challenge.c +1 -1
index 24168e9f7..7aa6e795d 100644
@@ -167,7 +167,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
 	}
 
 	/* Actually add the mux adapter */
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
 	if (ret)
 		i2c_put_adapter(muxc->parent);
 
drivers/i2c/muxes/i2c-mux-gpio.c +1 -1
index 0fbb33a3d..d6bbb8b68 100644
@@ -207,7 +207,7 @@ 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;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
 		if (ret)
 			goto add_adapter_failed;
 	}
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -1
index 8305661e1..10d63307b 100644
@@ -124,7 +124,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 			goto err_children;
 		}
 
-		ret = i2c_mux_add_adapter(muxc, 0, chan, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, chan);
 		if (ret)
 			goto err_children;
 	}
drivers/i2c/muxes/i2c-mux-ltc4306.c +1 -1
index 23766d853..19a7c3709 100644
@@ -279,7 +279,7 @@ static int ltc4306_probe(struct i2c_client *client)
 
 	/* Now create an adapter for each channel */
 	for (num = 0; num < chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
 		if (ret) {
 			i2c_mux_del_adapters(muxc);
 			return ret;
drivers/i2c/muxes/i2c-mux-mlxcpld.c +1 -1
index 4c6ed1d58..3f06aa333 100644
@@ -154,7 +154,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
 
 	/* Create an adapter for each channel. */
 	for (num = 0; num < pdata->num_adaps; num++) {
-		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
+		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num]);
 		if (err)
 			goto virt_reg_failed;
 	}
drivers/i2c/muxes/i2c-mux-pca9541.c +1 -1
index ce0fb6924..e28694d99 100644
@@ -314,7 +314,7 @@ static int pca9541_probe(struct i2c_client *client)
 
 	i2c_set_clientdata(client, muxc);
 
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
 	if (ret)
 		return ret;
 
drivers/i2c/muxes/i2c-mux-pca954x.c +1 -1
index c3f4ff08a..6f8401825 100644
@@ -644,7 +644,7 @@ static int pca954x_probe(struct i2c_client *client)
 
 	/* Now create an adapter for each channel */
 	for (num = 0; num < data->chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
 		if (ret)
 			goto fail_cleanup;
 	}
drivers/i2c/muxes/i2c-mux-pinctrl.c +1 -1
index 6ebca7bfd..02aaf0781 100644
@@ -151,7 +151,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
 
 	/* Do not add any adapter for the idle state (if it's there at all). */
 	for (i = 0; i < num_names - !!muxc->deselect; i++) {
-		ret = i2c_mux_add_adapter(muxc, 0, i, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, i);
 		if (ret)
 			goto err_del_adapter;
 	}
drivers/i2c/muxes/i2c-mux-reg.c +1 -1
index 8489971ba..ef765fcd3 100644
@@ -213,7 +213,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
 	for (i = 0; i < mux->data.n_values; i++) {
 		nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
 		if (ret)
 			goto err_del_mux_adapters;
 	}
drivers/iio/gyro/mpu3050-i2c.c +1 -1
index 52b6feed2..29ecfa6fd 100644
@@ -72,7 +72,7 @@ static int mpu3050_i2c_probe(struct i2c_client *client)
 	else {
 		mpu3050->i2cmux->priv = mpu3050;
 		/* Ignore failure, not critical */
-		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0, 0);
+		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0);
 	}
 
 	return 0;
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +1 -1
index 410ea39fd..0e03137fb 100644
@@ -142,7 +142,7 @@ static int inv_mpu_probe(struct i2c_client *client)
 		if (!st->muxc)
 			return -ENOMEM;
 		st->muxc->priv = dev_get_drvdata(&client->dev);
-		result = i2c_mux_add_adapter(st->muxc, 0, 0, 0);
+		result = i2c_mux_add_adapter(st->muxc, 0, 0);
 		if (result)
 			return result;
 		result = inv_mpu_acpi_create_mux_client(client);
drivers/media/dvb-frontends/af9013.c +1 -1
index a829c8979..5afdbe244 100644
@@ -1480,7 +1480,7 @@ static int af9013_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	state->muxc->priv = state;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/lgdt3306a.c +1 -1
index 263887592..91c71b24c 100644
@@ -2203,7 +2203,7 @@ static int lgdt3306a_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	state->muxc->priv = client;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/dvb-frontends/m88ds3103.c +1 -1
index e0272054f..6c69bcc7a 100644
@@ -1866,7 +1866,7 @@ static int m88ds3103_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/dvb-frontends/rtl2830.c +1 -1
index 35c969fd2..30d10fe4b 100644
@@ -838,7 +838,7 @@ static int rtl2830_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/rtl2832.c +1 -1
index 601cf45c3..5142820b1 100644
@@ -1082,7 +1082,7 @@ static int rtl2832_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/si2168.c +1 -1
index dae1f2153..26828fd41 100644
@@ -744,7 +744,7 @@ static int si2168_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/i2c/max9286.c +1 -1
index d685d445c..dfcb3fc03 100644
@@ -383,7 +383,7 @@ static int max9286_i2c_mux_init(struct max9286_priv *priv)
 	for_each_source(priv, source) {
 		unsigned int index = to_index(priv, source);
 
-		ret = i2c_mux_add_adapter(priv->mux, 0, index, 0);
+		ret = i2c_mux_add_adapter(priv->mux, 0, index);
 		if (ret < 0)
 			goto error;
 	}
drivers/media/usb/cx231xx/cx231xx-i2c.c +1 -4
index c6659253c..6da8e7943 100644
@@ -567,10 +567,7 @@ int cx231xx_i2c_mux_create(struct cx231xx *dev)
 
 int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no)
 {
-	return i2c_mux_add_adapter(dev->muxc,
-				   0,
-				   mux_no /* chan_id */,
-				   0 /* class */);
+	return i2c_mux_add_adapter(dev->muxc, 0, mux_no);
 }
 
 void cx231xx_i2c_mux_unregister(struct cx231xx *dev)
drivers/of/unittest.c +1 -1
index 6b5c36b6a..c8ee866d7 100644
@@ -2815,7 +2815,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client)
 	if (!muxc)
 		return -ENOMEM;
 	for (i = 0; i < nchans; i++) {
-		if (i2c_mux_add_adapter(muxc, 0, i, 0)) {
+		if (i2c_mux_add_adapter(muxc, 0, i)) {
 			dev_err(dev, "Failed to register mux #%d\n", i);
 			i2c_mux_del_adapters(muxc);
 			return -ENODEV;
include/linux/i2c-mux.h +1 -2
index 98ef73b7c..1784ac7af 100644
@@ -56,8 +56,7 @@ struct i2c_adapter *i2c_root_adapter(struct device *dev);
  * callback functions to perform hardware-specific mux control.
  */
 int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class);
+			u32 force_nr, u32 chan_id);
 
 void i2c_mux_del_adapters(struct i2c_mux_core *muxc);
 
Signature · 1 line
2.44.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi

Am 18.04.24 um 22:55 schrieb Heiner Kallweit:

Quoted 11 lines

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

---
  drivers/gpu/drm/bridge/sii902x.c           |  2 +-

For the DRM file:

Best regards
Thomas

Quoted 363 lines
  drivers/i2c/i2c-mux.c                      | 24 +---------------------
  drivers/i2c/muxes/i2c-arb-gpio-challenge.c |  2 +-
  drivers/i2c/muxes/i2c-mux-gpio.c           |  2 +-
  drivers/i2c/muxes/i2c-mux-gpmux.c          |  2 +-
  drivers/i2c/muxes/i2c-mux-ltc4306.c        |  2 +-
  drivers/i2c/muxes/i2c-mux-mlxcpld.c        |  2 +-
  drivers/i2c/muxes/i2c-mux-pca9541.c        |  2 +-
  drivers/i2c/muxes/i2c-mux-pca954x.c        |  2 +-
  drivers/i2c/muxes/i2c-mux-pinctrl.c        |  2 +-
  drivers/i2c/muxes/i2c-mux-reg.c            |  2 +-
  drivers/iio/gyro/mpu3050-i2c.c             |  2 +-
  drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  2 +-
  drivers/media/dvb-frontends/af9013.c       |  2 +-
  drivers/media/dvb-frontends/lgdt3306a.c    |  2 +-
  drivers/media/dvb-frontends/m88ds3103.c    |  2 +-
  drivers/media/dvb-frontends/rtl2830.c      |  2 +-
  drivers/media/dvb-frontends/rtl2832.c      |  2 +-
  drivers/media/dvb-frontends/si2168.c       |  2 +-
  drivers/media/i2c/max9286.c                |  2 +-
  drivers/media/usb/cx231xx/cx231xx-i2c.c    |  5 +----
  drivers/of/unittest.c                      |  2 +-
  include/linux/i2c-mux.h                    |  3 +--
  23 files changed, 23 insertions(+), 49 deletions(-)
drivers/gpu/drm/bridge/sii902x.c +1 -1
index 8f84e9824..2fbeda902 100644
@@ -1092,7 +1092,7 @@ static int sii902x_init(struct sii902x *sii902x)
  	}
 
  	sii902x->i2cmux->priv = sii902x;
-	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0);
+	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0);
  	if (ret)
  		goto err_unreg_audio;
 
drivers/i2c/i2c-mux.c +1 -23
index 57ff09f18..fda72e8be 100644
@@ -127,19 +127,6 @@ static u32 i2c_mux_functionality(struct i2c_adapter *adap)
  	return parent->algo->functionality(parent);
  }
 
-/* Return all parent classes, merged */
-static unsigned int i2c_mux_parent_classes(struct i2c_adapter *parent)
-{
-	unsigned int class = 0;
-
-	do {
-		class |= parent->class;
-		parent = i2c_parent_is_i2c_adapter(parent);
-	} while (parent);
-
-	return class;
-}
-
  static void i2c_mux_lock_bus(struct i2c_adapter *adapter, unsigned int flags)
  {
  	struct i2c_mux_priv *priv = adapter->algo_data;
@@ -281,8 +268,7 @@ static const struct i2c_lock_operations i2c_parent_lock_ops = {
  };
 
  int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class)
+			u32 force_nr, u32 chan_id)
  {
  	struct i2c_adapter *parent = muxc->parent;
  	struct i2c_mux_priv *priv;
@@ -340,14 +326,6 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
  	else
  		priv->adap.lock_ops = &i2c_parent_lock_ops;
 
-	/* Sanity check on class */
-	if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
-		dev_err(&parent->dev,
-			"Segment %d behind mux can't share classes with ancestors\n",
-			chan_id);
-	else
-		priv->adap.class = class;
-
  	/*
  	 * Try to populate the mux adapter's of_node, expands to
  	 * nothing if !CONFIG_OF.
drivers/i2c/muxes/i2c-arb-gpio-challenge.c +1 -1
index 24168e9f7..7aa6e795d 100644
@@ -167,7 +167,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
  	}
 
  	/* Actually add the mux adapter */
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
  	if (ret)
  		i2c_put_adapter(muxc->parent);
 
drivers/i2c/muxes/i2c-mux-gpio.c +1 -1
index 0fbb33a3d..d6bbb8b68 100644
@@ -207,7 +207,7 @@ 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;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
  		if (ret)
  			goto add_adapter_failed;
  	}
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -1
index 8305661e1..10d63307b 100644
@@ -124,7 +124,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
  			goto err_children;
  		}
 
-		ret = i2c_mux_add_adapter(muxc, 0, chan, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, chan);
  		if (ret)
  			goto err_children;
  	}
drivers/i2c/muxes/i2c-mux-ltc4306.c +1 -1
index 23766d853..19a7c3709 100644
@@ -279,7 +279,7 @@ static int ltc4306_probe(struct i2c_client *client)
 
  	/* Now create an adapter for each channel */
  	for (num = 0; num < chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
  		if (ret) {
  			i2c_mux_del_adapters(muxc);
  			return ret;
drivers/i2c/muxes/i2c-mux-mlxcpld.c +1 -1
index 4c6ed1d58..3f06aa333 100644
@@ -154,7 +154,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
 
  	/* Create an adapter for each channel. */
  	for (num = 0; num < pdata->num_adaps; num++) {
-		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
+		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num]);
  		if (err)
  			goto virt_reg_failed;
  	}
drivers/i2c/muxes/i2c-mux-pca9541.c +1 -1
index ce0fb6924..e28694d99 100644
@@ -314,7 +314,7 @@ static int pca9541_probe(struct i2c_client *client)
 
  	i2c_set_clientdata(client, muxc);
 
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
  	if (ret)
  		return ret;
 
drivers/i2c/muxes/i2c-mux-pca954x.c +1 -1
index c3f4ff08a..6f8401825 100644
@@ -644,7 +644,7 @@ static int pca954x_probe(struct i2c_client *client)
 
  	/* Now create an adapter for each channel */
  	for (num = 0; num < data->chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
  		if (ret)
  			goto fail_cleanup;
  	}
drivers/i2c/muxes/i2c-mux-pinctrl.c +1 -1
index 6ebca7bfd..02aaf0781 100644
@@ -151,7 +151,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
 
  	/* Do not add any adapter for the idle state (if it's there at all). */
  	for (i = 0; i < num_names - !!muxc->deselect; i++) {
-		ret = i2c_mux_add_adapter(muxc, 0, i, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, i);
  		if (ret)
  			goto err_del_adapter;
  	}
drivers/i2c/muxes/i2c-mux-reg.c +1 -1
index 8489971ba..ef765fcd3 100644
@@ -213,7 +213,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
  	for (i = 0; i < mux->data.n_values; i++) {
  		nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
  		if (ret)
  			goto err_del_mux_adapters;
  	}
drivers/iio/gyro/mpu3050-i2c.c +1 -1
index 52b6feed2..29ecfa6fd 100644
@@ -72,7 +72,7 @@ static int mpu3050_i2c_probe(struct i2c_client *client)
  	else {
  		mpu3050->i2cmux->priv = mpu3050;
  		/* Ignore failure, not critical */
-		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0, 0);
+		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0);
  	}
 
  	return 0;
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +1 -1
index 410ea39fd..0e03137fb 100644
@@ -142,7 +142,7 @@ static int inv_mpu_probe(struct i2c_client *client)
  		if (!st->muxc)
  			return -ENOMEM;
  		st->muxc->priv = dev_get_drvdata(&client->dev);
-		result = i2c_mux_add_adapter(st->muxc, 0, 0, 0);
+		result = i2c_mux_add_adapter(st->muxc, 0, 0);
  		if (result)
  			return result;
  		result = inv_mpu_acpi_create_mux_client(client);
drivers/media/dvb-frontends/af9013.c +1 -1
index a829c8979..5afdbe244 100644
@@ -1480,7 +1480,7 @@ static int af9013_probe(struct i2c_client *client)
  		goto err_regmap_exit;
  	}
  	state->muxc->priv = state;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
  	if (ret)
  		goto err_regmap_exit;
 
drivers/media/dvb-frontends/lgdt3306a.c +1 -1
index 263887592..91c71b24c 100644
@@ -2203,7 +2203,7 @@ static int lgdt3306a_probe(struct i2c_client *client)
  		goto err_kfree;
  	}
  	state->muxc->priv = client;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
  	if (ret)
  		goto err_kfree;
 
drivers/media/dvb-frontends/m88ds3103.c +1 -1
index e0272054f..6c69bcc7a 100644
@@ -1866,7 +1866,7 @@ static int m88ds3103_probe(struct i2c_client *client)
  		goto err_kfree;
  	}
  	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
  	if (ret)
  		goto err_kfree;
 
drivers/media/dvb-frontends/rtl2830.c +1 -1
index 35c969fd2..30d10fe4b 100644
@@ -838,7 +838,7 @@ static int rtl2830_probe(struct i2c_client *client)
  		goto err_regmap_exit;
  	}
  	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
  	if (ret)
  		goto err_regmap_exit;
 
drivers/media/dvb-frontends/rtl2832.c +1 -1
index 601cf45c3..5142820b1 100644
@@ -1082,7 +1082,7 @@ static int rtl2832_probe(struct i2c_client *client)
  		goto err_regmap_exit;
  	}
  	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
  	if (ret)
  		goto err_regmap_exit;
 
drivers/media/dvb-frontends/si2168.c +1 -1
index dae1f2153..26828fd41 100644
@@ -744,7 +744,7 @@ static int si2168_probe(struct i2c_client *client)
  		goto err_kfree;
  	}
  	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
  	if (ret)
  		goto err_kfree;
 
drivers/media/i2c/max9286.c +1 -1
index d685d445c..dfcb3fc03 100644
@@ -383,7 +383,7 @@ static int max9286_i2c_mux_init(struct max9286_priv *priv)
  	for_each_source(priv, source) {
  		unsigned int index = to_index(priv, source);
 
-		ret = i2c_mux_add_adapter(priv->mux, 0, index, 0);
+		ret = i2c_mux_add_adapter(priv->mux, 0, index);
  		if (ret < 0)
  			goto error;
  	}
drivers/media/usb/cx231xx/cx231xx-i2c.c +1 -4
index c6659253c..6da8e7943 100644
@@ -567,10 +567,7 @@ int cx231xx_i2c_mux_create(struct cx231xx *dev)
 
  int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no)
  {
-	return i2c_mux_add_adapter(dev->muxc,
-				   0,
-				   mux_no /* chan_id */,
-				   0 /* class */);
+	return i2c_mux_add_adapter(dev->muxc, 0, mux_no);
  }
 
  void cx231xx_i2c_mux_unregister(struct cx231xx *dev)
drivers/of/unittest.c +1 -1
index 6b5c36b6a..c8ee866d7 100644
@@ -2815,7 +2815,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client)
  	if (!muxc)
  		return -ENOMEM;
  	for (i = 0; i < nchans; i++) {
-		if (i2c_mux_add_adapter(muxc, 0, i, 0)) {
+		if (i2c_mux_add_adapter(muxc, 0, i)) {
  			dev_err(dev, "Failed to register mux #%d\n", i);
  			i2c_mux_del_adapters(muxc);
  			return -ENODEV;
include/linux/i2c-mux.h +1 -2
index 98ef73b7c..1784ac7af 100644
@@ -56,8 +56,7 @@ struct i2c_adapter *i2c_root_adapter(struct device *dev);
   * callback functions to perform hardware-specific mux control.
   */
  int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class);
+			u32 force_nr, u32 chan_id);
 
  void i2c_mux_del_adapters(struct i2c_mux_core *muxc);
 
Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
Acked-by on v1 1/1
#2 lore raw
In reply to Heiner Kallweit

Hi!

Quoted 9 lines · Heiner Kallweit

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

Cheers,
Peter

reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Heiner Kallweit

Hi Heiner,

Thank you for the patch.

Quoted 9 lines · Heiner Kallweit

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

Quoted 365 lines
---
 drivers/gpu/drm/bridge/sii902x.c           |  2 +-
 drivers/i2c/i2c-mux.c                      | 24 +---------------------
 drivers/i2c/muxes/i2c-arb-gpio-challenge.c |  2 +-
 drivers/i2c/muxes/i2c-mux-gpio.c           |  2 +-
 drivers/i2c/muxes/i2c-mux-gpmux.c          |  2 +-
 drivers/i2c/muxes/i2c-mux-ltc4306.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-mlxcpld.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca9541.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca954x.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pinctrl.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-reg.c            |  2 +-
 drivers/iio/gyro/mpu3050-i2c.c             |  2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  2 +-
 drivers/media/dvb-frontends/af9013.c       |  2 +-
 drivers/media/dvb-frontends/lgdt3306a.c    |  2 +-
 drivers/media/dvb-frontends/m88ds3103.c    |  2 +-
 drivers/media/dvb-frontends/rtl2830.c      |  2 +-
 drivers/media/dvb-frontends/rtl2832.c      |  2 +-
 drivers/media/dvb-frontends/si2168.c       |  2 +-
 drivers/media/i2c/max9286.c                |  2 +-
 drivers/media/usb/cx231xx/cx231xx-i2c.c    |  5 +----
 drivers/of/unittest.c                      |  2 +-
 include/linux/i2c-mux.h                    |  3 +--
 23 files changed, 23 insertions(+), 49 deletions(-)
drivers/gpu/drm/bridge/sii902x.c +1 -1
index 8f84e9824..2fbeda902 100644
@@ -1092,7 +1092,7 @@ static int sii902x_init(struct sii902x *sii902x)
 	}
 
 	sii902x->i2cmux->priv = sii902x;
-	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0);
+	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0);
 	if (ret)
 		goto err_unreg_audio;
 
drivers/i2c/i2c-mux.c +1 -23
index 57ff09f18..fda72e8be 100644
@@ -127,19 +127,6 @@ static u32 i2c_mux_functionality(struct i2c_adapter *adap)
 	return parent->algo->functionality(parent);
 }
 
-/* Return all parent classes, merged */
-static unsigned int i2c_mux_parent_classes(struct i2c_adapter *parent)
-{
-	unsigned int class = 0;
-
-	do {
-		class |= parent->class;
-		parent = i2c_parent_is_i2c_adapter(parent);
-	} while (parent);
-
-	return class;
-}
-
 static void i2c_mux_lock_bus(struct i2c_adapter *adapter, unsigned int flags)
 {
 	struct i2c_mux_priv *priv = adapter->algo_data;
@@ -281,8 +268,7 @@ static const struct i2c_lock_operations i2c_parent_lock_ops = {
 };
 
 int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class)
+			u32 force_nr, u32 chan_id)
 {
 	struct i2c_adapter *parent = muxc->parent;
 	struct i2c_mux_priv *priv;
@@ -340,14 +326,6 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
 	else
 		priv->adap.lock_ops = &i2c_parent_lock_ops;
 
-	/* Sanity check on class */
-	if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
-		dev_err(&parent->dev,
-			"Segment %d behind mux can't share classes with ancestors\n",
-			chan_id);
-	else
-		priv->adap.class = class;
-
 	/*
 	 * Try to populate the mux adapter's of_node, expands to
 	 * nothing if !CONFIG_OF.
drivers/i2c/muxes/i2c-arb-gpio-challenge.c +1 -1
index 24168e9f7..7aa6e795d 100644
@@ -167,7 +167,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
 	}
 
 	/* Actually add the mux adapter */
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
 	if (ret)
 		i2c_put_adapter(muxc->parent);
 
drivers/i2c/muxes/i2c-mux-gpio.c +1 -1
index 0fbb33a3d..d6bbb8b68 100644
@@ -207,7 +207,7 @@ 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;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
 		if (ret)
 			goto add_adapter_failed;
 	}
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -1
index 8305661e1..10d63307b 100644
@@ -124,7 +124,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 			goto err_children;
 		}
 
-		ret = i2c_mux_add_adapter(muxc, 0, chan, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, chan);
 		if (ret)
 			goto err_children;
 	}
drivers/i2c/muxes/i2c-mux-ltc4306.c +1 -1
index 23766d853..19a7c3709 100644
@@ -279,7 +279,7 @@ static int ltc4306_probe(struct i2c_client *client)
 
 	/* Now create an adapter for each channel */
 	for (num = 0; num < chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
 		if (ret) {
 			i2c_mux_del_adapters(muxc);
 			return ret;
drivers/i2c/muxes/i2c-mux-mlxcpld.c +1 -1
index 4c6ed1d58..3f06aa333 100644
@@ -154,7 +154,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
 
 	/* Create an adapter for each channel. */
 	for (num = 0; num < pdata->num_adaps; num++) {
-		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
+		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num]);
 		if (err)
 			goto virt_reg_failed;
 	}
drivers/i2c/muxes/i2c-mux-pca9541.c +1 -1
index ce0fb6924..e28694d99 100644
@@ -314,7 +314,7 @@ static int pca9541_probe(struct i2c_client *client)
 
 	i2c_set_clientdata(client, muxc);
 
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
 	if (ret)
 		return ret;
 
drivers/i2c/muxes/i2c-mux-pca954x.c +1 -1
index c3f4ff08a..6f8401825 100644
@@ -644,7 +644,7 @@ static int pca954x_probe(struct i2c_client *client)
 
 	/* Now create an adapter for each channel */
 	for (num = 0; num < data->chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
 		if (ret)
 			goto fail_cleanup;
 	}
drivers/i2c/muxes/i2c-mux-pinctrl.c +1 -1
index 6ebca7bfd..02aaf0781 100644
@@ -151,7 +151,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
 
 	/* Do not add any adapter for the idle state (if it's there at all). */
 	for (i = 0; i < num_names - !!muxc->deselect; i++) {
-		ret = i2c_mux_add_adapter(muxc, 0, i, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, i);
 		if (ret)
 			goto err_del_adapter;
 	}
drivers/i2c/muxes/i2c-mux-reg.c +1 -1
index 8489971ba..ef765fcd3 100644
@@ -213,7 +213,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
 	for (i = 0; i < mux->data.n_values; i++) {
 		nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
 		if (ret)
 			goto err_del_mux_adapters;
 	}
drivers/iio/gyro/mpu3050-i2c.c +1 -1
index 52b6feed2..29ecfa6fd 100644
@@ -72,7 +72,7 @@ static int mpu3050_i2c_probe(struct i2c_client *client)
 	else {
 		mpu3050->i2cmux->priv = mpu3050;
 		/* Ignore failure, not critical */
-		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0, 0);
+		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0);
 	}
 
 	return 0;
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +1 -1
index 410ea39fd..0e03137fb 100644
@@ -142,7 +142,7 @@ static int inv_mpu_probe(struct i2c_client *client)
 		if (!st->muxc)
 			return -ENOMEM;
 		st->muxc->priv = dev_get_drvdata(&client->dev);
-		result = i2c_mux_add_adapter(st->muxc, 0, 0, 0);
+		result = i2c_mux_add_adapter(st->muxc, 0, 0);
 		if (result)
 			return result;
 		result = inv_mpu_acpi_create_mux_client(client);
drivers/media/dvb-frontends/af9013.c +1 -1
index a829c8979..5afdbe244 100644
@@ -1480,7 +1480,7 @@ static int af9013_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	state->muxc->priv = state;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/lgdt3306a.c +1 -1
index 263887592..91c71b24c 100644
@@ -2203,7 +2203,7 @@ static int lgdt3306a_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	state->muxc->priv = client;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/dvb-frontends/m88ds3103.c +1 -1
index e0272054f..6c69bcc7a 100644
@@ -1866,7 +1866,7 @@ static int m88ds3103_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/dvb-frontends/rtl2830.c +1 -1
index 35c969fd2..30d10fe4b 100644
@@ -838,7 +838,7 @@ static int rtl2830_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/rtl2832.c +1 -1
index 601cf45c3..5142820b1 100644
@@ -1082,7 +1082,7 @@ static int rtl2832_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/si2168.c +1 -1
index dae1f2153..26828fd41 100644
@@ -744,7 +744,7 @@ static int si2168_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/i2c/max9286.c +1 -1
index d685d445c..dfcb3fc03 100644
@@ -383,7 +383,7 @@ static int max9286_i2c_mux_init(struct max9286_priv *priv)
 	for_each_source(priv, source) {
 		unsigned int index = to_index(priv, source);
 
-		ret = i2c_mux_add_adapter(priv->mux, 0, index, 0);
+		ret = i2c_mux_add_adapter(priv->mux, 0, index);
 		if (ret < 0)
 			goto error;
 	}
drivers/media/usb/cx231xx/cx231xx-i2c.c +1 -4
index c6659253c..6da8e7943 100644
@@ -567,10 +567,7 @@ int cx231xx_i2c_mux_create(struct cx231xx *dev)
 
 int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no)
 {
-	return i2c_mux_add_adapter(dev->muxc,
-				   0,
-				   mux_no /* chan_id */,
-				   0 /* class */);
+	return i2c_mux_add_adapter(dev->muxc, 0, mux_no);
 }
 
 void cx231xx_i2c_mux_unregister(struct cx231xx *dev)
drivers/of/unittest.c +1 -1
index 6b5c36b6a..c8ee866d7 100644
@@ -2815,7 +2815,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client)
 	if (!muxc)
 		return -ENOMEM;
 	for (i = 0; i < nchans; i++) {
-		if (i2c_mux_add_adapter(muxc, 0, i, 0)) {
+		if (i2c_mux_add_adapter(muxc, 0, i)) {
 			dev_err(dev, "Failed to register mux #%d\n", i);
 			i2c_mux_del_adapters(muxc);
 			return -ENODEV;
include/linux/i2c-mux.h +1 -2
index 98ef73b7c..1784ac7af 100644
@@ -56,8 +56,7 @@ struct i2c_adapter *i2c_root_adapter(struct device *dev);
  * callback functions to perform hardware-specific mux control.
  */
 int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class);
+			u32 force_nr, u32 chan_id);
 
 void i2c_mux_del_adapters(struct i2c_mux_core *muxc);
 
Signature · 3 lines
Regards,

Laurent Pinchart
Acked-by on v1 1/1
#4 lore raw
In reply to Heiner Kallweit
Quoted 9 lines · On Thu, 18 Apr 2024 22:55:39 +0200 Heiner Kallweit <[email protected]> wrote:

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

For iio

Quoted 365 lines
---
 drivers/gpu/drm/bridge/sii902x.c           |  2 +-
 drivers/i2c/i2c-mux.c                      | 24 +---------------------
 drivers/i2c/muxes/i2c-arb-gpio-challenge.c |  2 +-
 drivers/i2c/muxes/i2c-mux-gpio.c           |  2 +-
 drivers/i2c/muxes/i2c-mux-gpmux.c          |  2 +-
 drivers/i2c/muxes/i2c-mux-ltc4306.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-mlxcpld.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca9541.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca954x.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pinctrl.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-reg.c            |  2 +-
 drivers/iio/gyro/mpu3050-i2c.c             |  2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  2 +-
 drivers/media/dvb-frontends/af9013.c       |  2 +-
 drivers/media/dvb-frontends/lgdt3306a.c    |  2 +-
 drivers/media/dvb-frontends/m88ds3103.c    |  2 +-
 drivers/media/dvb-frontends/rtl2830.c      |  2 +-
 drivers/media/dvb-frontends/rtl2832.c      |  2 +-
 drivers/media/dvb-frontends/si2168.c       |  2 +-
 drivers/media/i2c/max9286.c                |  2 +-
 drivers/media/usb/cx231xx/cx231xx-i2c.c    |  5 +----
 drivers/of/unittest.c                      |  2 +-
 include/linux/i2c-mux.h                    |  3 +--
 23 files changed, 23 insertions(+), 49 deletions(-)
drivers/gpu/drm/bridge/sii902x.c +1 -1
index 8f84e9824..2fbeda902 100644
@@ -1092,7 +1092,7 @@ static int sii902x_init(struct sii902x *sii902x)
 	}
 
 	sii902x->i2cmux->priv = sii902x;
-	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0);
+	ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0);
 	if (ret)
 		goto err_unreg_audio;
 
drivers/i2c/i2c-mux.c +1 -23
index 57ff09f18..fda72e8be 100644
@@ -127,19 +127,6 @@ static u32 i2c_mux_functionality(struct i2c_adapter *adap)
 	return parent->algo->functionality(parent);
 }
 
-/* Return all parent classes, merged */
-static unsigned int i2c_mux_parent_classes(struct i2c_adapter *parent)
-{
-	unsigned int class = 0;
-
-	do {
-		class |= parent->class;
-		parent = i2c_parent_is_i2c_adapter(parent);
-	} while (parent);
-
-	return class;
-}
-
 static void i2c_mux_lock_bus(struct i2c_adapter *adapter, unsigned int flags)
 {
 	struct i2c_mux_priv *priv = adapter->algo_data;
@@ -281,8 +268,7 @@ static const struct i2c_lock_operations i2c_parent_lock_ops = {
 };
 
 int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class)
+			u32 force_nr, u32 chan_id)
 {
 	struct i2c_adapter *parent = muxc->parent;
 	struct i2c_mux_priv *priv;
@@ -340,14 +326,6 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
 	else
 		priv->adap.lock_ops = &i2c_parent_lock_ops;
 
-	/* Sanity check on class */
-	if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
-		dev_err(&parent->dev,
-			"Segment %d behind mux can't share classes with ancestors\n",
-			chan_id);
-	else
-		priv->adap.class = class;
-
 	/*
 	 * Try to populate the mux adapter's of_node, expands to
 	 * nothing if !CONFIG_OF.
drivers/i2c/muxes/i2c-arb-gpio-challenge.c +1 -1
index 24168e9f7..7aa6e795d 100644
@@ -167,7 +167,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
 	}
 
 	/* Actually add the mux adapter */
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
 	if (ret)
 		i2c_put_adapter(muxc->parent);
 
drivers/i2c/muxes/i2c-mux-gpio.c +1 -1
index 0fbb33a3d..d6bbb8b68 100644
@@ -207,7 +207,7 @@ 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;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
 		if (ret)
 			goto add_adapter_failed;
 	}
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -1
index 8305661e1..10d63307b 100644
@@ -124,7 +124,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 			goto err_children;
 		}
 
-		ret = i2c_mux_add_adapter(muxc, 0, chan, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, chan);
 		if (ret)
 			goto err_children;
 	}
drivers/i2c/muxes/i2c-mux-ltc4306.c +1 -1
index 23766d853..19a7c3709 100644
@@ -279,7 +279,7 @@ static int ltc4306_probe(struct i2c_client *client)
 
 	/* Now create an adapter for each channel */
 	for (num = 0; num < chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
 		if (ret) {
 			i2c_mux_del_adapters(muxc);
 			return ret;
drivers/i2c/muxes/i2c-mux-mlxcpld.c +1 -1
index 4c6ed1d58..3f06aa333 100644
@@ -154,7 +154,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
 
 	/* Create an adapter for each channel. */
 	for (num = 0; num < pdata->num_adaps; num++) {
-		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
+		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num]);
 		if (err)
 			goto virt_reg_failed;
 	}
drivers/i2c/muxes/i2c-mux-pca9541.c +1 -1
index ce0fb6924..e28694d99 100644
@@ -314,7 +314,7 @@ static int pca9541_probe(struct i2c_client *client)
 
 	i2c_set_clientdata(client, muxc);
 
-	ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(muxc, 0, 0);
 	if (ret)
 		return ret;
 
drivers/i2c/muxes/i2c-mux-pca954x.c +1 -1
index c3f4ff08a..6f8401825 100644
@@ -644,7 +644,7 @@ static int pca954x_probe(struct i2c_client *client)
 
 	/* Now create an adapter for each channel */
 	for (num = 0; num < data->chip->nchans; num++) {
-		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, num);
 		if (ret)
 			goto fail_cleanup;
 	}
drivers/i2c/muxes/i2c-mux-pinctrl.c +1 -1
index 6ebca7bfd..02aaf0781 100644
@@ -151,7 +151,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
 
 	/* Do not add any adapter for the idle state (if it's there at all). */
 	for (i = 0; i < num_names - !!muxc->deselect; i++) {
-		ret = i2c_mux_add_adapter(muxc, 0, i, 0);
+		ret = i2c_mux_add_adapter(muxc, 0, i);
 		if (ret)
 			goto err_del_adapter;
 	}
drivers/i2c/muxes/i2c-mux-reg.c +1 -1
index 8489971ba..ef765fcd3 100644
@@ -213,7 +213,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
 	for (i = 0; i < mux->data.n_values; i++) {
 		nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
 
-		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], 0);
+		ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i]);
 		if (ret)
 			goto err_del_mux_adapters;
 	}
drivers/iio/gyro/mpu3050-i2c.c +1 -1
index 52b6feed2..29ecfa6fd 100644
@@ -72,7 +72,7 @@ static int mpu3050_i2c_probe(struct i2c_client *client)
 	else {
 		mpu3050->i2cmux->priv = mpu3050;
 		/* Ignore failure, not critical */
-		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0, 0);
+		i2c_mux_add_adapter(mpu3050->i2cmux, 0, 0);
 	}
 
 	return 0;
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +1 -1
index 410ea39fd..0e03137fb 100644
@@ -142,7 +142,7 @@ static int inv_mpu_probe(struct i2c_client *client)
 		if (!st->muxc)
 			return -ENOMEM;
 		st->muxc->priv = dev_get_drvdata(&client->dev);
-		result = i2c_mux_add_adapter(st->muxc, 0, 0, 0);
+		result = i2c_mux_add_adapter(st->muxc, 0, 0);
 		if (result)
 			return result;
 		result = inv_mpu_acpi_create_mux_client(client);
drivers/media/dvb-frontends/af9013.c +1 -1
index a829c8979..5afdbe244 100644
@@ -1480,7 +1480,7 @@ static int af9013_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	state->muxc->priv = state;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/lgdt3306a.c +1 -1
index 263887592..91c71b24c 100644
@@ -2203,7 +2203,7 @@ static int lgdt3306a_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	state->muxc->priv = client;
-	ret = i2c_mux_add_adapter(state->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(state->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/dvb-frontends/m88ds3103.c +1 -1
index e0272054f..6c69bcc7a 100644
@@ -1866,7 +1866,7 @@ static int m88ds3103_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/dvb-frontends/rtl2830.c +1 -1
index 35c969fd2..30d10fe4b 100644
@@ -838,7 +838,7 @@ static int rtl2830_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/rtl2832.c +1 -1
index 601cf45c3..5142820b1 100644
@@ -1082,7 +1082,7 @@ static int rtl2832_probe(struct i2c_client *client)
 		goto err_regmap_exit;
 	}
 	dev->muxc->priv = dev;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_regmap_exit;
 
drivers/media/dvb-frontends/si2168.c +1 -1
index dae1f2153..26828fd41 100644
@@ -744,7 +744,7 @@ static int si2168_probe(struct i2c_client *client)
 		goto err_kfree;
 	}
 	dev->muxc->priv = client;
-	ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+	ret = i2c_mux_add_adapter(dev->muxc, 0, 0);
 	if (ret)
 		goto err_kfree;
 
drivers/media/i2c/max9286.c +1 -1
index d685d445c..dfcb3fc03 100644
@@ -383,7 +383,7 @@ static int max9286_i2c_mux_init(struct max9286_priv *priv)
 	for_each_source(priv, source) {
 		unsigned int index = to_index(priv, source);
 
-		ret = i2c_mux_add_adapter(priv->mux, 0, index, 0);
+		ret = i2c_mux_add_adapter(priv->mux, 0, index);
 		if (ret < 0)
 			goto error;
 	}
drivers/media/usb/cx231xx/cx231xx-i2c.c +1 -4
index c6659253c..6da8e7943 100644
@@ -567,10 +567,7 @@ int cx231xx_i2c_mux_create(struct cx231xx *dev)
 
 int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no)
 {
-	return i2c_mux_add_adapter(dev->muxc,
-				   0,
-				   mux_no /* chan_id */,
-				   0 /* class */);
+	return i2c_mux_add_adapter(dev->muxc, 0, mux_no);
 }
 
 void cx231xx_i2c_mux_unregister(struct cx231xx *dev)
drivers/of/unittest.c +1 -1
index 6b5c36b6a..c8ee866d7 100644
@@ -2815,7 +2815,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client)
 	if (!muxc)
 		return -ENOMEM;
 	for (i = 0; i < nchans; i++) {
-		if (i2c_mux_add_adapter(muxc, 0, i, 0)) {
+		if (i2c_mux_add_adapter(muxc, 0, i)) {
 			dev_err(dev, "Failed to register mux #%d\n", i);
 			i2c_mux_del_adapters(muxc);
 			return -ENODEV;
include/linux/i2c-mux.h +1 -2
index 98ef73b7c..1784ac7af 100644
@@ -56,8 +56,7 @@ struct i2c_adapter *i2c_root_adapter(struct device *dev);
  * callback functions to perform hardware-specific mux control.
  */
 int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
-			u32 force_nr, u32 chan_id,
-			unsigned int class);
+			u32 force_nr, u32 chan_id);
 
 void i2c_mux_del_adapters(struct i2c_mux_core *muxc);
 
maintainer Acked-by on v1 1/1
#5 lore raw
In reply to Heiner Kallweit
Quoted 24 lines · Heiner Kallweit

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

---
 drivers/gpu/drm/bridge/sii902x.c           |  2 +-
 drivers/i2c/i2c-mux.c                      | 24 +---------------------
 drivers/i2c/muxes/i2c-arb-gpio-challenge.c |  2 +-
 drivers/i2c/muxes/i2c-mux-gpio.c           |  2 +-
 drivers/i2c/muxes/i2c-mux-gpmux.c          |  2 +-
 drivers/i2c/muxes/i2c-mux-ltc4306.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-mlxcpld.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca9541.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pca954x.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-pinctrl.c        |  2 +-
 drivers/i2c/muxes/i2c-mux-reg.c            |  2 +-
 drivers/iio/gyro/mpu3050-i2c.c             |  2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  2 +-
 drivers/media/dvb-frontends/af9013.c       |  2 +-
Quoted 8 lines
 drivers/media/dvb-frontends/lgdt3306a.c    |  2 +-
 drivers/media/dvb-frontends/m88ds3103.c    |  2 +-
 drivers/media/dvb-frontends/rtl2830.c      |  2 +-
 drivers/media/dvb-frontends/rtl2832.c      |  2 +-
 drivers/media/dvb-frontends/si2168.c       |  2 +-
 drivers/media/i2c/max9286.c                |  2 +-
 drivers/media/usb/cx231xx/cx231xx-i2c.c    |  5 +----
 drivers/of/unittest.c                      |  2 +-
Quoted 2 lines
 include/linux/i2c-mux.h                    |  3 +--
 23 files changed, 23 insertions(+), 49 deletions(-)
#6 lore raw
In reply to Heiner Kallweit
Quoted 9 lines · Heiner Kallweit

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

For the record, I will apply this patch once Andi sends me his pull request because there is a dependency in there.

Applied
#7 lore raw
In reply to Heiner Kallweit
Quoted 9 lines · Heiner Kallweit

99a741aa7a2d ("i2c: mux: gpio: remove support for class-based device instantiation") removed the last call to i2c_mux_add_adapter() with a non-null class argument. Therefore the class argument can be removed.

Note: Class-based device instantiation is a legacy mechanism which shouldn't be used in new code, so we can rule out that this argument may be needed again in the future.

Applied to for-next (meaning for 6.10), thanks!