* 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);
-
- 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 power = on ? 1 : 0;
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)
return ret;
struct rvin_dev *vin = video_drvdata(file);
int ret;
- ret = rvin_power_on(vin);
+ ret = rvin_power_parallel(vin, true);
if (ret < 0)
return ret;
* Then de-initialize hw module.
*/
if (fh_singular)
- rvin_power_off(vin);
+ rvin_power_parallel(vin, false);
mutex_unlock(&vin->lock);