It was a bad idea to reset the crop and compose settings when a new
format is set. This would overwrite any crop/compose set by s_select and
cause unexpected behaviors, remove it. Also fold the reset helper in to
the only remaining caller.

Signed-off-by: Niklas Söderlund <niklas.soderlund+rene...@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 40bb3d7e73131d3b..e14f0aff8ceecc68 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -90,17 +90,6 @@ static u32 rvin_format_sizeimage(struct v4l2_pix_format *pix)
  * V4L2
  */
 
-static void rvin_reset_crop_compose(struct rvin_dev *vin)
-{
-       vin->crop.top = vin->crop.left = 0;
-       vin->crop.width = vin->source.width;
-       vin->crop.height = vin->source.height;
-
-       vin->compose.top = vin->compose.left = 0;
-       vin->compose.width = vin->format.width;
-       vin->compose.height = vin->format.height;
-}
-
 static int rvin_reset_format(struct rvin_dev *vin)
 {
        struct v4l2_subdev_format fmt = {
@@ -147,7 +136,13 @@ static int rvin_reset_format(struct rvin_dev *vin)
                break;
        }
 
-       rvin_reset_crop_compose(vin);
+       vin->crop.top = vin->crop.left = 0;
+       vin->crop.width = mf->width;
+       vin->crop.height = mf->height;
+
+       vin->compose.top = vin->compose.left = 0;
+       vin->compose.width = mf->width;
+       vin->compose.height = mf->height;
 
        vin->format.bytesperline = rvin_format_bytesperline(&vin->format);
        vin->format.sizeimage = rvin_format_sizeimage(&vin->format);
@@ -323,8 +318,6 @@ static int rvin_s_fmt_vid_cap(struct file *file, void *priv,
 
        vin->format = f->fmt.pix;
 
-       rvin_reset_crop_compose(vin);
-
        return 0;
 }
 
-- 
2.12.2

Reply via email to