]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
media: ov5693: don't use V4L2_CTRL_FLAG_DISABLED
authorKen Chang <kenc@nvidia.com>
Wed, 6 Apr 2016 06:36:52 +0000 (14:36 +0800)
committerWenjia Zhou <wenjiaz@nvidia.com>
Wed, 27 Jul 2016 22:25:12 +0000 (15:25 -0700)
V4L2_CTRL_FLAG_DISABLED is deprecated. Do not
add the specificed control if it's disabled.

Bug 200184502

Change-Id: Iedfd463718bacd04729d32ef662c8763a0b991ef
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Reviewed-on: http://git-master/r/1120906
(cherry picked from commit 8044fec7ccfd72f067e55c3fc8e1f5b10066f11f)
Reviewed-on: http://git-master/r/1147832

drivers/media/i2c/ov5693.c

index de3760b737488d11f1dff61c89ab9e8c732fbd3f..5b7c7faba41b3460d1b9a957015f075a93b27da3 100644 (file)
@@ -825,19 +825,9 @@ static int ov5693_eeprom_device_init(struct ov5693 *priv)
        };
        int i;
        int err;
-       struct v4l2_ctrl *ctrl;
 
-       ctrl = v4l2_ctrl_find(&priv->ctrl_handler, V4L2_CID_EEPROM_DATA);
-       if (!ctrl) {
-               dev_err(&priv->i2c_client->dev,
-                       "could not find device ctrl.\n");
+       if (!priv->pdata->has_eeprom)
                return -EINVAL;
-       }
-
-       if (priv->pdata && !priv->pdata->has_eeprom) {
-               ctrl->flags = V4L2_CTRL_FLAG_DISABLED;
-               return 0;
-       }
 
        for (i = 0; i < OV5693_EEPROM_NUM_BLOCKS; i++) {
                priv->eeprom[i].adap = i2c_get_adapter(
@@ -854,7 +844,6 @@ static int ov5693_eeprom_device_init(struct ov5693 *priv)
                if (IS_ERR(priv->eeprom[i].regmap)) {
                        err = PTR_ERR(priv->eeprom[i].regmap);
                        ov5693_eeprom_device_release(priv);
-                       ctrl->flags = V4L2_CTRL_FLAG_DISABLED;
                        return err;
                }
        }
@@ -1110,9 +1099,10 @@ static int ov5693_s_ctrl(struct v4l2_ctrl *ctrl)
        return err;
 }
 
-static int ov5693_ctrls_init(struct ov5693 *priv)
+static int ov5693_ctrls_init(struct ov5693 *priv, bool eeprom_ctrl)
 {
        struct i2c_client *client = priv->i2c_client;
+       struct camera_common_data *common_data = priv->s_data;
        struct v4l2_ctrl *ctrl;
        int numctrls;
        int err;
@@ -1124,6 +1114,14 @@ static int ov5693_ctrls_init(struct ov5693 *priv)
        v4l2_ctrl_handler_init(&priv->ctrl_handler, numctrls);
 
        for (i = 0; i < numctrls; i++) {
+               /* Skip control 'V4L2_CID_EEPROM_DATA' if eeprom inint err */
+               if (ctrl_config_list[i].id == V4L2_CID_EEPROM_DATA) {
+                       if (!eeprom_ctrl) {
+                               common_data->numctrls -= 1;
+                               continue;
+                       }
+               }
+
                ctrl = v4l2_ctrl_new_custom(&priv->ctrl_handler,
                        &ctrl_config_list[i], NULL);
                if (ctrl == NULL) {
@@ -1344,16 +1342,16 @@ static int ov5693_probe(struct i2c_client *client,
 
        v4l2_i2c_subdev_init(priv->subdev, client, &ov5693_subdev_ops);
 
-       err = ov5693_ctrls_init(priv);
-       if (err)
-               return err;
-
        /* eeprom interface */
        err = ov5693_eeprom_device_init(priv);
-       if (err)
+       if (err && priv->pdata->has_eeprom)
                dev_err(&client->dev,
                        "Failed to allocate eeprom reg map: %d\n", err);
 
+       err = ov5693_ctrls_init(priv, !err);
+       if (err)
+               return err;
+
        priv->subdev->internal_ops = &ov5693_subdev_internal_ops;
        priv->subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
                               V4L2_SUBDEV_FL_HAS_EVENTS;