[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220801023253.1594906-1-ye.xingchen@zte.com.cn>
Date: Mon, 1 Aug 2022 02:32:53 +0000
From: cgel.zte@...il.com
To: linux-kernel@...r.kernel.org
Cc: netdev@...r.kernel.org, ye xingchen <ye.xingchen@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH linux-next] can: ctucanfd:using the pm_runtime_resume_and_get to simplify the code
From: ye xingchen <ye.xingchen@....com.cn>
Using pm_runtime_resume_and_get() to instade of pm_runtime_get_sync
and pm_runtime_put_noidle.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: ye xingchen <ye.xingchen@....com.cn>
---
drivers/net/can/ctucanfd/ctucanfd_base.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/ctucanfd/ctucanfd_base.c b/drivers/net/can/ctucanfd/ctucanfd_base.c
index 6b281f6eb9b4..36c3381d0927 100644
--- a/drivers/net/can/ctucanfd/ctucanfd_base.c
+++ b/drivers/net/can/ctucanfd/ctucanfd_base.c
@@ -1199,11 +1199,10 @@ static int ctucan_open(struct net_device *ndev)
struct ctucan_priv *priv = netdev_priv(ndev);
int ret;
- ret = pm_runtime_get_sync(priv->dev);
+ ret = pm_runtime_resume_and_get(priv->dev);
if (ret < 0) {
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
__func__, ret);
- pm_runtime_put_noidle(priv->dev);
return ret;
}
@@ -1281,10 +1280,9 @@ static int ctucan_get_berr_counter(const struct net_device *ndev, struct can_ber
struct ctucan_priv *priv = netdev_priv(ndev);
int ret;
- ret = pm_runtime_get_sync(priv->dev);
+ ret = pm_runtime_resume_and_get(priv->dev);
if (ret < 0) {
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", __func__, ret);
- pm_runtime_put_noidle(priv->dev);
return ret;
}
@@ -1394,11 +1392,10 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr, int irq, unsigne
if (pm_enable_call)
pm_runtime_enable(dev);
- ret = pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0) {
netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
__func__, ret);
- pm_runtime_put_noidle(priv->dev);
goto err_pmdisable;
}
--
2.25.1
Powered by blists - more mailing lists