]> Pileus Git - ~andy/linux/blobdiff - drivers/media/i2c/ov7670.c
Merge branches 'fixes' and 'misc' into for-linus
[~andy/linux] / drivers / media / i2c / ov7670.c
index 617ad3fff4aa2c4d355747ed703b92693a4bd5cc..e8a1ce204036f45cca1d1d495f29c8c7b72942d5 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/delay.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
-#include <media/v4l2-chip-ident.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-mediabus.h>
 #include <media/ov7670.h>
@@ -1462,25 +1461,12 @@ static const struct v4l2_ctrl_ops ov7670_ctrl_ops = {
        .g_volatile_ctrl = ov7670_g_volatile_ctrl,
 };
 
-static int ov7670_g_chip_ident(struct v4l2_subdev *sd,
-               struct v4l2_dbg_chip_ident *chip)
-{
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
-
-       return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0);
-}
-
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
 {
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
        unsigned char val = 0;
        int ret;
 
-       if (!v4l2_chip_match_i2c_client(client, &reg->match))
-               return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        ret = ov7670_read(sd, reg->reg & 0xff, &val);
        reg->val = val;
        reg->size = 1;
@@ -1489,12 +1475,6 @@ static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r
 
 static int ov7670_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg)
 {
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
-
-       if (!v4l2_chip_match_i2c_client(client, &reg->match))
-               return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        ov7670_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
@@ -1503,7 +1483,6 @@ static int ov7670_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis
 /* ----------------------------------------------------------------------- */
 
 static const struct v4l2_subdev_core_ops ov7670_core_ops = {
-       .g_chip_ident = ov7670_g_chip_ident,
        .reset = ov7670_reset,
        .init = ov7670_init,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -1552,7 +1531,7 @@ static int ov7670_probe(struct i2c_client *client,
        struct ov7670_info *info;
        int ret;
 
-       info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL);
+       info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL);
        if (info == NULL)
                return -ENOMEM;
        sd = &info->sd;
@@ -1590,7 +1569,6 @@ static int ov7670_probe(struct i2c_client *client,
                v4l_dbg(1, debug, client,
                        "chip found @ 0x%x (%s) is not an ov7670 chip.\n",
                        client->addr << 1, client->adapter->name);
-               kfree(info);
                return ret;
        }
        v4l_info(client, "chip found @ 0x%02x (%s)\n",
@@ -1635,7 +1613,6 @@ static int ov7670_probe(struct i2c_client *client,
                int err = info->hdl.error;
 
                v4l2_ctrl_handler_free(&info->hdl);
-               kfree(info);
                return err;
        }
        /*
@@ -1659,7 +1636,6 @@ static int ov7670_remove(struct i2c_client *client)
 
        v4l2_device_unregister_subdev(sd);
        v4l2_ctrl_handler_free(&info->hdl);
-       kfree(info);
        return 0;
 }