Takashi Iwai 804fe9
From a7b5d7c4969aba8d1f04c29048906abaa71fb6a9 Mon Sep 17 00:00:00 2001
Takashi Iwai 804fe9
From: Tony Lindgren <tony@atomide.com>
Takashi Iwai 804fe9
Date: Thu, 18 Feb 2021 13:06:57 +0200
Takashi Iwai 804fe9
Subject: [PATCH] bus: ti-sysc: Fix warning on unbind if reset is not deasserted
Takashi Iwai 804fe9
Git-commit: a7b5d7c4969aba8d1f04c29048906abaa71fb6a9
Takashi Iwai 804fe9
Patch-mainline: v5.12-rc5
Takashi Iwai 804fe9
References: git-fixes
Takashi Iwai 804fe9
Takashi Iwai 804fe9
We currently get thefollowing on driver unbind if a reset is configured
Takashi Iwai 804fe9
and asserted:
Takashi Iwai 804fe9
Takashi Iwai 804fe9
Warning: CPU: 0 PID: 993 at drivers/reset/core.c:432 reset_control_assert
Takashi Iwai 804fe9
...
Takashi Iwai 804fe9
(reset_control_assert) from [<c0fecda8>] (sysc_remove+0x190/0x1e4)
Takashi Iwai 804fe9
(sysc_remove) from [<c0a2bb58>] (platform_remove+0x24/0x3c)
Takashi Iwai 804fe9
(platform_remove) from [<c0a292fc>] (__device_release_driver+0x154/0x214)
Takashi Iwai 804fe9
(__device_release_driver) from [<c0a2a210>] (device_driver_detach+0x3c/0x8c)
Takashi Iwai 804fe9
(device_driver_detach) from [<c0a27d64>] (unbind_store+0x60/0xd4)
Takashi Iwai 804fe9
(unbind_store) from [<c0546bec>] (kernfs_fop_write_iter+0x10c/0x1cc)
Takashi Iwai 804fe9
Takashi Iwai 804fe9
Let's fix it by checking the reset status.
Takashi Iwai 804fe9
Takashi Iwai 804fe9
Signed-off-by: Tony Lindgren <tony@atomide.com>
Takashi Iwai 804fe9
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 804fe9
Takashi Iwai 804fe9
---
Takashi Iwai 804fe9
 drivers/bus/ti-sysc.c | 4 +++-
Takashi Iwai 804fe9
 1 file changed, 3 insertions(+), 1 deletion(-)
Takashi Iwai 804fe9
Takashi Iwai 804fe9
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
Takashi Iwai 804fe9
index a27d751cf219..3d74f237f005 100644
Takashi Iwai 804fe9
--- a/drivers/bus/ti-sysc.c
Takashi Iwai 804fe9
+++ b/drivers/bus/ti-sysc.c
Takashi Iwai 804fe9
@@ -3053,7 +3053,9 @@ static int sysc_remove(struct platform_device *pdev)
Takashi Iwai 804fe9
 
Takashi Iwai 804fe9
 	pm_runtime_put_sync(&pdev->dev);
Takashi Iwai 804fe9
 	pm_runtime_disable(&pdev->dev);
Takashi Iwai 804fe9
-	reset_control_assert(ddata->rsts);
Takashi Iwai 804fe9
+
Takashi Iwai 804fe9
+	if (!reset_control_status(ddata->rsts))
Takashi Iwai 804fe9
+		reset_control_assert(ddata->rsts);
Takashi Iwai 804fe9
 
Takashi Iwai 804fe9
 unprepare:
Takashi Iwai 804fe9
 	sysc_unprepare(ddata);
Takashi Iwai 804fe9
-- 
Takashi Iwai 804fe9
2.26.2
Takashi Iwai 804fe9