Commit e378faaa authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

media: rcar-vin: Merge helpers dealing with powering the parallel subdevice

The two power helpers are now only dealing with the parallel subdevice,
merge them into a single rvin_power_parallel() helper to reduce code
duplication.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarUlrich Hecht <uli+renesas@fpond.eu>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 2a18fbec
...@@ -749,23 +749,13 @@ static const struct v4l2_ioctl_ops rvin_mc_ioctl_ops = { ...@@ -749,23 +749,13 @@ static const struct v4l2_ioctl_ops rvin_mc_ioctl_ops = {
* File Operations * File Operations
*/ */
static int rvin_power_on(struct rvin_dev *vin) static int rvin_power_parallel(struct rvin_dev *vin, bool on)
{ {
int ret;
struct v4l2_subdev *sd = vin_to_source(vin); struct v4l2_subdev *sd = vin_to_source(vin);
int power = on ? 1 : 0;
ret = v4l2_subdev_call(sd, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV)
return ret;
return 0;
}
static int rvin_power_off(struct rvin_dev *vin)
{
int ret; int ret;
struct v4l2_subdev *sd = vin_to_source(vin);
ret = v4l2_subdev_call(sd, core, s_power, 0); ret = v4l2_subdev_call(sd, core, s_power, power);
if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV)
return ret; return ret;
...@@ -777,7 +767,7 @@ static int rvin_initialize_device(struct file *file) ...@@ -777,7 +767,7 @@ static int rvin_initialize_device(struct file *file)
struct rvin_dev *vin = video_drvdata(file); struct rvin_dev *vin = video_drvdata(file);
int ret; int ret;
ret = rvin_power_on(vin); ret = rvin_power_parallel(vin, true);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -843,7 +833,7 @@ static int rvin_release(struct file *file) ...@@ -843,7 +833,7 @@ static int rvin_release(struct file *file)
* Then de-initialize hw module. * Then de-initialize hw module.
*/ */
if (fh_singular) if (fh_singular)
rvin_power_off(vin); rvin_power_parallel(vin, false);
mutex_unlock(&vin->lock); mutex_unlock(&vin->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment