media: ccs: Clean up runtime PM usage
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 18 Sep 2020 09:23:39 +0000 (11:23 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 3 Dec 2020 11:27:32 +0000 (12:27 +0100)
If pm_runtime_get_sync() fails, there's no need to set the device active
again. Also, in the same case to return the usage_count to zero,
pm_runtime_put_noidle() is enough.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/ccs/ccs-core.c

index 5e01f22608d7fd8c0c19d6a127e5bd5a7e70deb4..c3023570a62055712debfc4293d7fa8240438624 100644 (file)
@@ -1625,8 +1625,6 @@ static int ccs_pm_get_init(struct ccs_sensor *sensor)
 
        rval = pm_runtime_get_sync(&client->dev);
        if (rval < 0) {
-               if (rval != -EBUSY && rval != -EAGAIN)
-                       pm_runtime_set_active(&client->dev);
                pm_runtime_put_noidle(&client->dev);
 
                return rval;
@@ -2842,9 +2840,8 @@ static int __maybe_unused ccs_suspend(struct device *dev)
 
        rval = pm_runtime_get_sync(dev);
        if (rval < 0) {
-               if (rval != -EBUSY && rval != -EAGAIN)
-                       pm_runtime_set_active(&client->dev);
-               pm_runtime_put(dev);
+               pm_runtime_put_noidle(dev);
+
                return -EAGAIN;
        }