net: fec: add missed clk_disable_unprepare in remove
Subsystems (3)
PATCH 1/1 net: fec: add missed clk_disable_unprepare in remove
This driver forgets to disable and unprepare clks when remove. Add calls to clk_disable_unprepare to fix it.
--- drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +2 -0
@@ -3645,6 +3645,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);
Signature · 1 line
2.23.0
From: Chuhong Yuan <[email protected]>
Date: Mon, 4 Nov 2019 23:50:00 +0800
Quoted 4 lines
This driver forgets to disable and unprepare clks when remove. Add calls to
clk_disable_unprepareto fix it.Signed-off-by Chuhong Yuan <[email protected]>
Applied.
From: David Miller <[email protected]> Sent: Tuesday, November 5, 2019 3:36 AM
Quoted 9 lines
From: Chuhong Yuan <[email protected]>
Date: Mon, 4 Nov 2019 23:50:00 +0800Quoted 4 lines
This driver forgets to disable and unprepare clks when remove. Add calls to
clk_disable_unprepareto fix it.Signed-off-by Chuhong Yuan <[email protected]>Applied.
David, the patch introduces clock count mismatch issue, please drop it.
Regards,
Andy
David Miller
maintainerFrom: Andy Duan <[email protected]>
Date: Tue, 5 Nov 2019 01:27:10 +0000
Quoted 4 lines
From: David Miller <[email protected]> Sent: Tuesday, November 5, 2019 3:36 AM
Quoted 3 lines
From: Chuhong Yuan <[email protected]>
Date: Mon, 4 Nov 2019 23:50:00 +0800
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
This driver forgets to disable and unprepare clks when remove. Add calls to
clk_disable_unprepareto fix it.Signed-off-by Chuhong Yuan <[email protected]>Applied.
David, the patch introduces clock count mismatch issue, please drop it.
Please send me a revert, I'm backlogged at the moment.
Thanks.
From: David Miller <[email protected]> Sent: Tuesday, November 5, 2019 9:32 AM
Quoted 13 lines
From: Andy Duan <[email protected]>
Date: Tue, 5 Nov 2019 01:27:10 +0000Quoted 1 line
From: David Miller <[email protected]> Sent: Tuesday, November 5,
2019 3:36 AM
Quoted 8 lines
Quoted 8 lines
From: Chuhong Yuan <[email protected]>
Date: Mon, 4 Nov 2019 23:50:00 +0800Quoted 4 lines
This driver forgets to disable and unprepare clks when remove. Add calls to
clk_disable_unprepareto fix it.Signed-off-by Chuhong Yuan <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Applied.
David, the patch introduces clock count mismatch issue, please drop it.
Please send me a revert, I'm backlogged at the moment.
Thanks.
I already give comment to Chuhong Yuan, let's wait his response. If he will send the fixes, let's wait his patch. If not, I will send the a revert these two days.
Regards,
Andy
From: Chuhong Yuan <[email protected]> Sent: Monday, November 4, 2019 11:50 PM
Quoted 4 lines
This driver forgets to disable and unprepare clks when remove. Add calls to
clk_disable_unprepareto fix it.Signed-off-by Chuhong Yuan <[email protected]>
If runtime is enabled, the patch will introduce clock count mis-match. Probe->
Enable clk_ipg, clk_ahb clocks
...
In the end, runtime auto suspend callback disable clk_ipg, clk_ahb clocks.
You should check CONFIG_PM is enabled or not in your platform, if not, it can disable these two clocks by checking CONFIG_PM.
Regards,
Andy
Quoted 20 lines
--- drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/freescale/fec_main.c +2
-1@@ -3645,6 +3645,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.23.0
Quoted 7 lines · Andy Duan
From: Chuhong Yuan <[email protected]> Sent: Monday, November 4, 2019 11:50 PM
Quoted 4 lines
This driver forgets to disable and unprepare clks when remove. Add calls to
clk_disable_unprepareto fix it.Signed-off-by Chuhong Yuan <[email protected]>
Quoted 9 lines
If runtime is enabled, the patch will introduce clock count mis-match. Probe->
Enableclk_ipg,clk_ahbclocks
...
In the end, runtime auto suspend callback disableclk_ipg,clk_ahbclocks.You should check
CONFIG_PMis enabled or not in your platform, if not, it can disable these two clocks by checkingCONFIG_PM.
Thanks for your hint!
But I am still not very clear about the mechanism.
In my opinion, it means that if CONFIG_PM is disabled, runtime_suspend will be called automatically to disable clks.
Therefore, #ifdef CONFIG_PM check should be added before disabling clks in remove.
I am not sure whether this understanding is right or not?
Regards,
Chuhong
Quoted 23 lines
Regards,
AndyQuoted 20 lines
--- drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/freescale/fec_main.c +2
-1@@ -3645,6 +3645,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.23.0
From: Chuhong Yuan <[email protected]> Sent: Tuesday, November 5, 2019 11:34 PM
Quoted 16 lines · Andy Duan
Quoted 6 lines
From: Chuhong Yuan <[email protected]> Sent: Monday, November 4, 2019 11:50 PM
Quoted 3 lines
This driver forgets to disable and unprepare clks when remove. Add calls to
clk_disable_unprepareto fix it.Quoted 7 lines
Quoted 1 line
Signed-off-by Chuhong Yuan <[email protected]>If runtime is enabled, the patch will introduce clock count mis-match. Probe->
Enableclk_ipg,clk_ahbclocks
...
In the end, runtime auto suspend callback disableclk_ipg,clk_ahbclocks.
Quoted 1 line
Quoted 8 lines
Quoted 3 lines
You should check
CONFIG_PMis enabled or not in your platform, if not, it can disable these two clocks by checkingCONFIG_PM.Thanks for your hint!
But I am still not very clear about the mechanism.
In my opinion, it means that ifCONFIG_PMis disabled,runtime_suspendwill be called automatically to disable clks.
CONFIG_PM is enabled, runtime pm works. Otherwise, it doesn't work, then it Requires .remove() to disable the clks.
Andy
Quoted 30 lines
Therefore, #ifdef
CONFIG_PMcheck should be added before disabling clks in remove.
I am not sure whether this understanding is right or not?Regards,
ChuhongQuoted 23 lines
Regards,
AndyQuoted 20 lines
--- drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/freescale/fec_main.c +2
-1@@ -3645,6 +3645,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.23.0