]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 30 Jul 2018 11:44:43 +0000 (07:44 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 31 Aug 2018 13:23:53 +0000 (09:23 -0400)
pm_runtime_get_if_in_use() returns -EINVAL if runtime PM is disabled. This
should not be considered an error. Generally the driver has enabled
runtime PM already so getting this error due to runtime PM being disabled
will not happen.

Instead of checking for lesser or equal to zero, check for zero only.
Address this for drivers where this pattern exists.

This patch has been produced using the following command:

$ git grep -l pm_runtime_get_if_in_use -- drivers/media/i2c/ | \
  xargs perl -i -pe 's/(pm_runtime_get_if_in_use\(.*\)) \<\= 0/!$1/'

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/ov13858.c
drivers/media/i2c/ov2685.c
drivers/media/i2c/ov5670.c
drivers/media/i2c/ov5695.c
drivers/media/i2c/ov7740.c

index 5f601255a296217dcf7ef6b3e7a9d37ec14181e3..c8bbc1f522619504e8053f825183fa71865bb5bb 100644 (file)
@@ -1230,7 +1230,7 @@ static int ov13858_set_ctrl(struct v4l2_ctrl *ctrl)
         * Applying V4L2 control value only happens
         * when power is up for streaming
         */
-       if (pm_runtime_get_if_in_use(&client->dev) <= 0)
+       if (!pm_runtime_get_if_in_use(&client->dev))
                return 0;
 
        ret = 0;
index 385c1886a9470a1ad4153b61493501803be5ee5c..98a1f2e312b58249069de19f7b3c78dc4bf4e85d 100644 (file)
@@ -549,7 +549,7 @@ static int ov2685_set_ctrl(struct v4l2_ctrl *ctrl)
                break;
        }
 
-       if (pm_runtime_get_if_in_use(&client->dev) <= 0)
+       if (!pm_runtime_get_if_in_use(&client->dev))
                return 0;
 
        switch (ctrl->id) {
index 5ece90e9451adaf171f8d64477ba7915f6572767..041fcbb4eebdf8cd4e6c44ee95042956e6da7074 100644 (file)
@@ -2016,7 +2016,7 @@ static int ov5670_set_ctrl(struct v4l2_ctrl *ctrl)
        }
 
        /* V4L2 controls values will be applied only when power is already up */
-       if (pm_runtime_get_if_in_use(&client->dev) <= 0)
+       if (!pm_runtime_get_if_in_use(&client->dev))
                return 0;
 
        switch (ctrl->id) {
index 9a80decd93d3c0ed5e011734dc8ea5c4211085a2..5d107c53364d64249374431d7c1a236ead06e4b4 100644 (file)
@@ -1110,7 +1110,7 @@ static int ov5695_set_ctrl(struct v4l2_ctrl *ctrl)
                break;
        }
 
-       if (pm_runtime_get_if_in_use(&client->dev) <= 0)
+       if (!pm_runtime_get_if_in_use(&client->dev))
                return 0;
 
        switch (ctrl->id) {
index 605f3e25ad82b2cdd1d11978d508043a99798a53..6e9c233cfbe352589ae2b042fca4d540023ec2a9 100644 (file)
@@ -510,7 +510,7 @@ static int ov7740_set_ctrl(struct v4l2_ctrl *ctrl)
        int ret;
        u8 val = 0;
 
-       if (pm_runtime_get_if_in_use(&client->dev) <= 0)
+       if (!pm_runtime_get_if_in_use(&client->dev))
                return 0;
 
        switch (ctrl->id) {