media: rcar-vin: Fold rvin_initialize_device() into rvin_open()
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Wed, 12 Jun 2019 23:45:46 +0000 (19:45 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 21 Jun 2019 20:44:45 +0000 (16:44 -0400)
The function no longer serve a purpose as most tasks it performed have
been refactored, fold what remains of it into the only caller. While at
it add error checking for v4l2_ctrl_handler_setup().

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/rcar-vin/rcar-v4l2.c

index 5a01b617c87dccf1b97fb682e454daa559f3f3de..a84a07f1588cc81831d554d92cd15f616be63e1a 100644 (file)
@@ -762,20 +762,6 @@ static int rvin_power_parallel(struct rvin_dev *vin, bool on)
        return 0;
 }
 
-static int rvin_initialize_device(struct file *file)
-{
-       struct rvin_dev *vin = video_drvdata(file);
-       int ret;
-
-       ret = rvin_power_parallel(vin, true);
-       if (ret < 0)
-               return ret;
-
-       v4l2_ctrl_handler_setup(&vin->ctrl_handler);
-
-       return 0;
-}
-
 static int rvin_open(struct file *file)
 {
        struct rvin_dev *vin = video_drvdata(file);
@@ -796,14 +782,20 @@ static int rvin_open(struct file *file)
                goto err_unlock;
 
        if (v4l2_fh_is_singular_file(file)) {
-               ret = rvin_initialize_device(file);
-               if (ret)
+               ret = rvin_power_parallel(vin, true);
+               if (ret < 0)
                        goto err_open;
+
+               ret = v4l2_ctrl_handler_setup(&vin->ctrl_handler);
+               if (ret)
+                       goto err_parallel;
        }
 
        mutex_unlock(&vin->lock);
 
        return 0;
+err_parallel:
+       rvin_power_parallel(vin, false);
 err_open:
        v4l2_fh_release(file);
 err_unlock: