mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tapio Reijonen <tapio.reijonen@vaisala.com>
To: Wei Fang <wei.fang@nxp.com>
Cc: "imx@lists.linux.dev" <imx@lists.linux.dev>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Frank Li <frank.li@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH v2] net: fec: fix pinctrl default state restore order on resume
Date: Wed, 27 May 2026 13:21:58 +0300	[thread overview]
Message-ID: <38fc139e-3858-4037-b2de-700d7b092ce7@vaisala.com> (raw)
In-Reply-To: <DBBPR04MB75001DF6E52F4316085D551388082@DBBPR04MB7500.eurprd04.prod.outlook.com>

Hi,

On 5/27/26 10:47, Wei Fang wrote:
> Please wait at least 24 hours before sending a revised version. Give reviewers
> enough time to provide feedback.
> See https://elixir.bootlin.com/linux/v7.1-rc5/source/Documentation/process/maintainer-netdev.rst#L15
> 
>> @@ -5594,12 +5594,12 @@ static int fec_resume(struct device *dev)
>>                  if (fep->rpm_active)
>>                          pm_runtime_force_resume(dev);
>>
>> -               ret = fec_enet_clk_enable(ndev, true);
>> -               if (ret) {
>> -                       rtnl_unlock();
>> -                       goto failed_clk;
>> -               }
>>                  if (fep->wol_flag & FEC_WOL_FLAG_ENABLE) {
>> +                       ret = fec_enet_clk_enable(ndev, true);
>> +                       if (ret) {
>> +                               rtnl_unlock();
>> +                               goto failed_clk;
>> +                       }
>>                          fec_enet_stop_mode(fep, false);
>>                          if (fep->wake_irq) {
>>                                  disable_irq_wake(fep->wake_irq);
>> @@ -5612,6 +5612,11 @@ static int fec_resume(struct device *dev)
>>                          fep->wol_flag &= ~FEC_WOL_FLAG_SLEEP_ON;
>>                  } else {
>>
>> pinctrl_pm_select_default_state(&fep->pdev->dev);
>> +                       ret = fec_enet_clk_enable(ndev, true);
>> +                       if (ret) {
>> +                               rtnl_unlock();
>> +                               goto failed_clk;
>> +                       }
>>                  }
> 
> I think fec_enet_clk_enable() can be moved before fec_restart(), and there is
> no need to call fec_enet_clk_enable() separately in the if...else... branches.
> 
> Or move pinctrl_pm_select_default_state() before fec_enet_clk_enable(),
> as shown below:
> 
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -5644,6 +5644,7 @@ static int fec_resume(struct device *dev)
>                  if (fep->rpm_active)
>                          pm_runtime_force_resume(dev);
> 
> +               pinctrl_pm_select_default_state(&fep->pdev->dev);
>                  ret = fec_enet_clk_enable(ndev, true);
>                  if (ret) {
>                          rtnl_unlock();
> 
>>                  fec_restart(ndev);
>>                  netif_tx_lock_bh(ndev);
> 
Agreed, the second form is cleaner -- it keeps the fix to a one-line 
move of pinctrl_pm_select_default_state() and drops the branch 
duplication I had in v2.


Calling it unconditionally is safe for the WoL path as well: 
fec_suspend() only selects the sleep pinctrl state on the non-WoL path 
and leaves the pins in the default state when WoL is enabled, so on a 
WoL resume the device is already in the default state and the call is a 
no-op.


I'll send v3 with this shape.


Many thanks for the review,
Tapio Reijonen


      reply	other threads:[~2026-05-27 10:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  4:06 Tapio Reijonen
2026-05-27  7:47 ` Wei Fang
2026-05-27 10:21   ` Tapio Reijonen [this message]

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=38fc139e-3858-4037-b2de-700d7b092ce7@vaisala.com \
    --to=tapio.reijonen@vaisala.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=frank.li@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shenwei.wang@nxp.com \
    --cc=wei.fang@nxp.com \
    /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

all inboxes | Powered by JetHome®