mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spmi: mtk-pmif: retain controllers for removal
@ 2026-10-28  9:48 Avi Weiss
  2026-10-28 15:41 ` Abel Vesa
  0 siblings, 1 reply; 2+ messages in thread
From: Avi Weiss @ 2026-10-28  9:48 UTC (permalink / raw)
  To: Stephen Boyd, Abel Vesa
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-kernel,
	linux-arm-kernel, linux-mediatek

mtk_spmi_bus_probe() stores each controller in its private pmif_bus
rather than the parent arb->bus[] entry passed by the caller.
mtk_spmi_remove() checks the parent entries, so it skips registered
controllers and their IRQ and clock cleanup.

Record successfully initialized controllers in the parent array and
recover their private bus data when removing them.

Fixes: 078117963b2c ("spmi: mtk-pmif: Add multi-bus support for SPMI 2.0")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---

 drivers/spmi/spmi-mtk-pmif.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c
index 833c2b30d09f..17c0f9ae977e 100644
--- a/drivers/spmi/spmi-mtk-pmif.c
+++ b/drivers/spmi/spmi-mtk-pmif.c
@@ -708,6 +708,7 @@ static int mtk_spmi_bus_probe(struct platform_device *pdev,
 			      struct pmif_bus *pbus)
 {
 	struct spmi_controller *ctrl;
+	struct pmif_bus *bus_slot = pbus;
 	int err, idx, bus_id, i;
 
 	if (pdata->num_spmi_buses > 1)
@@ -780,6 +781,7 @@ static int mtk_spmi_bus_probe(struct platform_device *pdev,
 	if (pbus->dom)
 		irq_set_chained_handler_and_data(pbus->irq, mtk_spmi_handle_chained_irq, pbus);
 
+	bus_slot->ctrl = ctrl;
 	return 0;
 
 err_remove_irq:
@@ -849,6 +851,7 @@ static void mtk_spmi_remove(struct platform_device *pdev)
 		if (!pbus->ctrl)
 			continue;
 
+		pbus = spmi_controller_get_drvdata(pbus->ctrl);
 		mtk_spmi_irq_remove(pbus);
 		spmi_controller_remove(pbus->ctrl);
 		clk_bulk_disable_unprepare(pbus->nclks, pbus->clks);

base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-28 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28  9:48 [PATCH] spmi: mtk-pmif: retain controllers for removal Avi Weiss
2026-10-28 15:41 ` Abel Vesa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®