diff mbox series

[linux-next] can: ctucanfd:using the pm_runtime_resume_and_get to simplify the code

Message ID 20220801023253.1594906-1-ye.xingchen@zte.com.cn (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [linux-next] can: ctucanfd:using the pm_runtime_resume_and_get to simplify the code | expand

Checks

Context Check Description
netdev/tree_selection success Series ignored based on subject

Commit Message

CGEL Aug. 1, 2022, 2:32 a.m. UTC
From: ye xingchen <ye.xingchen@zte.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@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/net/can/ctucanfd/ctucanfd_base.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

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