aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-08-14 11:03:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:50 -0400
commit112116410aaab5310a9a279c71fb76605236e448 (patch)
tree8184853dc7113f507cc0be3f698d4a9e466c85a1
parent77110abbfbfd7673be6d18ef0875350eabee7532 (diff)
V4L/DVB (8685): mt9m001, mt9v022: Simplify return code checking
i2c_smbus_write_word_data() returns 0 or a negative error, hence no need to check for "> 0". Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/mt9m001.c24
-rw-r--r--drivers/media/video/mt9v022.c28
2 files changed, 26 insertions, 26 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 554d2295484e..3531f9352dff 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -119,16 +119,16 @@ static int mt9m001_init(struct soc_camera_device *icd)
119{ 119{
120 int ret; 120 int ret;
121 121
122 /* Disable chip, synchronous option update */
123 dev_dbg(icd->vdev->parent, "%s\n", __func__); 122 dev_dbg(icd->vdev->parent, "%s\n", __func__);
124 123
125 ret = reg_write(icd, MT9M001_RESET, 1); 124 ret = reg_write(icd, MT9M001_RESET, 1);
126 if (ret >= 0) 125 if (!ret)
127 ret = reg_write(icd, MT9M001_RESET, 0); 126 ret = reg_write(icd, MT9M001_RESET, 0);
128 if (ret >= 0) 127 /* Disable chip, synchronous option update */
128 if (!ret)
129 ret = reg_write(icd, MT9M001_OUTPUT_CONTROL, 0); 129 ret = reg_write(icd, MT9M001_OUTPUT_CONTROL, 0);
130 130
131 return ret >= 0 ? 0 : -EIO; 131 return ret;
132} 132}
133 133
134static int mt9m001_release(struct soc_camera_device *icd) 134static int mt9m001_release(struct soc_camera_device *icd)
@@ -267,24 +267,24 @@ static int mt9m001_set_fmt_cap(struct soc_camera_device *icd,
267 267
268 /* Blanking and start values - default... */ 268 /* Blanking and start values - default... */
269 ret = reg_write(icd, MT9M001_HORIZONTAL_BLANKING, hblank); 269 ret = reg_write(icd, MT9M001_HORIZONTAL_BLANKING, hblank);
270 if (ret >= 0) 270 if (!ret)
271 ret = reg_write(icd, MT9M001_VERTICAL_BLANKING, vblank); 271 ret = reg_write(icd, MT9M001_VERTICAL_BLANKING, vblank);
272 272
273 /* The caller provides a supported format, as verified per 273 /* The caller provides a supported format, as verified per
274 * call to icd->try_fmt_cap() */ 274 * call to icd->try_fmt_cap() */
275 if (ret >= 0) 275 if (!ret)
276 ret = reg_write(icd, MT9M001_COLUMN_START, rect->left); 276 ret = reg_write(icd, MT9M001_COLUMN_START, rect->left);
277 if (ret >= 0) 277 if (!ret)
278 ret = reg_write(icd, MT9M001_ROW_START, rect->top); 278 ret = reg_write(icd, MT9M001_ROW_START, rect->top);
279 if (ret >= 0) 279 if (!ret)
280 ret = reg_write(icd, MT9M001_WINDOW_WIDTH, rect->width - 1); 280 ret = reg_write(icd, MT9M001_WINDOW_WIDTH, rect->width - 1);
281 if (ret >= 0) 281 if (!ret)
282 ret = reg_write(icd, MT9M001_WINDOW_HEIGHT, 282 ret = reg_write(icd, MT9M001_WINDOW_HEIGHT,
283 rect->height + icd->y_skip_top - 1); 283 rect->height + icd->y_skip_top - 1);
284 if (ret >= 0 && mt9m001->autoexposure) { 284 if (!ret && mt9m001->autoexposure) {
285 ret = reg_write(icd, MT9M001_SHUTTER_WIDTH, 285 ret = reg_write(icd, MT9M001_SHUTTER_WIDTH,
286 rect->height + icd->y_skip_top + vblank); 286 rect->height + icd->y_skip_top + vblank);
287 if (ret >= 0) { 287 if (!ret) {
288 const struct v4l2_queryctrl *qctrl = 288 const struct v4l2_queryctrl *qctrl =
289 soc_camera_find_qctrl(icd->ops, 289 soc_camera_find_qctrl(icd->ops,
290 V4L2_CID_EXPOSURE); 290 V4L2_CID_EXPOSURE);
@@ -295,7 +295,7 @@ static int mt9m001_set_fmt_cap(struct soc_camera_device *icd,
295 } 295 }
296 } 296 }
297 297
298 return ret < 0 ? ret : 0; 298 return ret;
299} 299}
300 300
301static int mt9m001_try_fmt_cap(struct soc_camera_device *icd, 301static int mt9m001_try_fmt_cap(struct soc_camera_device *icd,
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index 56808cd2f8a9..0f4b204667e0 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -141,22 +141,22 @@ static int mt9v022_init(struct soc_camera_device *icd)
141 * plus snapshot mode to disable scan for now */ 141 * plus snapshot mode to disable scan for now */
142 mt9v022->chip_control |= 0x10; 142 mt9v022->chip_control |= 0x10;
143 ret = reg_write(icd, MT9V022_CHIP_CONTROL, mt9v022->chip_control); 143 ret = reg_write(icd, MT9V022_CHIP_CONTROL, mt9v022->chip_control);
144 if (ret >= 0) 144 if (!ret)
145 reg_write(icd, MT9V022_READ_MODE, 0x300); 145 ret = reg_write(icd, MT9V022_READ_MODE, 0x300);
146 146
147 /* All defaults */ 147 /* All defaults */
148 if (ret >= 0) 148 if (!ret)
149 /* AEC, AGC on */ 149 /* AEC, AGC on */
150 ret = reg_set(icd, MT9V022_AEC_AGC_ENABLE, 0x3); 150 ret = reg_set(icd, MT9V022_AEC_AGC_ENABLE, 0x3);
151 if (ret >= 0) 151 if (!ret)
152 ret = reg_write(icd, MT9V022_MAX_TOTAL_SHUTTER_WIDTH, 480); 152 ret = reg_write(icd, MT9V022_MAX_TOTAL_SHUTTER_WIDTH, 480);
153 if (ret >= 0) 153 if (!ret)
154 /* default - auto */ 154 /* default - auto */
155 ret = reg_clear(icd, MT9V022_BLACK_LEVEL_CALIB_CTRL, 1); 155 ret = reg_clear(icd, MT9V022_BLACK_LEVEL_CALIB_CTRL, 1);
156 if (ret >= 0) 156 if (!ret)
157 ret = reg_write(icd, MT9V022_DIGITAL_TEST_PATTERN, 0); 157 ret = reg_write(icd, MT9V022_DIGITAL_TEST_PATTERN, 0);
158 158
159 return ret >= 0 ? 0 : -EIO; 159 return ret;
160} 160}
161 161
162static int mt9v022_release(struct soc_camera_device *icd) 162static int mt9v022_release(struct soc_camera_device *icd)
@@ -352,21 +352,21 @@ static int mt9v022_set_fmt_cap(struct soc_camera_device *icd,
352 rect->height + icd->y_skip_top + 43); 352 rect->height + icd->y_skip_top + 43);
353 } 353 }
354 /* Setup frame format: defaults apart from width and height */ 354 /* Setup frame format: defaults apart from width and height */
355 if (ret >= 0) 355 if (!ret)
356 ret = reg_write(icd, MT9V022_COLUMN_START, rect->left); 356 ret = reg_write(icd, MT9V022_COLUMN_START, rect->left);
357 if (ret >= 0) 357 if (!ret)
358 ret = reg_write(icd, MT9V022_ROW_START, rect->top); 358 ret = reg_write(icd, MT9V022_ROW_START, rect->top);
359 if (ret >= 0) 359 if (!ret)
360 /* Default 94, Phytec driver says: 360 /* Default 94, Phytec driver says:
361 * "width + horizontal blank >= 660" */ 361 * "width + horizontal blank >= 660" */
362 ret = reg_write(icd, MT9V022_HORIZONTAL_BLANKING, 362 ret = reg_write(icd, MT9V022_HORIZONTAL_BLANKING,
363 rect->width > 660 - 43 ? 43 : 363 rect->width > 660 - 43 ? 43 :
364 660 - rect->width); 364 660 - rect->width);
365 if (ret >= 0) 365 if (!ret)
366 ret = reg_write(icd, MT9V022_VERTICAL_BLANKING, 45); 366 ret = reg_write(icd, MT9V022_VERTICAL_BLANKING, 45);
367 if (ret >= 0) 367 if (!ret)
368 ret = reg_write(icd, MT9V022_WINDOW_WIDTH, rect->width); 368 ret = reg_write(icd, MT9V022_WINDOW_WIDTH, rect->width);
369 if (ret >= 0) 369 if (!ret)
370 ret = reg_write(icd, MT9V022_WINDOW_HEIGHT, 370 ret = reg_write(icd, MT9V022_WINDOW_HEIGHT,
371 rect->height + icd->y_skip_top); 371 rect->height + icd->y_skip_top);
372 372
@@ -717,7 +717,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd)
717 icd->num_formats = 1; 717 icd->num_formats = 1;
718 } 718 }
719 719
720 if (ret >= 0) 720 if (!ret)
721 ret = soc_camera_video_start(icd); 721 ret = soc_camera_video_start(icd);
722 if (ret < 0) 722 if (ret < 0)
723 goto eisis; 723 goto eisis;