]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i2c: omap: switch to new generic helper for getting selected mux-state
authorJosua Mayer <josua@solid-run.com>
Thu, 26 Feb 2026 13:21:14 +0000 (15:21 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 9 Mar 2026 12:44:45 +0000 (13:44 +0100)
Multiplexer subsystem has added generic helper functions for getting an
already selected mux-state object.

Replace existing logic in probe with the equivalent helper function.

There is a functional difference in that the mux is now automatically
deselected on release, replacing the explicit mux_state_deselect call.

This change is only compile-tested.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Josua Mayer <josua@solid-run.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/i2c/busses/i2c-omap.c

index d9f590f0c384340dd31308bdf9ed0cb1a1a2ba8b..f02d294db42a6567dbcf65d0438e1648f987d912 100644 (file)
@@ -1453,27 +1453,16 @@ omap_i2c_probe(struct platform_device *pdev)
                                       (1000 * omap->speed / 8);
        }
 
-       if (of_property_present(node, "mux-states")) {
-               struct mux_state *mux_state;
-
-               mux_state = devm_mux_state_get(&pdev->dev, NULL);
-               if (IS_ERR(mux_state)) {
-                       r = PTR_ERR(mux_state);
-                       dev_dbg(&pdev->dev, "failed to get I2C mux: %d\n", r);
-                       goto err_put_pm;
-               }
-               omap->mux_state = mux_state;
-               r = mux_state_select(omap->mux_state);
-               if (r) {
-                       dev_err(&pdev->dev, "failed to select I2C mux: %d\n", r);
-                       goto err_put_pm;
-               }
+       omap->mux_state = devm_mux_state_get_optional_selected(&pdev->dev, NULL);
+       if (IS_ERR(omap->mux_state)) {
+               r = PTR_ERR(omap->mux_state);
+               goto err_put_pm;
        }
 
        /* reset ASAP, clearing any IRQs */
        r = omap_i2c_init(omap);
        if (r)
-               goto err_mux_state_deselect;
+               goto err_put_pm;
 
        if (omap->rev < OMAP_I2C_OMAP1_REV_2)
                r = devm_request_irq(&pdev->dev, omap->irq, omap_i2c_omap1_isr,
@@ -1515,9 +1504,6 @@ omap_i2c_probe(struct platform_device *pdev)
 
 err_unuse_clocks:
        omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0);
-err_mux_state_deselect:
-       if (omap->mux_state)
-               mux_state_deselect(omap->mux_state);
 err_put_pm:
        pm_runtime_put_sync(omap->dev);
 err_disable_pm: