diff mbox series

net/cadence: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

Message ID 20220411013812.2517212-1-chi.minghao@zte.com.cn (mailing list archive)
State Accepted
Commit b66bfc131c69bd9a5ed3ae90be4cf47ec46c1526
Delegated to: Netdev Maintainers
Headers show
Series net/cadence: using pm_runtime_resume_and_get instead of pm_runtime_get_sync | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 25 this patch: 25
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 25 this patch: 25
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 50 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

CGEL April 11, 2022, 1:38 a.m. UTC
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>
---
 drivers/net/ethernet/cadence/macb_main.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

Comments

Claudiu Beznea April 11, 2022, 8:49 a.m. UTC | #1
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
>
patchwork-bot+netdevbpf@kernel.org April 12, 2022, 4 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 11 Apr 2022 01:38:12 +0000 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - net/cadence: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
    https://git.kernel.org/netdev/net-next/c/b66bfc131c69

You are awesome, thank you!
diff mbox series

Patch

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);