mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 19:47:08 +02:00
media: ccs: Move ccs_pm_get_init function up
Prepare for using ccs_pm_get_init from locations earlier than its the current place. Also add a missing newline while at it. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
02cab4a097
commit
de927934dd
|
|
@ -1712,6 +1712,43 @@ static int ccs_power_off(struct device *dev)
|
|||
* Video stream management
|
||||
*/
|
||||
|
||||
static int ccs_pm_get_init(struct ccs_sensor *sensor)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
|
||||
int rval;
|
||||
|
||||
/*
|
||||
* It can't use pm_runtime_resume_and_get() here, as the driver
|
||||
* relies at the returned value to detect if the device was already
|
||||
* active or not.
|
||||
*/
|
||||
rval = pm_runtime_get_sync(&client->dev);
|
||||
if (rval < 0)
|
||||
goto error;
|
||||
|
||||
/* Device was already active, so don't set controls */
|
||||
if (rval == 1 && !sensor->handler_setup_needed)
|
||||
return 0;
|
||||
|
||||
sensor->handler_setup_needed = false;
|
||||
|
||||
/* Restore V4L2 controls to the previously suspended device */
|
||||
rval = v4l2_ctrl_handler_setup(&sensor->pixel_array->ctrl_handler);
|
||||
if (rval)
|
||||
goto error;
|
||||
|
||||
rval = v4l2_ctrl_handler_setup(&sensor->src->ctrl_handler);
|
||||
if (rval)
|
||||
goto error;
|
||||
|
||||
/* Keep PM runtime usage_count incremented on success */
|
||||
return 0;
|
||||
|
||||
error:
|
||||
pm_runtime_put(&client->dev);
|
||||
return rval;
|
||||
}
|
||||
|
||||
static int ccs_start_streaming(struct ccs_sensor *sensor)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
|
||||
|
|
@ -1866,42 +1903,6 @@ static int ccs_stop_streaming(struct ccs_sensor *sensor)
|
|||
* V4L2 subdev video operations
|
||||
*/
|
||||
|
||||
static int ccs_pm_get_init(struct ccs_sensor *sensor)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
|
||||
int rval;
|
||||
|
||||
/*
|
||||
* It can't use pm_runtime_resume_and_get() here, as the driver
|
||||
* relies at the returned value to detect if the device was already
|
||||
* active or not.
|
||||
*/
|
||||
rval = pm_runtime_get_sync(&client->dev);
|
||||
if (rval < 0)
|
||||
goto error;
|
||||
|
||||
/* Device was already active, so don't set controls */
|
||||
if (rval == 1 && !sensor->handler_setup_needed)
|
||||
return 0;
|
||||
|
||||
sensor->handler_setup_needed = false;
|
||||
|
||||
/* Restore V4L2 controls to the previously suspended device */
|
||||
rval = v4l2_ctrl_handler_setup(&sensor->pixel_array->ctrl_handler);
|
||||
if (rval)
|
||||
goto error;
|
||||
|
||||
rval = v4l2_ctrl_handler_setup(&sensor->src->ctrl_handler);
|
||||
if (rval)
|
||||
goto error;
|
||||
|
||||
/* Keep PM runtime usage_count incremented on success */
|
||||
return 0;
|
||||
error:
|
||||
pm_runtime_put(&client->dev);
|
||||
return rval;
|
||||
}
|
||||
|
||||
static int ccs_set_stream(struct v4l2_subdev *subdev, int enable)
|
||||
{
|
||||
struct ccs_sensor *sensor = to_ccs_sensor(subdev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user