diff options
author | Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> | 2011-09-12 07:25:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 16:29:06 -0400 |
commit | 2e56d933fd967a72d5ee4250e1cb6f9de29d936f (patch) | |
tree | 8a61280594ff8f68df64b65de3907a20528b545c | |
parent | 171f1a48bb3f95e3ecb37ecd6e8577118d601460 (diff) |
[media] media: ov6650: stylistic improvements
* with no "retrun ret;" at the end, there is no need to initialize ret
any longer,
* consequently use conditional expressions, not if...else constructs,
throughout ov6650_s_ctrl(),
* v4l2_ctrl_new_std_menu() max value of V4L2_EXPOSURE_MANUAL instead of
equivalent 1 looks more clear.
Created on top of "Converting soc_camera to the control framework"
series.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/ov6650.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c index 8d17c519a9f7..d5b057207a7b 100644 --- a/drivers/media/video/ov6650.c +++ b/drivers/media/video/ov6650.c | |||
@@ -310,7 +310,7 @@ static int ov6550_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | |||
310 | struct v4l2_subdev *sd = &priv->subdev; | 310 | struct v4l2_subdev *sd = &priv->subdev; |
311 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 311 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
312 | uint8_t reg, reg2; | 312 | uint8_t reg, reg2; |
313 | int ret = 0; | 313 | int ret; |
314 | 314 | ||
315 | switch (ctrl->id) { | 315 | switch (ctrl->id) { |
316 | case V4L2_CID_AUTOGAIN: | 316 | case V4L2_CID_AUTOGAIN: |
@@ -342,7 +342,7 @@ static int ov6550_s_ctrl(struct v4l2_ctrl *ctrl) | |||
342 | struct ov6650 *priv = container_of(ctrl->handler, struct ov6650, hdl); | 342 | struct ov6650 *priv = container_of(ctrl->handler, struct ov6650, hdl); |
343 | struct v4l2_subdev *sd = &priv->subdev; | 343 | struct v4l2_subdev *sd = &priv->subdev; |
344 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 344 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
345 | int ret = 0; | 345 | int ret; |
346 | 346 | ||
347 | switch (ctrl->id) { | 347 | switch (ctrl->id) { |
348 | case V4L2_CID_AUTOGAIN: | 348 | case V4L2_CID_AUTOGAIN: |
@@ -370,10 +370,8 @@ static int ov6550_s_ctrl(struct v4l2_ctrl *ctrl) | |||
370 | case V4L2_CID_BRIGHTNESS: | 370 | case V4L2_CID_BRIGHTNESS: |
371 | return ov6650_reg_write(client, REG_BRT, ctrl->val); | 371 | return ov6650_reg_write(client, REG_BRT, ctrl->val); |
372 | case V4L2_CID_EXPOSURE_AUTO: | 372 | case V4L2_CID_EXPOSURE_AUTO: |
373 | if (ctrl->val == V4L2_EXPOSURE_AUTO) | 373 | ret = ov6650_reg_rmw(client, REG_COMB, ctrl->val == |
374 | ret = ov6650_reg_rmw(client, REG_COMB, COMB_AEC, 0); | 374 | V4L2_EXPOSURE_AUTO ? COMB_AEC : 0, COMB_AEC); |
375 | else | ||
376 | ret = ov6650_reg_rmw(client, REG_COMB, 0, COMB_AEC); | ||
377 | if (!ret && ctrl->val == V4L2_EXPOSURE_MANUAL) | 375 | if (!ret && ctrl->val == V4L2_EXPOSURE_MANUAL) |
378 | ret = ov6650_reg_write(client, REG_AECH, | 376 | ret = ov6650_reg_write(client, REG_AECH, |
379 | priv->exposure->val); | 377 | priv->exposure->val); |
@@ -983,8 +981,8 @@ static int ov6650_probe(struct i2c_client *client, | |||
983 | v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops, | 981 | v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops, |
984 | V4L2_CID_BRIGHTNESS, 0, 0xff, 1, 0x80); | 982 | V4L2_CID_BRIGHTNESS, 0, 0xff, 1, 0x80); |
985 | priv->autoexposure = v4l2_ctrl_new_std_menu(&priv->hdl, | 983 | priv->autoexposure = v4l2_ctrl_new_std_menu(&priv->hdl, |
986 | &ov6550_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0, | 984 | &ov6550_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, |
987 | V4L2_EXPOSURE_AUTO); | 985 | V4L2_EXPOSURE_MANUAL, 0, V4L2_EXPOSURE_AUTO); |
988 | priv->exposure = v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops, | 986 | priv->exposure = v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops, |
989 | V4L2_CID_EXPOSURE, 0, 0xff, 1, DEF_AECH); | 987 | V4L2_CID_EXPOSURE, 0, 0xff, 1, DEF_AECH); |
990 | v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops, | 988 | v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops, |