[PATCH 1/4] i2c: muxes: pca954x: fix cleanup ordering in pca954x_cleanup()

From: Pradhan, Sanman

Date: Wed Apr 15 2026 - 13:10:40 EST


From: Sanman Pradhan <psanman@xxxxxxxxxxx>

pca954x_cleanup() disables the regulator before removing child
adapters via i2c_mux_del_adapters(). Child adapter teardown may still
need the mux to be powered, so the regulator must remain enabled until
all child adapters have been removed.

Reorder the cleanup to remove adapters first, then tear down the IRQ
domain, then disable the regulator.

Fixes: 6c30ac917a46 ("i2c: muxes: pca954x: Add regulator support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Sanman Pradhan <psanman@xxxxxxxxxxx>
---
drivers/i2c/muxes/i2c-mux-pca954x.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index b9f370c9f018..f0b8879ae5fa 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -466,7 +466,7 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc)
struct pca954x *data = i2c_mux_priv(muxc);
int c, irq;

- regulator_disable(data->supply);
+ i2c_mux_del_adapters(muxc);

if (data->irq) {
for (c = 0; c < data->chip->nchans; c++) {
@@ -475,7 +475,8 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc)
}
irq_domain_remove(data->irq);
}
- i2c_mux_del_adapters(muxc);
+
+ regulator_disable(data->supply);
}

static int pca954x_init(struct i2c_client *client, struct pca954x *data)
--
2.34.1