hwrng: omap - Use pm_runtime_resume_and_get() to replace open coding
authorTian Tao <tiantao6@hisilicon.com>
Mon, 24 May 2021 12:20:57 +0000 (20:20 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 3 Jun 2021 12:24:04 +0000 (20:24 +0800)
use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. this change is just to simplify the code, no
actual functional changes.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/omap-rng.c

index cede9f15910293752281e34df0dbc35b186bfe05..00ff96703dd259bd5707a87150d6b129e0457fd3 100644 (file)
@@ -454,10 +454,9 @@ static int omap_rng_probe(struct platform_device *pdev)
        }
 
        pm_runtime_enable(&pdev->dev);
-       ret = pm_runtime_get_sync(&pdev->dev);
+       ret = pm_runtime_resume_and_get(&pdev->dev);
        if (ret < 0) {
                dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
-               pm_runtime_put_noidle(&pdev->dev);
                goto err_ioremap;
        }
 
@@ -543,10 +542,9 @@ static int __maybe_unused omap_rng_resume(struct device *dev)
        struct omap_rng_dev *priv = dev_get_drvdata(dev);
        int ret;
 
-       ret = pm_runtime_get_sync(dev);
+       ret = pm_runtime_resume_and_get(dev);
        if (ret < 0) {
                dev_err(dev, "Failed to runtime_get device: %d\n", ret);
-               pm_runtime_put_noidle(dev);
                return ret;
        }