aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/mt9p031.c
diff options
context:
space:
mode:
authorRicardo Ribalda <ricardo.ribalda@gmail.com>2013-11-26 03:31:42 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-07 05:02:39 -0500
commitf90580ca0133c533763a6cb3e632a21098a382df (patch)
tree05e66bbea641292153c2a78d781d49d866a16379 /drivers/media/i2c/mt9p031.c
parentda4a733946aa360e2219ce2d33b8d25ce4aa1959 (diff)
[media] videodev2: Set vb2_rect's width and height as unsigned
As discussed on the media summit 2013, there is no reason for the width and height to be signed. Therefore this patch is an attempt to convert those fields from __s32 to __u32. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> (documentation and smiapp) Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c/mt9p031.c')
-rw-r--r--drivers/media/i2c/mt9p031.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 1c2303d18bf4..e5ddf47030fd 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -519,11 +519,13 @@ static int mt9p031_set_format(struct v4l2_subdev *subdev,
519 519
520 /* Clamp the width and height to avoid dividing by zero. */ 520 /* Clamp the width and height to avoid dividing by zero. */
521 width = clamp_t(unsigned int, ALIGN(format->format.width, 2), 521 width = clamp_t(unsigned int, ALIGN(format->format.width, 2),
522 max(__crop->width / 7, MT9P031_WINDOW_WIDTH_MIN), 522 max_t(unsigned int, __crop->width / 7,
523 MT9P031_WINDOW_WIDTH_MIN),
523 __crop->width); 524 __crop->width);
524 height = clamp_t(unsigned int, ALIGN(format->format.height, 2), 525 height = clamp_t(unsigned int, ALIGN(format->format.height, 2),
525 max(__crop->height / 8, MT9P031_WINDOW_HEIGHT_MIN), 526 max_t(unsigned int, __crop->height / 8,
526 __crop->height); 527 MT9P031_WINDOW_HEIGHT_MIN),
528 __crop->height);
527 529
528 hratio = DIV_ROUND_CLOSEST(__crop->width, width); 530 hratio = DIV_ROUND_CLOSEST(__crop->width, width);
529 vratio = DIV_ROUND_CLOSEST(__crop->height, height); 531 vratio = DIV_ROUND_CLOSEST(__crop->height, height);
@@ -565,15 +567,17 @@ static int mt9p031_set_crop(struct v4l2_subdev *subdev,
565 MT9P031_COLUMN_START_MAX); 567 MT9P031_COLUMN_START_MAX);
566 rect.top = clamp(ALIGN(crop->rect.top, 2), MT9P031_ROW_START_MIN, 568 rect.top = clamp(ALIGN(crop->rect.top, 2), MT9P031_ROW_START_MIN,
567 MT9P031_ROW_START_MAX); 569 MT9P031_ROW_START_MAX);
568 rect.width = clamp(ALIGN(crop->rect.width, 2), 570 rect.width = clamp_t(unsigned int, ALIGN(crop->rect.width, 2),
569 MT9P031_WINDOW_WIDTH_MIN, 571 MT9P031_WINDOW_WIDTH_MIN,
570 MT9P031_WINDOW_WIDTH_MAX); 572 MT9P031_WINDOW_WIDTH_MAX);
571 rect.height = clamp(ALIGN(crop->rect.height, 2), 573 rect.height = clamp_t(unsigned int, ALIGN(crop->rect.height, 2),
572 MT9P031_WINDOW_HEIGHT_MIN, 574 MT9P031_WINDOW_HEIGHT_MIN,
573 MT9P031_WINDOW_HEIGHT_MAX); 575 MT9P031_WINDOW_HEIGHT_MAX);
574 576
575 rect.width = min(rect.width, MT9P031_PIXEL_ARRAY_WIDTH - rect.left); 577 rect.width = min_t(unsigned int, rect.width,
576 rect.height = min(rect.height, MT9P031_PIXEL_ARRAY_HEIGHT - rect.top); 578 MT9P031_PIXEL_ARRAY_WIDTH - rect.left);
579 rect.height = min_t(unsigned int, rect.height,
580 MT9P031_PIXEL_ARRAY_HEIGHT - rect.top);
577 581
578 __crop = __mt9p031_get_pad_crop(mt9p031, fh, crop->pad, crop->which); 582 __crop = __mt9p031_get_pad_crop(mt9p031, fh, crop->pad, crop->which);
579 583