aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mt9v022.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-18 09:51:55 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:40:21 -0500
commit64f5905ee74906643e22657bd20e2f11443053f0 (patch)
tree17aaf01284c3297d835f3167098be9333df9b188 /drivers/media/video/mt9v022.c
parent9414de39e8e07d90bdb6524be501fae0e013d37b (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/mt9v022.c')
-rw-r--r--drivers/media/video/mt9v022.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index 3b3a6a027b1d..be20747b8138 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -406,15 +406,17 @@ static int mt9v022_set_fmt(struct soc_camera_device *icd,
406static int mt9v022_try_fmt(struct soc_camera_device *icd, 406static int mt9v022_try_fmt(struct soc_camera_device *icd,
407 struct v4l2_format *f) 407 struct v4l2_format *f)
408{ 408{
409 if (f->fmt.pix.height < 32 + icd->y_skip_top) 409 struct v4l2_pix_format *pix = &f->fmt.pix;
410 f->fmt.pix.height = 32 + icd->y_skip_top; 410
411 if (f->fmt.pix.height > 480 + icd->y_skip_top) 411 if (pix->height < 32 + icd->y_skip_top)
412 f->fmt.pix.height = 480 + icd->y_skip_top; 412 pix->height = 32 + icd->y_skip_top;
413 if (f->fmt.pix.width < 48) 413 if (pix->height > 480 + icd->y_skip_top)
414 f->fmt.pix.width = 48; 414 pix->height = 480 + icd->y_skip_top;
415 if (f->fmt.pix.width > 752) 415 if (pix->width < 48)
416 f->fmt.pix.width = 752; 416 pix->width = 48;
417 f->fmt.pix.width &= ~0x03; /* ? */ 417 if (pix->width > 752)
418 pix->width = 752;
419 pix->width &= ~0x03; /* ? */
418 420
419 return 0; 421 return 0;
420} 422}