Re: [PATCH v2 2/4] media: ov01a10: Enable runtime PM before registering async sub-device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bingbu,

On Wed, Nov 22, 2023 at 10:54:08AM +0800, bingbu.cao@xxxxxxxxx wrote:
> From: Bingbu Cao <bingbu.cao@xxxxxxxxx>
> 
> As the sensor device maybe accessible right after its async sub-device is
> registered, such as ipu-bridge will try to power up sensor by sensor's client
> device's runtime PM from the async notifier callback, if runtime PM is not
> enabled, it will fail.
> 
> So runtime PM should be ready before its async sub-device is registered
> and accessible by others.
> 
> Signed-off-by: Bingbu Cao <bingbu.cao@xxxxxxxxx>
> ---
>  drivers/media/i2c/ov01a10.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov01a10.c b/drivers/media/i2c/ov01a10.c
> index 2b9e1b3a3bf4..8e36f91913aa 100644
> --- a/drivers/media/i2c/ov01a10.c
> +++ b/drivers/media/i2c/ov01a10.c
> @@ -953,17 +953,20 @@ static int ov01a10_probe(struct i2c_client *client)
>  		goto err_media_entity_cleanup;
>  	}
>  
> +	pm_runtime_enable(dev);
> +	pm_runtime_idle(dev);

Somehow this driver is missign pm_runtime_set_active() call. Could you
add it? (Similarly, pm_runtime_set_suspended() goes to .remove().)

I think it's fine to have it in the same patch.

A Fixes: tag would be nice, too, including Cc: stable.

> +
>  	ret = v4l2_async_register_subdev_sensor(&ov01a10->sd);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to register subdev: %d\n", ret);
> -		goto err_media_entity_cleanup;
> +		goto err_pm_disable;
>  	}
>  
> -	pm_runtime_enable(dev);
> -	pm_runtime_idle(dev);
> -
>  	return 0;
>  
> +err_pm_disable:
> +	pm_runtime_disable(dev);
> +
>  err_media_entity_cleanup:
>  	media_entity_cleanup(&ov01a10->sd.entity);
>  

-- 
Regards,

Sakari Ailus




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux