[PATCH] spmi: mtk-pmif: retain controllers for removal
Avi Weiss
thnkslprpt at gmail.com
Wed Oct 28 02:48:48 PDT 2026
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 at 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
More information about the Linux-mediatek
mailing list