2019-12-03 22:46:49

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.19 024/321] net: fec: add missed clk_disable_unprepare in remove

From: Chuhong Yuan <[email protected]>

[ Upstream commit c43eab3eddb4c6742ac20138659a9b701822b274 ]

This driver forgets to disable and unprepare clks when remove.
Add calls to clk_disable_unprepare to fix it.

Signed-off-by: Chuhong Yuan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
drivers/net/ethernet/freescale/fec_main.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 4cf80de4c471c..1c62a102a223c 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3606,6 +3606,8 @@ fec_drv_remove(struct platform_device *pdev)
regulator_disable(fep->reg_phy);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
+ clk_disable_unprepare(fep->clk_ahb);
+ clk_disable_unprepare(fep->clk_ipg);
if (of_phy_is_fixed_link(np))
of_phy_deregister_fixed_link(np);
of_node_put(fep->phy_node);
--
2.20.1




2019-12-04 05:58:34

by Nobuhiro Iwamatsu

[permalink] [raw]
Subject: Re: [PATCH 4.19 024/321] net: fec: add missed clk_disable_unprepare in remove

Hi,

On Tue, Dec 03, 2019 at 11:31:30PM +0100, Greg Kroah-Hartman wrote:
> From: Chuhong Yuan <[email protected]>
>
> [ Upstream commit c43eab3eddb4c6742ac20138659a9b701822b274 ]
>
> This driver forgets to disable and unprepare clks when remove.
> Add calls to clk_disable_unprepare to fix it.
>
> Signed-off-by: Chuhong Yuan <[email protected]>
> Signed-off-by: David S. Miller <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>


This commit also requires the following commit:

commit a31eda65ba210741b598044d045480494d0ed52a
Author: Chuhong Yuan <[email protected]>
Date: Wed Nov 20 09:25:13 2019 +0800

net: fec: fix clock count mis-match

pm_runtime_put_autosuspend in probe will call runtime suspend to
disable clks automatically if CONFIG_PM is defined. (If CONFIG_PM
is not defined, its implementation will be empty, then runtime
suspend will not be called.)

Therefore, we can call pm_runtime_get_sync to runtime resume it
first to enable clks, which matches the runtime suspend. (Only when
CONFIG_PM is defined, otherwise pm_runtime_get_sync will also be
empty, then runtime resume will not be called.)

Then it is fine to disable clks without causing clock count mis-match.

Fixes: c43eab3eddb4 ("net: fec: add missed clk_disable_unprepare in remove")
Signed-off-by: Chuhong Yuan <[email protected]>
Acked-by: Fugang Duan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>


And this should also apply to 5.3.

Best regards,
Nobuhiro

2019-12-04 07:15:07

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4.19 024/321] net: fec: add missed clk_disable_unprepare in remove

On Wed, Dec 04, 2019 at 02:57:38PM +0900, Nobuhiro Iwamatsu wrote:
> Hi,
>
> On Tue, Dec 03, 2019 at 11:31:30PM +0100, Greg Kroah-Hartman wrote:
> > From: Chuhong Yuan <[email protected]>
> >
> > [ Upstream commit c43eab3eddb4c6742ac20138659a9b701822b274 ]
> >
> > This driver forgets to disable and unprepare clks when remove.
> > Add calls to clk_disable_unprepare to fix it.
> >
> > Signed-off-by: Chuhong Yuan <[email protected]>
> > Signed-off-by: David S. Miller <[email protected]>
> > Signed-off-by: Sasha Levin <[email protected]>
>
>
> This commit also requires the following commit:
>
> commit a31eda65ba210741b598044d045480494d0ed52a
> Author: Chuhong Yuan <[email protected]>
> Date: Wed Nov 20 09:25:13 2019 +0800
>
> net: fec: fix clock count mis-match
>
> pm_runtime_put_autosuspend in probe will call runtime suspend to
> disable clks automatically if CONFIG_PM is defined. (If CONFIG_PM
> is not defined, its implementation will be empty, then runtime
> suspend will not be called.)
>
> Therefore, we can call pm_runtime_get_sync to runtime resume it
> first to enable clks, which matches the runtime suspend. (Only when
> CONFIG_PM is defined, otherwise pm_runtime_get_sync will also be
> empty, then runtime resume will not be called.)
>
> Then it is fine to disable clks without causing clock count mis-match.
>
> Fixes: c43eab3eddb4 ("net: fec: add missed clk_disable_unprepare in remove")
> Signed-off-by: Chuhong Yuan <[email protected]>
> Acked-by: Fugang Duan <[email protected]>
> Signed-off-by: David S. Miller <[email protected]>
>
>
> And this should also apply to 5.3.

Thanks, now queued up.

greg k-h