Skip to contentSkip to conversation

bus: ti-sysc: Fix warnings for unbind for serial

PATCH In review Tony Lindgren 2 participants 2 messages May 12, 2022 – May 13, 2022 OMAP2+ support

lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

PATCH 1/1 bus: ti-sysc: Fix warnings for unbind for serial

We can get "failed to disable" clock_unprepare warnings on unbind at least for the serial console device if the unbind is done before the device has been idled.

As some devices are using deferred idle, we must check the status for pending idle work to idle the device.

Cc Romain Naour <[email protected]>
Fixes 76f0f772e469 ("bus: ti-sysc: Improve handling for no-reset-on-init and no-idle-on-init")
---
 drivers/bus/ti-sysc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/ti-sysc.c +3 -1
@@ -3395,7 +3395,9 @@ static int sysc_remove(struct platform_device *pdev)
 	struct sysc *ddata = platform_get_drvdata(pdev);
 	int error;
 
-	cancel_delayed_work_sync(&ddata->idle_work);
+	/* Device can still be enabled, see deferred idle quirk in probe */
+	if (cancel_delayed_work_sync(&ddata->idle_work))
+		ti_sysc_idle(&ddata->idle_work.work);
 
 	error = pm_runtime_resume_and_get(ddata->dev);
 	if (error < 0) {
Signature · 1 line
2.36.1
Reviewed-by on v1 1/1
#1 lore raw

Hello,

Le 12/05/2022 à 07:30, Tony Lindgren a écrit :

Quoted 6 lines

We can get "failed to disable" clock_unprepare warnings on unbind at least for the serial console device if the unbind is done before the device has been idled.

As some devices are using deferred idle, we must check the status for pending idle work to idle the device.

I didn't noticed the "failed to disable" warning so far (kernel 5.10.106 from ti-linux-kernel repository) but I applied this patch as suggested [1] while investigating another issue "tty serial 8250 omap driver crash".

[1] https://marc.info/?l=linux-omap&m=164484408319083&w=2

Best regards,
Romain

Quoted 22 lines
Cc Romain Naour <[email protected]>
Fixes 76f0f772e469 ("bus: ti-sysc: Improve handling for no-reset-on-init and no-idle-on-init")
---
 drivers/bus/ti-sysc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/ti-sysc.c +3 -1
@@ -3395,7 +3395,9 @@ static int sysc_remove(struct platform_device *pdev)
 	struct sysc *ddata = platform_get_drvdata(pdev);
 	int error;
 
-	cancel_delayed_work_sync(&ddata->idle_work);
+	/* Device can still be enabled, see deferred idle quirk in probe */
+	if (cancel_delayed_work_sync(&ddata->idle_work))
+		ti_sysc_idle(&ddata->idle_work.work);
 
 	error = pm_runtime_resume_and_get(ddata->dev);
 	if (error < 0) {