linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
@ 2019-11-06  8:01 Chuhong Yuan
  2019-11-06  8:13 ` [EXT] " Andy Duan
  0 siblings, 1 reply; 7+ messages in thread
From: Chuhong Yuan @ 2019-11-06  8:01 UTC (permalink / raw)
  Cc: Fugang Duan, David S . Miller, netdev, linux-kernel, Chuhong Yuan

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").

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 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 a9c386b63581..696550f4972f 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [EXT] [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
  2019-11-06  8:01 [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match Chuhong Yuan
@ 2019-11-06  8:13 ` Andy Duan
  2019-11-06  8:29   ` Chuhong Yuan
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Duan @ 2019-11-06  8:13 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: David S . Miller, netdev, linux-kernel

From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November 6, 2019 4:01 PM
> 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
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  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 a9c386b63581..696550f4972f 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXT] [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
  2019-11-06  8:13 ` [EXT] " Andy Duan
@ 2019-11-06  8:29   ` Chuhong Yuan
  2019-11-06 10:17     ` Andy Duan
  0 siblings, 1 reply; 7+ messages in thread
From: Chuhong Yuan @ 2019-11-06  8:29 UTC (permalink / raw)
  To: Andy Duan; +Cc: David S . Miller, netdev, linux-kernel

On Wed, Nov 6, 2019 at 4:13 PM Andy Duan <fugang.duan@nxp.com> wrote:
>
> From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November 6, 2019 4:01 PM
> > 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.
>

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

> Andy
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > ---
> >  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 a9c386b63581..696550f4972f 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXT] [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
  2019-11-06  8:29   ` Chuhong Yuan
@ 2019-11-06 10:17     ` Andy Duan
  2019-11-07  1:19       ` Chuhong Yuan
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Duan @ 2019-11-06 10:17 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: David S . Miller, netdev, linux-kernel

From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November 6, 2019 4:29 PM
> On Wed, Nov 6, 2019 at 4:13 PM Andy Duan <fugang.duan@nxp.com> wrote:
> >
> > From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November
> 6,
> > 2019 4:01 PM
> > > 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.
> >
> 
> 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
> 
> > Andy
> > > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > > ---
> > >  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 a9c386b63581..696550f4972f 100644
> > > --- a/drivers/net/ethernet/freescale/fec_main.c
> > > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > > @@ -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
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXT] [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
  2019-11-06 10:17     ` Andy Duan
@ 2019-11-07  1:19       ` Chuhong Yuan
  2019-11-07  1:44         ` Andy Duan
  0 siblings, 1 reply; 7+ messages in thread
From: Chuhong Yuan @ 2019-11-07  1:19 UTC (permalink / raw)
  To: Andy Duan; +Cc: David S . Miller, netdev, linux-kernel

On Wed, Nov 6, 2019 at 6:17 PM Andy Duan <fugang.duan@nxp.com> wrote:
>
> From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November 6, 2019 4:29 PM
> > On Wed, Nov 6, 2019 at 4:13 PM Andy Duan <fugang.duan@nxp.com> wrote:
> > >
> > > From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November
> > 6,
> > > 2019 4:01 PM
> > > > 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.
> > >
> >
> > 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.

> Andy
> >
> > > Andy
> > > > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > > > ---
> > > >  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 a9c386b63581..696550f4972f 100644
> > > > --- a/drivers/net/ethernet/freescale/fec_main.c
> > > > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > > > @@ -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
> > >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [EXT] [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
  2019-11-07  1:19       ` Chuhong Yuan
@ 2019-11-07  1:44         ` Andy Duan
  2019-11-12  9:15           ` Simon Horman
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Duan @ 2019-11-07  1:44 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: David S . Miller, netdev, linux-kernel

From: Chuhong Yuan <hslester96@gmail.com> Sent: Thursday, November 7, 2019 9:19 AM
> On Wed, Nov 6, 2019 at 6:17 PM Andy Duan <fugang.duan@nxp.com> wrote:
> >
> > From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November
> 6,
> > 2019 4:29 PM
> > > On Wed, Nov 6, 2019 at 4:13 PM Andy Duan <fugang.duan@nxp.com>
> wrote:
> > > >
> > > > From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday,
> > > > November
> > > 6,
> > > > 2019 4:01 PM
> > > > > 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.
> > > >
> > >
> > > 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
> 
> > Andy
> > >
> > > > Andy
> > > > > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > > > > ---
> > > > >  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 a9c386b63581..696550f4972f 100644
> > > > > --- a/drivers/net/ethernet/freescale/fec_main.c
> > > > > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > > > > @@ -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
> > > >

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [EXT] [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
  2019-11-07  1:44         ` Andy Duan
@ 2019-11-12  9:15           ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2019-11-12  9:15 UTC (permalink / raw)
  To: Andy Duan; +Cc: Chuhong Yuan, David S . Miller, netdev, linux-kernel

On Thu, Nov 07, 2019 at 01:44:11AM +0000, Andy Duan wrote:
> From: Chuhong Yuan <hslester96@gmail.com> Sent: Thursday, November 7, 2019 9:19 AM
> > On Wed, Nov 6, 2019 at 6:17 PM Andy Duan <fugang.duan@nxp.com> wrote:
> > >
> > > From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday, November
> > 6,
> > > 2019 4:29 PM
> > > > On Wed, Nov 6, 2019 at 4:13 PM Andy Duan <fugang.duan@nxp.com>
> > wrote:
> > > > >
> > > > > From: Chuhong Yuan <hslester96@gmail.com> Sent: Wednesday,
> > > > > November
> > > > 6,
> > > > > 2019 4:01 PM
> > > > > > 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.
> > > > >
> > > >
> > > > 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

> David, please give the comment. Thanks.
> 
> Regards,
> Andy
> > 
> > > Andy
> > > >
> > > > > Andy
> > > > > > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > > > > > ---
> > > > > >  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 a9c386b63581..696550f4972f 100644
> > > > > > --- a/drivers/net/ethernet/freescale/fec_main.c
> > > > > > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > > > > > @@ -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

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

> > > > > >         if (of_phy_is_fixed_link(np))
> > > > > >                 of_phy_deregister_fixed_link(np);
> > > > > >         of_node_put(fep->phy_node);
> > > > > > --
> > > > > > 2.23.0
> > > > >

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-12  9:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  8:01 [PATCH] net: fec: add a check for CONFIG_PM to avoid clock count mis-match Chuhong Yuan
2019-11-06  8:13 ` [EXT] " Andy Duan
2019-11-06  8:29   ` Chuhong Yuan
2019-11-06 10:17     ` Andy Duan
2019-11-07  1:19       ` Chuhong Yuan
2019-11-07  1:44         ` Andy Duan
2019-11-12  9:15           ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).