blob: 9a7f68742447cb798f7bb24be5f3c6b0a7aa16e9 [file] [log] [blame]
From 45d0ade51d7e230a1cd057e34bf7c2b0327a1aaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?=
<niklas.soderlund+renesas@ragnatech.se>
Date: Sat, 14 Apr 2018 07:57:06 -0400
Subject: [PATCH 1292/1795] media: rcar-vin: update bytesperline and sizeimage
calculation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Remove over complicated logic to calculate the value for bytesperline
and sizeimage that was carried over from the soc_camera port. There is
no need to find the max value of bytesperline and sizeimage from
user-space as they are set to 0 before the max_t() operation.
Signed-off-by: Niklas Sรถderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 9f324784a6eb5f34b66da66c1d1eca340e7a045f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/media/platform/rcar-vin/rcar-v4l2.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index ce50bc29b29a..05dd5d9256b9 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -196,10 +196,6 @@ static int __rvin_try_format(struct rvin_dev *vin,
pix->pixelformat = RVIN_DEFAULT_FORMAT;
}
- /* Always recalculate */
- pix->bytesperline = 0;
- pix->sizeimage = 0;
-
/* Limit to source capabilities */
ret = __rvin_try_format_source(vin, which, pix, source);
if (ret)
@@ -234,10 +230,8 @@ static int __rvin_try_format(struct rvin_dev *vin,
v4l_bound_align_image(&pix->width, 2, vin->info->max_width, walign,
&pix->height, 4, vin->info->max_height, 2, 0);
- pix->bytesperline = max_t(u32, pix->bytesperline,
- rvin_format_bytesperline(pix));
- pix->sizeimage = max_t(u32, pix->sizeimage,
- rvin_format_sizeimage(pix));
+ pix->bytesperline = rvin_format_bytesperline(pix);
+ pix->sizeimage = rvin_format_sizeimage(pix);
if (vin->info->model == RCAR_M1 &&
pix->pixelformat == V4L2_PIX_FMT_XBGR32) {
--
2.19.0