diff options
author | Minghao Chi <chi.minghao@zte.com.cn> | 2022-04-19 10:14:49 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-04-19 17:12:12 +0200 |
commit | e6ec83790593af2d7ad4bae25831baa206780f66 (patch) | |
tree | d5705e2e4acabc562e2c8cfbba3118bc5a124a09 /drivers/net/can | |
parent | can: mscan: mpc5xxx_can: Prepare cleanup of powerpc's asm/prom.h (diff) | |
download | linux-e6ec83790593af2d7ad4bae25831baa206780f66.tar.xz linux-e6ec83790593af2d7ad4bae25831baa206780f66.zip |
can: flexcan: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
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>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/flexcan/flexcan-core.c | 12 |
1 files 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) |