mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 13:06:59 +02:00
media: i2c: imx319: Rectify runtime PM handling probe and remove
Idle the device only after the async sub-device has been successfully
registered. In error handling, set the device's runtime PM status to
suspended only if it has been set to active previously in probe.
Also set the device's runtime PM status to suspended in remove only if it
wasn't so already.
Fixes: 8a89dc62f2 ("media: add imx319 camera sensor driver")
Cc: stable@vger.kernel.org # for >= v6.12
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
42eceae979
commit
5f5ffd3bc6
|
|
@ -2442,17 +2442,19 @@ static int imx319_probe(struct i2c_client *client)
|
|||
if (full_power)
|
||||
pm_runtime_set_active(&client->dev);
|
||||
pm_runtime_enable(&client->dev);
|
||||
pm_runtime_idle(&client->dev);
|
||||
|
||||
ret = v4l2_async_register_subdev_sensor(&imx319->sd);
|
||||
if (ret < 0)
|
||||
goto error_media_entity_pm;
|
||||
|
||||
pm_runtime_idle(&client->dev);
|
||||
|
||||
return 0;
|
||||
|
||||
error_media_entity_pm:
|
||||
pm_runtime_disable(&client->dev);
|
||||
pm_runtime_set_suspended(&client->dev);
|
||||
if (full_power)
|
||||
pm_runtime_set_suspended(&client->dev);
|
||||
media_entity_cleanup(&imx319->sd.entity);
|
||||
|
||||
error_handler_free:
|
||||
|
|
@ -2474,7 +2476,8 @@ static void imx319_remove(struct i2c_client *client)
|
|||
v4l2_ctrl_handler_free(sd->ctrl_handler);
|
||||
|
||||
pm_runtime_disable(&client->dev);
|
||||
pm_runtime_set_suspended(&client->dev);
|
||||
if (!pm_runtime_status_suspended(&client->dev))
|
||||
pm_runtime_set_suspended(&client->dev);
|
||||
|
||||
mutex_destroy(&imx319->mutex);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user