can: mcp251xfd: mcp251xfd_open(): make use of pm_runtime_resume_and_get()
authorMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 25 Apr 2021 19:39:19 +0000 (21:39 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sat, 8 Jan 2022 19:17:41 +0000 (20:17 +0100)
With patch

dd8088d5a896 PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter

the usual pm_runtime_get_sync() and pm_runtime_put_noidle()
in-case-of-error dance is no longer needed. Convert the mcp251xfd
driver to use this function.

Link: https://lore.kernel.org/all/20220105154300.1258636-6-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c

index 161e12c..a01a3fc 100644 (file)
@@ -2507,11 +2507,9 @@ static int mcp251xfd_open(struct net_device *ndev)
        if (err)
                return err;
 
-       err = pm_runtime_get_sync(ndev->dev.parent);
-       if (err < 0) {
-               pm_runtime_put_noidle(ndev->dev.parent);
+       err = pm_runtime_resume_and_get(ndev->dev.parent);
+       if (err)
                goto out_close_candev;
-       }
 
        err = mcp251xfd_ring_alloc(priv);
        if (err)