netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
	kernel@pengutronix.de, Minghao Chi <chi.minghao@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH net-next 05/17] can: flexcan: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
Date: Tue, 19 Apr 2022 17:25:42 +0200	[thread overview]
Message-ID: <20220419152554.2925353-6-mkl@pengutronix.de> (raw)
In-Reply-To: <20220419152554.2925353-1-mkl@pengutronix.de>

From: Minghao Chi <chi.minghao@zte.com.cn>

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Link: https://lore.kernel.org/all/20220419081449.2574026-1-chi.minghao@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/flexcan/flexcan-core.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index 389bd9da7e9a..fe9bda0f5ec4 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -723,11 +723,9 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
 	const struct flexcan_priv *priv = netdev_priv(dev);
 	int err;
 
-	err = pm_runtime_get_sync(priv->dev);
-	if (err < 0) {
-		pm_runtime_put_noidle(priv->dev);
+	err = pm_runtime_resume_and_get(priv->dev);
+	if (err < 0)
 		return err;
-	}
 
 	err = __flexcan_get_berr_counter(dev, bec);
 
@@ -1700,11 +1698,9 @@ static int flexcan_open(struct net_device *dev)
 		return -EINVAL;
 	}
 
-	err = pm_runtime_get_sync(priv->dev);
-	if (err < 0) {
-		pm_runtime_put_noidle(priv->dev);
+	err = pm_runtime_resume_and_get(priv->dev);
+	if (err < 0)
 		return err;
-	}
 
 	err = open_candev(dev);
 	if (err)
-- 
2.35.1



  parent reply	other threads:[~2022-04-19 15:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 15:25 [PATCH net-next 0/17] pull-request: can-next 2022-04-19 Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 01/17] can: rx-offload: rename can_rx_offload_queue_sorted() -> can_rx_offload_queue_timestamp() Marc Kleine-Budde
2022-04-20 10:30   ` patchwork-bot+netdevbpf
2022-04-19 15:25 ` [PATCH net-next 02/17] can: bittiming: can_calc_bittiming(): prefer small bit rate pre-scalers over larger ones Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 03/17] can: Fix Links to Technologic Systems web resources Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 04/17] can: mscan: mpc5xxx_can: Prepare cleanup of powerpc's asm/prom.h Marc Kleine-Budde
2022-04-19 15:25 ` Marc Kleine-Budde [this message]
2022-04-19 15:25 ` [PATCH net-next 06/17] MAINTAINERS: rectify entry for XILINX CAN DRIVER Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 07/17] can: xilinx_can: mark bit timing constants as const Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 08/17] dt-bindings: can: renesas,rcar-canfd: document r8a77961 support Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 09/17] dt-binding: can: mcp251xfd: add binding information for mcp251863 Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 10/17] can: mcp251xfd: add support " Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 11/17] dt-bindings: vendor-prefix: add prefix for the Czech Technical University in Prague Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 12/17] dt-bindings: net: can: binding for CTU CAN FD open-source IP core Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 13/17] can: ctucanfd: add support for CTU CAN FD open-source IP core - bus independent part Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 14/17] can: ctucanfd: CTU CAN FD open-source IP core - PCI bus support Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 15/17] can: ctucanfd: CTU CAN FD open-source IP core - platform/SoC support Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 16/17] docs: ctucanfd: CTU CAN FD open-source IP core documentation Marc Kleine-Budde
2022-04-19 15:25 ` [PATCH net-next 17/17] MAINTAINERS: Add maintainers for CTU CAN FD IP core driver Marc Kleine-Budde

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=20220419152554.2925353-6-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=chi.minghao@zte.com.cn \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --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).