[PATCH v2 0/4] i2c: muxes: pca954x: bug fixes and cleanups

From: Pradhan, Sanman

Date: Thu Sep 03 2026 - 19:47:41 EST


From: Sanman Pradhan <psanman@xxxxxxxxxxx>

This series addresses two bug fixes and two cleanups in the pca954x
I2C mux driver.

Patches 1-2 fix resource lifecycle issues in the cleanup path:

- Patch 1 reorders pca954x_cleanup() so that child adapters are removed
before the regulator is disabled, keeping the device powered while a
child driver's removal path may still issue transfers through the mux.

- Patch 2 frees the parent IRQ during cleanup, after the child adapters
are removed and before the IRQ domain is torn down. The threaded
handler dispatches nested child IRQs over the mux, so it must be freed
before the domain is removed; freeing it after the children are gone
avoids leaving the shared line asserted with no handler.

Patches 3-4 are straightforward cleanups:

- Patch 3 replaces sprintf() with sysfs_emit() in idle_state_show().
- Patch 4 marks pca954x_irq_chip as const.

v1: https://lore.kernel.org/linux-i2c/20260415165846.43926-1-sanman.pradhan@xxxxxxx/

Changes since v1:
- Patch 1: expand the commit log with a concrete example of a child
driver issuing an I2C transfer during teardown (lm75 restoring its
configuration from a devm cleanup action), instead of the vaguer "may
still need the mux to be powered".
- Patch 2: move the parent-IRQ free to after i2c_mux_del_adapters()
rather than before it. As the IRQ is requested with IRQF_SHARED,
removing the child adapters first lets the child drivers quiesce their
own interrupt sources so the shared line is not left asserted without
a handler. The devm_request_threaded_irq() / irq_requested bookkeeping
is retained.
- Patch 4: drop the IRQCHIP_IMMUTABLE flag and only constify the
irq_chip. pca954x is not a gpiochip and drives its own domain via
irq_set_chip_and_handler(); IRQCHIP_IMMUTABLE is only consulted by
gpiolib, so it had no effect here. Retitled accordingly.

Sanman Pradhan (4):
i2c: muxes: pca954x: fix cleanup ordering in pca954x_cleanup()
i2c: muxes: pca954x: free parent IRQ before dismantling IRQ domain
i2c: muxes: pca954x: use sysfs_emit() in idle_state_show()
i2c: muxes: pca954x: constify pca954x_irq_chip

drivers/i2c/muxes/i2c-mux-pca954x.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)


base-commit: 8cd9520d35a6c38db6567e97dd93b1f11f185dc6
--
2.34.1