diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2008-12-18 09:51:55 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:40:21 -0500 |
commit | 64f5905ee74906643e22657bd20e2f11443053f0 (patch) | |
tree | 17aaf01284c3297d835f3167098be9333df9b188 /drivers/media/video/mt9m001.c | |
parent | 9414de39e8e07d90bdb6524be501fae0e013d37b (diff) |
V4L/DVB (10080): soc-camera: readability improvements, more strict operations checks
Simplify multiple drivers by replacing f->fmt.pix.* with a single pointer
dereference, merge some needlessly broken lines, verify host and camera
operations pointers on registration.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mt9m001.c')
-rw-r--r-- | drivers/media/video/mt9m001.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index b58f0f85e30f..e81b3247f79e 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
@@ -327,15 +327,17 @@ static int mt9m001_set_fmt(struct soc_camera_device *icd, | |||
327 | static int mt9m001_try_fmt(struct soc_camera_device *icd, | 327 | static int mt9m001_try_fmt(struct soc_camera_device *icd, |
328 | struct v4l2_format *f) | 328 | struct v4l2_format *f) |
329 | { | 329 | { |
330 | if (f->fmt.pix.height < 32 + icd->y_skip_top) | 330 | struct v4l2_pix_format *pix = &f->fmt.pix; |
331 | f->fmt.pix.height = 32 + icd->y_skip_top; | 331 | |
332 | if (f->fmt.pix.height > 1024 + icd->y_skip_top) | 332 | if (pix->height < 32 + icd->y_skip_top) |
333 | f->fmt.pix.height = 1024 + icd->y_skip_top; | 333 | pix->height = 32 + icd->y_skip_top; |
334 | if (f->fmt.pix.width < 48) | 334 | if (pix->height > 1024 + icd->y_skip_top) |
335 | f->fmt.pix.width = 48; | 335 | pix->height = 1024 + icd->y_skip_top; |
336 | if (f->fmt.pix.width > 1280) | 336 | if (pix->width < 48) |
337 | f->fmt.pix.width = 1280; | 337 | pix->width = 48; |
338 | f->fmt.pix.width &= ~0x01; /* has to be even, unsure why was ~3 */ | 338 | if (pix->width > 1280) |
339 | pix->width = 1280; | ||
340 | pix->width &= ~0x01; /* has to be even, unsure why was ~3 */ | ||
339 | 341 | ||
340 | return 0; | 342 | return 0; |
341 | } | 343 | } |