netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Duan <fugang.duan@nxp.com>
To: David Miller <davem@davemloft.net>,
	"hslester96@gmail.com" <hslester96@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [EXT] Re: [PATCH net v2] net: fec: add a check for CONFIG_PM to avoid clock count mis-match
Date: Sat, 16 Nov 2019 06:57:17 +0000	[thread overview]
Message-ID: <VI1PR0402MB3600CE74E0EC86AC97F25026FF730@VI1PR0402MB3600.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20191115.121050.591805779332799354.davem@davemloft.net>

From: David Miller <davem@davemloft.net> Sent: Saturday, November 16, 2019 4:11 AM
> From: Chuhong Yuan <hslester96@gmail.com>
> Date: Tue, 12 Nov 2019 19:28:30 +0800
> 
> > 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.
> >
> > Fixes: c43eab3eddb4 ("net: fec: add missed clk_disable_unprepare in
> > remove")
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> 
> Your explanation in your reply to my feedback still doesn't explain the
> situation to me.
> 
> For every clock enable done during probe, there must be a matching clock
> disable during remove.
> 
> Period.
> 
> There is no CONFIG_PM guarding the clock enables during probe in this driver,
> therefore there should be no reason to require CONFIG_PM guards to the
> clock disables during the remove method,
> 
> You have to explain clearly, and in detail, why my logic and analysis of this
> situation is not correct.
> 
> And when you do so, you will need to add those important details to the
> commit message of this change and submit a v3.
> 
> Thank you.

I agree with David. Below fixes is more reasonable.
Chuhong, if there has no voice about below fixes, you can submit v3 later.

@@ -3636,6 +3636,11 @@ fec_drv_remove(struct platform_device *pdev)
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct fec_enet_private *fep = netdev_priv(ndev);
        struct device_node *np = pdev->dev.of_node;
+       int ret;
+
+       ret = pm_runtime_get_sync(&pdev->dev);
+       if (ret < 0)
+               return ret;

        cancel_work_sync(&fep->tx_timeout_work);
        fec_ptp_stop(pdev);
@@ -3643,15 +3648,17 @@ fec_drv_remove(struct platform_device *pdev)
        fec_enet_mii_remove(fep);
        if (fep->reg_phy)
                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);
        free_netdev(ndev);

+       clk_disable_unprepare(fep->clk_ahb);
+       clk_disable_unprepare(fep->clk_ipg);
+       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_disable(&pdev->dev);
+
        return 0;
 }

Regards,
Fugang Duan

  reply	other threads:[~2019-11-16  6:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 11:28 [PATCH net v2] net: fec: add a check for CONFIG_PM to avoid clock count mis-match Chuhong Yuan
2019-11-12 19:13 ` David Miller
2019-11-13  1:50   ` [EXT] " Andy Duan
2019-11-15 20:10 ` David Miller
2019-11-16  6:57   ` Andy Duan [this message]
2019-11-16 14:00     ` [EXT] " Chuhong Yuan
2019-11-18  6:47       ` Andy Duan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR0402MB3600CE74E0EC86AC97F25026FF730@VI1PR0402MB3600.eurprd04.prod.outlook.com \
    --to=fugang.duan@nxp.com \
    --cc=davem@davemloft.net \
    --cc=hslester96@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).