Skip to contentSkip to conversation

spmi: mtk-pmif: retain controllers for removal

PATCH In review Avi Weiss 2 participants 2 messages Oct 28

Subsystems (2)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 spmi: mtk-pmif: retain controllers for removal

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")

---

 drivers/spmi/spmi-mtk-pmif.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/spmi/spmi-mtk-pmif.c +3 -0
index 833c2b30d09f..17c0f9ae977e 100644
@@ -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

Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Avi Weiss

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")