Skip to contentSkip to conversation

media: exynos4-is: add missed clk_disable_unprepare in remove

PATCH Superseded Chuhong Yuan 3 participants 3 messages Nov 4, 2019 – Dec 12, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: exynos4-is: add missed clk_disable_unprepare in remove

This driver forgets to disable and unprepare clock when remove. Add a call to clk_disable_unprepare to fix it.

---
 drivers/media/platform/exynos4-is/fimc-lite.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/exynos4-is/fimc-lite.c +1 -0
index e87c6a09205b..6748bd96aada 100644
@@ -1614,6 +1614,7 @@ static int fimc_lite_remove(struct platform_device *pdev)
 	struct fimc_lite *fimc = platform_get_drvdata(pdev);
 	struct device *dev = &pdev->dev;
 
+	clk_disable_unprepare(fimc->clock);
 	pm_runtime_disable(dev);
 	pm_runtime_set_suspended(dev);
 	fimc_lite_unregister_capture_subdev(fimc);
Signature · 1 line
2.23.0
#1 lore raw
Quoted 2 lines · Chuhong Yuan

This driver forgets to disable and unprepare clock when remove. Add a call to clk_disable_unprepare to fix it.

I'd like an Ack from Samsung before I apply this. I see this in the probe() in fimc-lite.c:

       if (!pm_runtime_enabled(dev)) {
                ret = clk_prepare_enable(fimc->clock);
                if (ret < 0)
                        goto err_sd;
        }

So is it right to always call clk_disable_unprepare in the remove()?

I suspect it is correct, but I would like someone else to take a look as well.

Regards,

Hans

Quoted 19 lines
---
 drivers/media/platform/exynos4-is/fimc-lite.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/exynos4-is/fimc-lite.c +1 -0
index e87c6a09205b..6748bd96aada 100644
@@ -1614,6 +1614,7 @@ static int fimc_lite_remove(struct platform_device *pdev)
 	struct fimc_lite *fimc = platform_get_drvdata(pdev);
 	struct device *dev = &pdev->dev;
 
+	clk_disable_unprepare(fimc->clock);
 	pm_runtime_disable(dev);
 	pm_runtime_set_suspended(dev);
 	fimc_lite_unregister_capture_subdev(fimc);
#2 lore raw
Quoted 35 lines · Hans Verkuil
Quoted 2 lines · Chuhong Yuan

This driver forgets to disable and unprepare clock when remove. Add a call to clk_disable_unprepare to fix it.

I'd like an Ack from Samsung before I apply this. I see this in the probe() in fimc-lite.c:

       if (!pm_runtime_enabled(dev)) {
                ret = clk_prepare_enable(fimc->clock);
                if (ret < 0)
                        goto err_sd;
        }

So is it right to always call clk_disable_unprepare in the remove()?

I suspect it is correct, but I would like someone else to take a look as well.

Regards,

Hans

Quoted 14 lines
---
 drivers/media/platform/exynos4-is/fimc-lite.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/exynos4-is/fimc-lite.c +0 -0
index e87c6a09205b..6748bd96aada 100644
@@ -1614,6 +1614,7 @@ static int fimc_lite_remove(struct platform_device *pdev)
      struct fimc_lite *fimc = platform_get_drvdata(pdev);
      struct device *dev = &pdev->dev;
 
Quoted 4 lines

drivers/media/platform/exynos4-is/fimc-lite.c static int fimc_lite_remove(struct platform_device *pdev) · line 1620

Quoted 4 lines
drivers/media/platform/exynos4-is/fimc-lite.c +1 -0
+     clk_disable_unprepare(fimc->clock);
      pm_runtime_disable(dev);
      pm_runtime_set_suspended(dev);
      fimc_lite_unregister_capture_subdev(fimc);

No, it is wrong. The clock is enabled in probe only if !pm_runtime_enabled(). This will matter only if PM is disabled but now it leads to unbalanced disables. This was clearly not tested because I believe any test would trigger error. In such case, please mark the patches as RFT.

There is some tendency to post small "fixes" like this without testing... ok, not everyone has hardware but then just mark it as not-tested or RFT...

Best regards,
Krzysztof