All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: fec: add missed clk_disable_unprepare in remove
@ 2019-11-04 15:50 Chuhong Yuan
  2019-11-04 19:36 ` David Miller
  2019-11-05  1:26 ` [EXT] " Andy Duan
  0 siblings, 2 replies; 8+ messages in thread
From: Chuhong Yuan @ 2019-11-04 15:50 UTC (permalink / raw)
  Cc: Fugang Duan, David S . Miller, netdev, linux-kernel, Chuhong Yuan

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

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 22c01b224baa..a9c386b63581 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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


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

* Re: [PATCH] net: fec: add missed clk_disable_unprepare in remove
  2019-11-04 15:50 [PATCH] net: fec: add missed clk_disable_unprepare in remove Chuhong Yuan
@ 2019-11-04 19:36 ` David Miller
  2019-11-05  1:27   ` [EXT] " Andy Duan
  2019-11-05  1:26 ` [EXT] " Andy Duan
  1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2019-11-04 19:36 UTC (permalink / raw)
  To: hslester96; +Cc: fugang.duan, netdev, linux-kernel

From: Chuhong Yuan <hslester96@gmail.com>
Date: Mon,  4 Nov 2019 23:50:00 +0800

> This driver forgets to disable and unprepare clks when remove.
> Add calls to clk_disable_unprepare to fix it.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

Applied.

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

* RE: [EXT] [PATCH] net: fec: add missed clk_disable_unprepare in remove
  2019-11-04 15:50 [PATCH] net: fec: add missed clk_disable_unprepare in remove Chuhong Yuan
  2019-11-04 19:36 ` David Miller
@ 2019-11-05  1:26 ` Andy Duan
  2019-11-05 15:34   ` Chuhong Yuan
  1 sibling, 1 reply; 8+ messages in thread
From: Andy Duan @ 2019-11-05  1:26 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: David S . Miller, netdev, linux-kernel

From: Chuhong Yuan <hslester96@gmail.com> Sent: Monday, November 4, 2019 11:50 PM
> This driver forgets to disable and unprepare clks when remove.
> Add calls to clk_disable_unprepare to fix it.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

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
> ---
>  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 22c01b224baa..a9c386b63581 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -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


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

* RE: [EXT] Re: [PATCH] net: fec: add missed clk_disable_unprepare in remove
  2019-11-04 19:36 ` David Miller
@ 2019-11-05  1:27   ` Andy Duan
  2019-11-05  1:32     ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Duan @ 2019-11-05  1:27 UTC (permalink / raw)
  To: David Miller, hslester96; +Cc: netdev, linux-kernel

From: David Miller <davem@davemloft.net> Sent: Tuesday, November 5, 2019 3:36 AM
> From: Chuhong Yuan <hslester96@gmail.com>
> Date: Mon,  4 Nov 2019 23:50:00 +0800
> 
> > This driver forgets to disable and unprepare clks when remove.
> > Add calls to clk_disable_unprepare to fix it.
> >
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> 
> Applied.

David, the patch introduces clock count mismatch issue, please drop it.

Regards,
Andy

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

* Re: [EXT] Re: [PATCH] net: fec: add missed clk_disable_unprepare in remove
  2019-11-05  1:27   ` [EXT] " Andy Duan
@ 2019-11-05  1:32     ` David Miller
  2019-11-05  1:40       ` Andy Duan
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2019-11-05  1:32 UTC (permalink / raw)
  To: fugang.duan; +Cc: hslester96, netdev, linux-kernel

From: Andy Duan <fugang.duan@nxp.com>
Date: Tue, 5 Nov 2019 01:27:10 +0000

> From: David Miller <davem@davemloft.net> Sent: Tuesday, November 5, 2019 3:36 AM
>> From: Chuhong Yuan <hslester96@gmail.com>
>> Date: Mon,  4 Nov 2019 23:50:00 +0800
>> 
>> > This driver forgets to disable and unprepare clks when remove.
>> > Add calls to clk_disable_unprepare to fix it.
>> >
>> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
>> 
>> Applied.
> 
> David, the patch introduces clock count mismatch issue, please drop it.

Please send me a revert, I'm backlogged at the moment.

Thanks.

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

* RE: [EXT] Re: [PATCH] net: fec: add missed clk_disable_unprepare in remove
  2019-11-05  1:32     ` David Miller
@ 2019-11-05  1:40       ` Andy Duan
  0 siblings, 0 replies; 8+ messages in thread
From: Andy Duan @ 2019-11-05  1:40 UTC (permalink / raw)
  To: David Miller; +Cc: hslester96, netdev, linux-kernel

From: David Miller <davem@davemloft.net> Sent: Tuesday, November 5, 2019 9:32 AM
> From: Andy Duan <fugang.duan@nxp.com>
> Date: Tue, 5 Nov 2019 01:27:10 +0000
> 
> > From: David Miller <davem@davemloft.net> Sent: Tuesday, November 5,
> 2019 3:36 AM
> >> From: Chuhong Yuan <hslester96@gmail.com>
> >> Date: Mon,  4 Nov 2019 23:50:00 +0800
> >>
> >> > This driver forgets to disable and unprepare clks when remove.
> >> > Add calls to clk_disable_unprepare to fix it.
> >> >
> >> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> >>
> >> 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  

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

* Re: [EXT] [PATCH] net: fec: add missed clk_disable_unprepare in remove
  2019-11-05  1:26 ` [EXT] " Andy Duan
@ 2019-11-05 15:34   ` Chuhong Yuan
  2019-11-05 16:46     ` Andy Duan
  0 siblings, 1 reply; 8+ messages in thread
From: Chuhong Yuan @ 2019-11-05 15:34 UTC (permalink / raw)
  To: Andy Duan; +Cc: David S . Miller, netdev, linux-kernel

On Tue, Nov 5, 2019 at 9:26 AM Andy Duan <fugang.duan@nxp.com> wrote:
>
> From: Chuhong Yuan <hslester96@gmail.com> Sent: Monday, November 4, 2019 11:50 PM
> > This driver forgets to disable and unprepare clks when remove.
> > Add calls to clk_disable_unprepare to fix it.
> >
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
>
> 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.
>

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

> Regards,
> Andy
> > ---
> >  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 22c01b224baa..a9c386b63581 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -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
>

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

* RE: [EXT] [PATCH] net: fec: add missed clk_disable_unprepare in remove
  2019-11-05 15:34   ` Chuhong Yuan
@ 2019-11-05 16:46     ` Andy Duan
  0 siblings, 0 replies; 8+ messages in thread
From: Andy Duan @ 2019-11-05 16:46 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: David S . Miller, netdev, linux-kernel

From: Chuhong Yuan <hslester96@gmail.com> Sent: Tuesday, November 5, 2019 11:34 PM
> On Tue, Nov 5, 2019 at 9:26 AM Andy Duan <fugang.duan@nxp.com> wrote:
> >
> > From: Chuhong Yuan <hslester96@gmail.com> Sent: Monday, November 4,
> > 2019 11:50 PM
> > > This driver forgets to disable and unprepare clks when remove.
> > > Add calls to clk_disable_unprepare to fix it.
> > >
> > > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> >
> > 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.
> >
> 
> 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.
CONFIG_PM is enabled, runtime pm works. Otherwise, it doesn't work, then it
Requires .remove() to disable the clks.

Andy
> 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
> 
> > Regards,
> > Andy
> > > ---
> > >  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 22c01b224baa..a9c386b63581 100644
> > > --- a/drivers/net/ethernet/freescale/fec_main.c
> > > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > > @@ -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
> >

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

end of thread, other threads:[~2019-11-05 16:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 15:50 [PATCH] net: fec: add missed clk_disable_unprepare in remove Chuhong Yuan
2019-11-04 19:36 ` David Miller
2019-11-05  1:27   ` [EXT] " Andy Duan
2019-11-05  1:32     ` David Miller
2019-11-05  1:40       ` Andy Duan
2019-11-05  1:26 ` [EXT] " Andy Duan
2019-11-05 15:34   ` Chuhong Yuan
2019-11-05 16:46     ` Andy Duan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.