* [PATCH 1/1] i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers
@ 2018-07-30 12:10 Sakari Ailus
2018-07-30 12:31 ` Tomasz Figa
0 siblings, 1 reply; 2+ messages in thread
From: Sakari Ailus @ 2018-07-30 12:10 UTC (permalink / raw)
To: linux-media
Cc: tfiga, andy.yeh, rajmohan.mani, ping-chung.chen, jim.lai,
grundler
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>
---
drivers/media/i2c/ov13858.c | 2 +-
drivers/media/i2c/ov2685.c | 2 +-
drivers/media/i2c/ov5670.c | 2 +-
drivers/media/i2c/ov5695.c | 2 +-
drivers/media/i2c/ov7740.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index a66f6201f53c7..0e7a85c4996c7 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -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;
diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c
index 385c1886a9470..98a1f2e312b58 100644
--- a/drivers/media/i2c/ov2685.c
+++ b/drivers/media/i2c/ov2685.c
@@ -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) {
diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index 7b7c74d773707..53dd30d96e691 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -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) {
diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c
index 9a80decd93d3c..5d107c53364d6 100644
--- a/drivers/media/i2c/ov5695.c
+++ b/drivers/media/i2c/ov5695.c
@@ -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) {
diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c
index 605f3e25ad82b..6e9c233cfbe35 100644
--- a/drivers/media/i2c/ov7740.c
+++ b/drivers/media/i2c/ov7740.c
@@ -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) {
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers
2018-07-30 12:10 [PATCH 1/1] i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers Sakari Ailus
@ 2018-07-30 12:31 ` Tomasz Figa
0 siblings, 0 replies; 2+ messages in thread
From: Tomasz Figa @ 2018-07-30 12:31 UTC (permalink / raw)
To: Sakari Ailus
Cc: Linux Media Mailing List, Yeh, Andy, Mani, Rajmohan,
ping-chung.chen, Lai, Jim, Grant Grundler
On Mon, Jul 30, 2018 at 9:12 PM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> 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>
> ---
> drivers/media/i2c/ov13858.c | 2 +-
> drivers/media/i2c/ov2685.c | 2 +-
> drivers/media/i2c/ov5670.c | 2 +-
> drivers/media/i2c/ov5695.c | 2 +-
> drivers/media/i2c/ov7740.c | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
Thanks!
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Best regards,
Tomasz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-30 14:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-30 12:10 [PATCH 1/1] i2c: Fix pm_runtime_get_if_in_use() usage in sensor drivers Sakari Ailus
2018-07-30 12:31 ` Tomasz Figa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox