summaryrefslogtreecommitdiff
path: root/drivers/media/video/mt9t031.c
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-05-30 21:45:46 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-23 03:21:19 -0300
commit653dc59b6468c2ba51f3b4aee609daa8f67d3e3a (patch)
tree0393e9e767257d0696e8d27b8ba7b3b9f6026905 /drivers/media/video/mt9t031.c
parent2449afcbcc654dbaa9dabeda9daecb69719b0aaa (diff)
V4L/DVB (11910): mt9: Use v4l bounding/alignment function
The v4l function has a better algorithm for aligning image size. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mt9t031.c')
-rw-r--r--drivers/media/video/mt9t031.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index f72aeb7c4deb..4207fb342670 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -385,17 +385,9 @@ static int mt9t031_try_fmt(struct soc_camera_device *icd,
{
struct v4l2_pix_format *pix = &f->fmt.pix;
- if (pix->height < MT9T031_MIN_HEIGHT)
- pix->height = MT9T031_MIN_HEIGHT;
- if (pix->height > MT9T031_MAX_HEIGHT)
- pix->height = MT9T031_MAX_HEIGHT;
- if (pix->width < MT9T031_MIN_WIDTH)
- pix->width = MT9T031_MIN_WIDTH;
- if (pix->width > MT9T031_MAX_WIDTH)
- pix->width = MT9T031_MAX_WIDTH;
-
- pix->width &= ~0x01; /* has to be even */
- pix->height &= ~0x01; /* has to be even */
+ v4l_bound_align_image(
+ &pix->width, MT9T031_MIN_WIDTH, MT9T031_MAX_WIDTH, 1,
+ &pix->height, MT9T031_MIN_HEIGHT, MT9T031_MAX_HEIGHT, 1, 0);
return 0;
}