Re: [PATCH v3 01/17] media: i2c: os05b10: Use pm_runtime_get_if_active() when applying controls

From: Jai Luthra

Date: Wed Jul 22 2026 - 01:58:24 EST


Quoting Tarang Raval (2026-07-19 01:38:52)
> os05b10_set_ctrl() currently uses pm_runtime_get_if_in_use() to decide
> whether controls should be applied to hardware.
>
> Use pm_runtime_get_if_active() instead so controls are applied whenever
> the device is runtime-active, regardless of the current usage count.

What was your motivation behind this change?

This is a bit wasteful, because this driver unconditionally calls
__v4l2_ctrl_handler_setup() in enable_streams(), along with writing the
whole register table again, without checking if the device was active or
sleeping. So updating some control registers in set_ctrl() seems like doing
double work IMHO.

Thanks,
Jai

>
> Signed-off-by: Tarang Raval <tarang.raval@xxxxxxxxxxxxxxxxx>
> Reviewed-by: Mehdi Djait <mehdi.djait@xxxxxxxxxxxxxxx>
> ---
> drivers/media/i2c/os05b10.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/os05b10.c b/drivers/media/i2c/os05b10.c
> index e0453c988e4a..3e0440220c07 100644
> --- a/drivers/media/i2c/os05b10.c
> +++ b/drivers/media/i2c/os05b10.c
> @@ -531,7 +531,7 @@ static int os05b10_set_ctrl(struct v4l2_ctrl *ctrl)
> return ret;
> }
>
> - if (pm_runtime_get_if_in_use(os05b10->dev) == 0)
> + if (!pm_runtime_get_if_active(os05b10->dev))
> return 0;
>
> switch (ctrl->id) {
> --
> 2.34.1
>
>