Commit b489c1e0 authored by Sakari Ailus's avatar Sakari Ailus Committed by Greg Kroah-Hartman

media: i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers

[ Upstream commit 4d471563 ]

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: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5a21c7a0
...@@ -1230,7 +1230,7 @@ static int ov13858_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1230,7 +1230,7 @@ static int ov13858_set_ctrl(struct v4l2_ctrl *ctrl)
* Applying V4L2 control value only happens * Applying V4L2 control value only happens
* when power is up for streaming * 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; return 0;
ret = 0; ret = 0;
......
...@@ -549,7 +549,7 @@ static int ov2685_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -549,7 +549,7 @@ static int ov2685_set_ctrl(struct v4l2_ctrl *ctrl)
break; break;
} }
if (pm_runtime_get_if_in_use(&client->dev) <= 0) if (!pm_runtime_get_if_in_use(&client->dev))
return 0; return 0;
switch (ctrl->id) { switch (ctrl->id) {
......
...@@ -2016,7 +2016,7 @@ static int ov5670_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -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 */ /* 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; return 0;
switch (ctrl->id) { switch (ctrl->id) {
......
...@@ -1110,7 +1110,7 @@ static int ov5695_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1110,7 +1110,7 @@ static int ov5695_set_ctrl(struct v4l2_ctrl *ctrl)
break; break;
} }
if (pm_runtime_get_if_in_use(&client->dev) <= 0) if (!pm_runtime_get_if_in_use(&client->dev))
return 0; return 0;
switch (ctrl->id) { switch (ctrl->id) {
......
...@@ -510,7 +510,7 @@ static int ov7740_set_ctrl(struct v4l2_ctrl *ctrl) ...@@ -510,7 +510,7 @@ static int ov7740_set_ctrl(struct v4l2_ctrl *ctrl)
int ret; int ret;
u8 val = 0; u8 val = 0;
if (pm_runtime_get_if_in_use(&client->dev) <= 0) if (!pm_runtime_get_if_in_use(&client->dev))
return 0; return 0;
switch (ctrl->id) { switch (ctrl->id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment