diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2008-12-18 15:51:55 +0100 |
---|---|---|
committer | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2008-12-18 15:51:55 +0100 |
commit | 07f7d043ce9816eb9222877c9bcad522a485b3f3 (patch) | |
tree | f25257b9857926995844cbb69a8aac5c9f64edfb /linux/drivers/media/video/mt9v022.c | |
parent | 57f8aa8b893b6b4eaccdb54f8836f8ff241acd37 (diff) | |
download | mediapointer-dvb-s2-07f7d043ce9816eb9222877c9bcad522a485b3f3.tar.gz mediapointer-dvb-s2-07f7d043ce9816eb9222877c9bcad522a485b3f3.tar.bz2 |
soc-camera: readability improvements, more strict operations checks
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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>
---
drivers/media/video/mt9m001.c | 20 ++++----
drivers/media/video/mt9m111.c | 10 ++--
drivers/media/video/mt9v022.c | 20 ++++----
drivers/media/video/pxa_camera.c | 21 +++-----
drivers/media/video/soc_camera.c | 74 +++++++++++++++++------------
drivers/media/video/soc_camera_platform.c | 5 +-
6 files changed, 81 insertions(+), 69 deletions(-)
Diffstat (limited to 'linux/drivers/media/video/mt9v022.c')
-rw-r--r-- | linux/drivers/media/video/mt9v022.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/linux/drivers/media/video/mt9v022.c b/linux/drivers/media/video/mt9v022.c index 419cbe61f..ff30c99e9 100644 --- a/linux/drivers/media/video/mt9v022.c +++ b/linux/drivers/media/video/mt9v022.c @@ -406,15 +406,17 @@ static int mt9v022_set_fmt(struct soc_camera_device *icd, static int mt9v022_try_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { - if (f->fmt.pix.height < 32 + icd->y_skip_top) - f->fmt.pix.height = 32 + icd->y_skip_top; - if (f->fmt.pix.height > 480 + icd->y_skip_top) - f->fmt.pix.height = 480 + icd->y_skip_top; - if (f->fmt.pix.width < 48) - f->fmt.pix.width = 48; - if (f->fmt.pix.width > 752) - f->fmt.pix.width = 752; - f->fmt.pix.width &= ~0x03; /* ? */ + struct v4l2_pix_format *pix = &f->fmt.pix; + + if (pix->height < 32 + icd->y_skip_top) + pix->height = 32 + icd->y_skip_top; + if (pix->height > 480 + icd->y_skip_top) + pix->height = 480 + icd->y_skip_top; + if (pix->width < 48) + pix->width = 48; + if (pix->width > 752) + pix->width = 752; + pix->width &= ~0x03; /* ? */ return 0; } |