i2c: mux: Remove class argument from i2c_mux_add_adapter()
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 18 Apr 2024 20:55:39 +0000 (22:55 +0200)
committerWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 13 May 2024 14:13:19 +0000 (16:13 +0200)
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.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
23 files changed:
drivers/gpu/drm/bridge/sii902x.c
drivers/i2c/i2c-mux.c
drivers/i2c/muxes/i2c-arb-gpio-challenge.c
drivers/i2c/muxes/i2c-mux-gpio.c
drivers/i2c/muxes/i2c-mux-gpmux.c
drivers/i2c/muxes/i2c-mux-ltc4306.c
drivers/i2c/muxes/i2c-mux-mlxcpld.c
drivers/i2c/muxes/i2c-mux-pca9541.c
drivers/i2c/muxes/i2c-mux-pca954x.c
drivers/i2c/muxes/i2c-mux-pinctrl.c
drivers/i2c/muxes/i2c-mux-reg.c
drivers/iio/gyro/mpu3050-i2c.c
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
drivers/media/dvb-frontends/af9013.c
drivers/media/dvb-frontends/lgdt3306a.c
drivers/media/dvb-frontends/m88ds3103.c
drivers/media/dvb-frontends/rtl2830.c
drivers/media/dvb-frontends/rtl2832.c
drivers/media/dvb-frontends/si2168.c
drivers/media/i2c/max9286.c
drivers/media/usb/cx231xx/cx231xx-i2c.c
drivers/of/unittest.c
include/linux/i2c-mux.h

index 8f84e98249c74e9402b4ee6ca1459ee8e5f07be1..2fbeda9025bfc93008c02a0b5c23fc5a8a7cbe96 100644 (file)
@@ -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;
 
index 57ff09f18c371dd28cdbe989d144f546e24ec8a3..fda72e8be885071c556df0cfb2174e91ef660f88 100644 (file)
@@ -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.
index 24168e9f7df4c15299b72846d23c8d62bb5410cc..7aa6e795d833d6c31f6978cdbd518dadaa4a8588 100644 (file)
@@ -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);
 
index 0fbb33a3d518ce22e25adb00deaf63a6ed36dc7b..d6bbb8b683333673cb2704331d49cb08342f5451 100644 (file)
@@ -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;
        }
index 8305661e12539b6bfff279f3165eb5d216d6a55a..10d63307b14d0108ccd7947cf302094c88467fc4 100644 (file)
@@ -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;
        }
index 23766d853e7674c2f78364c981573b7a6c49b386..19a7c370946d4743f701786e4376217b357c2220 100644 (file)
@@ -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;
index 4c6ed1d58c79a311bee5634bd6d7fbc6140676d3..3f06aa3331a780ed28033137784349dd32bed432 100644 (file)
@@ -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;
        }
index ce0fb69249a8fa4a7f696ba4bbe0e7ca461717be..e28694d991fb07ab1148de950da80189fd6f133a 100644 (file)
@@ -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;
 
index c3f4ff08ac3851a620d77e69caccdb95a2cc0ccb..6f84018258c458e6be5b7eaf2bcf31ca1b03acd7 100644 (file)
@@ -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;
        }
index 6ebca7bfd8a2652ec5e7bf1abef21a35992d38ac..02aaf0781e9c8260a87d3abe1b7272991e486b98 100644 (file)
@@ -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;
        }
index 8489971babd37b55ef794ebd8ec8446d9797acca..ef765fcd33f54765242236fd3314e531e7b81fd0 100644 (file)
@@ -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;
        }
index 52b6feed26379a78bfab3af3180b4cec19c936ea..29ecfa6fd633505ae0e9aa1653d90bb5f73dcb1e 100644 (file)
@@ -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;
index 410ea39fd495a693aebd365647c3e47c38c5976a..0e03137fb3d40d4753989522cf5168ef358a1014 100644 (file)
@@ -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);
index a829c89792a4325e14c1d0012cc3c74b9983c62e..5afdbe244596b346cd8f1fb44c95dfbadab36a7a 100644 (file)
@@ -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;
 
index 2638875924153a79a8435034e363e968940645c6..91c71b24cacbc8c47c8273386fd0b9f2c10ab455 100644 (file)
@@ -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;
 
index e0272054fca511252762fd29f514dc48876e35c0..6c69bcc7a1bc4a559698d2a63cd52ce45483b598 100644 (file)
@@ -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;
 
index 35c969fd2cb5e6ceabe746388631691793e6081c..30d10fe4b33e3405192e2b3da7f0ab16c5ade4c8 100644 (file)
@@ -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;
 
index 601cf45c39358c46b334cd971078e1bab255f03a..5142820b1b3d973dcd8beebc16883a809400fa2d 100644 (file)
@@ -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;
 
index dae1f2153e8be2b7615ef9cc3f8ed79517174a72..26828fd41e6843a0ac2e51c38c8dce35ae59058d 100644 (file)
@@ -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;
 
index d685d445cf23ae197e148b47b0e55aa875026c4a..dfcb3fc033500eb19fc79a1f7e35e79193c115ab 100644 (file)
@@ -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;
        }
index c6659253c6fbc06fc6075a5d14857b66740dd08c..6da8e7943d94a38a8d38ec3944d80fedfb44f76b 100644 (file)
@@ -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)
index 6b5c36b6a75862010f443321da4aa9d8d0c1c5eb..c8ee866d76d4e96bb5b3207396976225f601ddf8 100644 (file)
@@ -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;
index 98ef73b7c8fd945b840b9225170d8661e195b707..1784ac7afb116ce64e9e9fca1ee127c2bbbd2fb9 100644 (file)
@@ -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);