linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <cgel.zte@gmail.com>, <Nicolas.Ferre@microchip.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<chi.minghao@zte.com.cn>, <zealci@zte.com.cn>
Subject: Re: [PATCH] net/cadence: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
Date: Mon, 11 Apr 2022 08:49:15 +0000	[thread overview]
Message-ID: <8c0dfbb6-978b-2d57-ba7d-c891a617558a@microchip.com> (raw)
In-Reply-To: <20220411013812.2517212-1-chi.minghao@zte.com.cn>

On 11.04.2022 04:38, cgel.zte@gmail.com wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get is more appropriate
> for simplifing code
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/net/ethernet/cadence/macb_main.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 800d5ced5800..5555daee6f13 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -337,11 +337,9 @@ static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
>         struct macb *bp = bus->priv;
>         int status;
> 
> -       status = pm_runtime_get_sync(&bp->pdev->dev);
> -       if (status < 0) {
> -               pm_runtime_put_noidle(&bp->pdev->dev);
> +       status = pm_runtime_resume_and_get(&bp->pdev->dev);
> +       if (status < 0)
>                 goto mdio_pm_exit;
> -       }
> 
>         status = macb_mdio_wait_for_idle(bp);
>         if (status < 0)
> @@ -391,11 +389,9 @@ static int macb_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
>         struct macb *bp = bus->priv;
>         int status;
> 
> -       status = pm_runtime_get_sync(&bp->pdev->dev);
> -       if (status < 0) {
> -               pm_runtime_put_noidle(&bp->pdev->dev);
> +       status = pm_runtime_resume_and_get(&bp->pdev->dev);
> +       if (status < 0)
>                 goto mdio_pm_exit;
> -       }
> 
>         status = macb_mdio_wait_for_idle(bp);
>         if (status < 0)
> @@ -2745,9 +2741,9 @@ static int macb_open(struct net_device *dev)
> 
>         netdev_dbg(bp->dev, "open\n");
> 
> -       err = pm_runtime_get_sync(&bp->pdev->dev);
> +       err = pm_runtime_resume_and_get(&bp->pdev->dev);
>         if (err < 0)
> -               goto pm_exit;
> +               return err;
> 
>         /* RX buffers initialization */
>         macb_init_rx_buffer_size(bp, bufsz);
> @@ -4134,11 +4130,9 @@ static int at91ether_open(struct net_device *dev)
>         u32 ctl;
>         int ret;
> 
> -       ret = pm_runtime_get_sync(&lp->pdev->dev);
> -       if (ret < 0) {
> -               pm_runtime_put_noidle(&lp->pdev->dev);
> +       ret = pm_runtime_resume_and_get(&lp->pdev->dev);
> +       if (ret < 0)
>                 return ret;
> -       }
> 
>         /* Clear internal statistics */
>         ctl = macb_readl(lp, NCR);
> --
> 2.25.1
> 


  reply	other threads:[~2022-04-11  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  1:38 [PATCH] net/cadence: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
2022-04-11  8:49 ` Claudiu.Beznea [this message]
2022-04-12  4:00 ` patchwork-bot+netdevbpf

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=8c0dfbb6-978b-2d57-ba7d-c891a617558a@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=cgel.zte@gmail.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zealci@zte.com.cn \
    /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).