[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>
This commit is contained in:
parent
171f1a48bb
commit
2e56d933fd
|
@ -310,7 +310,7 @@ static int ov6550_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
|
||||||
struct v4l2_subdev *sd = &priv->subdev;
|
struct v4l2_subdev *sd = &priv->subdev;
|
||||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||||
uint8_t reg, reg2;
|
uint8_t reg, reg2;
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_AUTOGAIN:
|
case V4L2_CID_AUTOGAIN:
|
||||||
|
@ -342,7 +342,7 @@ static int ov6550_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||||
struct ov6650 *priv = container_of(ctrl->handler, struct ov6650, hdl);
|
struct ov6650 *priv = container_of(ctrl->handler, struct ov6650, hdl);
|
||||||
struct v4l2_subdev *sd = &priv->subdev;
|
struct v4l2_subdev *sd = &priv->subdev;
|
||||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||||
int ret = 0;
|
int ret;
|
||||||
|
|
||||||
switch (ctrl->id) {
|
switch (ctrl->id) {
|
||||||
case V4L2_CID_AUTOGAIN:
|
case V4L2_CID_AUTOGAIN:
|
||||||
|
@ -370,10 +370,8 @@ static int ov6550_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||||
case V4L2_CID_BRIGHTNESS:
|
case V4L2_CID_BRIGHTNESS:
|
||||||
return ov6650_reg_write(client, REG_BRT, ctrl->val);
|
return ov6650_reg_write(client, REG_BRT, ctrl->val);
|
||||||
case V4L2_CID_EXPOSURE_AUTO:
|
case V4L2_CID_EXPOSURE_AUTO:
|
||||||
if (ctrl->val == V4L2_EXPOSURE_AUTO)
|
ret = ov6650_reg_rmw(client, REG_COMB, ctrl->val ==
|
||||||
ret = ov6650_reg_rmw(client, REG_COMB, COMB_AEC, 0);
|
V4L2_EXPOSURE_AUTO ? COMB_AEC : 0, COMB_AEC);
|
||||||
else
|
|
||||||
ret = ov6650_reg_rmw(client, REG_COMB, 0, COMB_AEC);
|
|
||||||
if (!ret && ctrl->val == V4L2_EXPOSURE_MANUAL)
|
if (!ret && ctrl->val == V4L2_EXPOSURE_MANUAL)
|
||||||
ret = ov6650_reg_write(client, REG_AECH,
|
ret = ov6650_reg_write(client, REG_AECH,
|
||||||
priv->exposure->val);
|
priv->exposure->val);
|
||||||
|
@ -983,8 +981,8 @@ static int ov6650_probe(struct i2c_client *client,
|
||||||
v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops,
|
v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops,
|
||||||
V4L2_CID_BRIGHTNESS, 0, 0xff, 1, 0x80);
|
V4L2_CID_BRIGHTNESS, 0, 0xff, 1, 0x80);
|
||||||
priv->autoexposure = v4l2_ctrl_new_std_menu(&priv->hdl,
|
priv->autoexposure = v4l2_ctrl_new_std_menu(&priv->hdl,
|
||||||
&ov6550_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0,
|
&ov6550_ctrl_ops, V4L2_CID_EXPOSURE_AUTO,
|
||||||
V4L2_EXPOSURE_AUTO);
|
V4L2_EXPOSURE_MANUAL, 0, V4L2_EXPOSURE_AUTO);
|
||||||
priv->exposure = v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops,
|
priv->exposure = v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops,
|
||||||
V4L2_CID_EXPOSURE, 0, 0xff, 1, DEF_AECH);
|
V4L2_CID_EXPOSURE, 0, 0xff, 1, DEF_AECH);
|
||||||
v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops,
|
v4l2_ctrl_new_std(&priv->hdl, &ov6550_ctrl_ops,
|
||||||
|
|
Loading…
Reference in a new issue