Skip to contentSkip to conversation

net: fec: add a check for CONFIG_PM to avoid clock count mis-match

PATCH Superseded Chuhong Yuan 3 participants 7 messages Nov 6, 2019 – Nov 12, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fec: add a check for CONFIG_PM to avoid clock count mis-match

If CONFIG_PM is enabled, runtime pm will work and call runtime_suspend automatically to disable clks.
Therefore, remove only needs to disable clks when CONFIG_PM is disabled. Add this check to avoid clock count mis-match caused by double-disable.

This patch depends on patch
("net: fec: add missed clk_disable_unprepare in remove").

---
 drivers/net/ethernet/freescale/fec_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +2 -0
index a9c386b63581..696550f4972f 100644
@@ -3645,8 +3645,10 @@ fec_drv_remove(struct platform_device *pdev)
 		regulator_disable(fep->reg_phy);
 	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
 	clk_disable_unprepare(fep->clk_ahb);
 	clk_disable_unprepare(fep->clk_ipg);
+#endif
 	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
#1 lore raw

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November 6, 2019 4:01 PM

Quoted 8 lines

If CONFIG_PM is enabled, runtime pm will work and call runtime_suspend automatically to disable clks.
Therefore, remove only needs to disable clks when CONFIG_PM is disabled. Add this check to avoid clock count mis-match caused by double-disable.

This patch depends on patch
("net: fec: add missed clk_disable_unprepare in remove").

Please add Fixes tag here.

Andy

Quoted 23 lines
---
 drivers/net/ethernet/freescale/fec_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +2 -1
index a9c386b63581..696550f4972f 100644
@@ -3645,8 +3645,10 @@ fec_drv_remove(struct platform_device *pdev)
                regulator_disable(fep->reg_phy);
        pm_runtime_put(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
        clk_disable_unprepare(fep->clk_ahb);
        clk_disable_unprepare(fep->clk_ipg);
+#endif
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
        of_node_put(fep->phy_node);
--

2.23.0

#2 lore raw
Quoted 7 lines · Andy Duan

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November 6, 2019 4:01 PM

Quoted 5 lines

If CONFIG_PM is enabled, runtime pm will work and call runtime_suspend automatically to disable clks.
Therefore, remove only needs to disable clks when CONFIG_PM is disabled. Add this check to avoid clock count mis-match caused by double-disable.

Quoted 5 lines
Quoted 3 lines

This patch depends on patch
("net: fec: add missed clk_disable_unprepare in remove").

Please add Fixes tag here.

The previous patch has not been merged to linux, so I do not know which commit ID
should be used.

Quoted 25 lines

Andy

Quoted 23 lines
---
 drivers/net/ethernet/freescale/fec_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +2 -1
index a9c386b63581..696550f4972f 100644
@@ -3645,8 +3645,10 @@ fec_drv_remove(struct platform_device *pdev)
                regulator_disable(fep->reg_phy);
        pm_runtime_put(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
        clk_disable_unprepare(fep->clk_ahb);
        clk_disable_unprepare(fep->clk_ipg);
+#endif
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
        of_node_put(fep->phy_node);
--

2.23.0

#3 lore raw

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November 6, 2019 4:29 PM

Quoted 11 lines · Andy Duan
Quoted 2 lines

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November

6,

Quoted 4 lines

2019 4:01 PM

Quoted 3 lines

If CONFIG_PM is enabled, runtime pm will work and call runtime_suspend automatically to disable clks. Therefore, remove only needs to disable clks when CONFIG_PM is

disabled.

Quoted 2 lines
Quoted 2 lines

Add this check to avoid clock count mis-match caused by double-disable.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

This patch depends on patch
("net: fec: add missed clk_disable_unprepare in remove").

Please add Fixes tag here.

The previous patch has not been merged to linux, so I do not know which commit ID should be used.

It should be merged into net-next tree.

Andy

Quoted 27 lines
Quoted 7 lines

Andy

Quoted 5 lines
---
 drivers/net/ethernet/freescale/fec_main.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 6 lines

drivers/net/ethernet/freescale/fec_main.c fec_drv_remove(struct platform_device

Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +0 -0
index a9c386b63581..696550f4972f 100644
@@ -3645,8 +3645,10 @@ fec_drv_remove(struct platform_device

*pdev)

Quoted 13 lines
Quoted 12 lines
drivers/net/ethernet/freescale/fec_main.c +2 -1
                regulator_disable(fep->reg_phy);
        pm_runtime_put(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
        clk_disable_unprepare(fep->clk_ahb);
        clk_disable_unprepare(fep->clk_ipg);
+#endif
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
        of_node_put(fep->phy_node);
--

2.23.0

#4 lore raw
Quoted 16 lines · Andy Duan

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November 6, 2019 4:29 PM

Quoted 14 lines · Andy Duan
Quoted 2 lines

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November

6,

Quoted 4 lines

2019 4:01 PM

Quoted 3 lines

If CONFIG_PM is enabled, runtime pm will work and call runtime_suspend automatically to disable clks. Therefore, remove only needs to disable clks when CONFIG_PM is

disabled.

Quoted 5 lines
Quoted 5 lines

Add this check to avoid clock count mis-match caused by double-disable.

This patch depends on patch
("net: fec: add missed clk_disable_unprepare in remove").

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Please add Fixes tag here.

The previous patch has not been merged to linux, so I do not know which commit ID should be used.

It should be merged into net-next tree.

I have searched in net-next but did not find it.

Quoted 28 lines

Andy

Quoted 27 lines
Quoted 7 lines

Andy

Quoted 5 lines
---
 drivers/net/ethernet/freescale/fec_main.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 6 lines

drivers/net/ethernet/freescale/fec_main.c fec_drv_remove(struct platform_device

Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +0 -0
index a9c386b63581..696550f4972f 100644
@@ -3645,8 +3645,10 @@ fec_drv_remove(struct platform_device

*pdev)

Quoted 13 lines
Quoted 12 lines
drivers/net/ethernet/freescale/fec_main.c +2 -1
                regulator_disable(fep->reg_phy);
        pm_runtime_put(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
        clk_disable_unprepare(fep->clk_ahb);
        clk_disable_unprepare(fep->clk_ipg);
+#endif
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
        of_node_put(fep->phy_node);
--

2.23.0

#5 lore raw

From: Chuhong Yuan <[email protected]> Sent: Thursday, November 7, 2019 9:19 AM

Quoted 25 lines · Andy Duan
Quoted 2 lines

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November

6,

Quoted 2 lines

2019 4:29 PM

Quoted 1 line

On Wed, Nov 6, 2019 at 4:13 PM Andy Duan <[email protected]>

Quoted 10 lines · wrote:
Quoted 10 lines
Quoted 3 lines

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November

6,

Quoted 4 lines

2019 4:01 PM

Quoted 3 lines

If CONFIG_PM is enabled, runtime pm will work and call runtime_suspend automatically to disable clks. Therefore, remove only needs to disable clks when CONFIG_PM is

disabled.

Quoted 1 line
Quoted 1 line

Add this check to avoid clock count mis-match caused by

double-disable.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

This patch depends on patch
("net: fec: add missed clk_disable_unprepare in remove").

Please add Fixes tag here.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

The previous patch has not been merged to linux, so I do not know which commit ID should be used.

It should be merged into net-next tree.

I have searched in net-next but did not find it.

David, please give the comment. Thanks.

Regards,
Andy

Quoted 29 lines
Quoted 29 lines

Andy

Quoted 27 lines
Quoted 7 lines

Andy

Quoted 5 lines
---
 drivers/net/ethernet/freescale/fec_main.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 6 lines

drivers/net/ethernet/freescale/fec_main.c fec_drv_remove(struct platform_device

Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +0 -0
index a9c386b63581..696550f4972f 100644
@@ -3645,8 +3645,10 @@ fec_drv_remove(struct platform_device

*pdev)

Quoted 13 lines
Quoted 12 lines
drivers/net/ethernet/freescale/fec_main.c +2 -1
                regulator_disable(fep->reg_phy);
        pm_runtime_put(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
        clk_disable_unprepare(fep->clk_ahb);
        clk_disable_unprepare(fep->clk_ipg);
+#endif
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
        of_node_put(fep->phy_node);
--

2.23.0

#6 lore raw
Quoted 33 lines · Andy Duan

From: Chuhong Yuan <[email protected]> Sent: Thursday, November 7, 2019 9:19 AM

Quoted 32 lines · Andy Duan
Quoted 2 lines

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November

6,

Quoted 2 lines

2019 4:29 PM

Quoted 1 line

On Wed, Nov 6, 2019 at 4:13 PM Andy Duan <[email protected]>

Quoted 10 lines · wrote:
Quoted 10 lines
Quoted 3 lines

From: Chuhong Yuan <[email protected]> Sent: Wednesday, November

6,

Quoted 4 lines

2019 4:01 PM

Quoted 3 lines

If CONFIG_PM is enabled, runtime pm will work and call runtime_suspend automatically to disable clks. Therefore, remove only needs to disable clks when CONFIG_PM is

disabled.

Quoted 1 line
Quoted 1 line

Add this check to avoid clock count mis-match caused by

double-disable.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

This patch depends on patch
("net: fec: add missed clk_disable_unprepare in remove").

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Please add Fixes tag here.

The previous patch has not been merged to linux, so I do not know which commit ID should be used.

It should be merged into net-next tree.

I have searched in net-next but did not find it.

Commit ids are stable, so if there is an id in Linus's tree it will be same in net-next (when the patch appears there).

So you want:

Fixes c43eab3eddb4 ("net: fec: add missed clk_disable_unprepare in remove")

Also, it is unclear from the patch subject if this patch is targeted at 'net' or 'net-next'. But as c43eab3eddb4 is in Linus's tree I think it should be for 'net'. So the correct patch subject would be:

[PATCH net] net: fec: add a check for CONFIG_PM to avoid clock

Quoted 20 lines

David, please give the comment. Thanks.

Regards,
Andy

Quoted 16 lines
Quoted 16 lines

Andy

Quoted 14 lines
Quoted 7 lines

Andy

Quoted 5 lines
---
 drivers/net/ethernet/freescale/fec_main.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 6 lines

drivers/net/ethernet/freescale/fec_main.c fec_drv_remove(struct platform_device

Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +0 -0
index a9c386b63581..696550f4972f 100644
@@ -3645,8 +3645,10 @@ fec_drv_remove(struct platform_device

*pdev)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/net/ethernet/freescale/fec_main.c fec_drv_remove(struct platform_device *pdev) · line 3651

Quoted 7 lines
drivers/net/ethernet/freescale/fec_main.c +2 -0
                regulator_disable(fep->reg_phy);
        pm_runtime_put(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
        clk_disable_unprepare(fep->clk_ahb);
        clk_disable_unprepare(fep->clk_ipg);
+#endif

FWIIW, I am surprised this is the cleanest way to resolve this problem, though I confess that I have no specific alternative in mind.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/net/ethernet/freescale/fec_main.c +0 -1
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
        of_node_put(fep->phy_node);
--

2.23.0