--- zzzz-none-000/linux-3.10.107/drivers/media/i2c/cs5345.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/i2c/cs5345.c 2021-02-04 17:41:59.000000000 +0000 @@ -24,7 +24,6 @@ #include #include #include -#include #include MODULE_DESCRIPTION("i2c device driver for cs5345 Audio ADC"); @@ -99,12 +98,6 @@ #ifdef CONFIG_VIDEO_ADV_DEBUG static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - - if (!v4l2_chip_match_i2c_client(client, ®->match)) - return -EINVAL; - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; reg->size = 1; reg->val = cs5345_read(sd, reg->reg & 0x1f); return 0; @@ -112,24 +105,11 @@ static int cs5345_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, ®->match)) - return -EINVAL; - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; cs5345_write(sd, reg->reg & 0x1f, reg->val & 0xff); return 0; } #endif -static int cs5345_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_CS5345, 0); -} - static int cs5345_log_status(struct v4l2_subdev *sd) { u8 v = cs5345_read(sd, 0x09) & 7; @@ -152,14 +132,6 @@ static const struct v4l2_subdev_core_ops cs5345_core_ops = { .log_status = cs5345_log_status, - .g_chip_ident = cs5345_g_chip_ident, - .g_ext_ctrls = v4l2_subdev_g_ext_ctrls, - .try_ext_ctrls = v4l2_subdev_try_ext_ctrls, - .s_ext_ctrls = v4l2_subdev_s_ext_ctrls, - .g_ctrl = v4l2_subdev_g_ctrl, - .s_ctrl = v4l2_subdev_s_ctrl, - .queryctrl = v4l2_subdev_queryctrl, - .querymenu = v4l2_subdev_querymenu, #ifdef CONFIG_VIDEO_ADV_DEBUG .g_register = cs5345_g_register, .s_register = cs5345_s_register, @@ -190,7 +162,7 @@ v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - state = kzalloc(sizeof(struct cs5345_state), GFP_KERNEL); + state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); if (state == NULL) return -ENOMEM; sd = &state->sd; @@ -206,7 +178,6 @@ int err = state->hdl.error; v4l2_ctrl_handler_free(&state->hdl); - kfree(state); return err; } /* set volume/mute */ @@ -227,7 +198,6 @@ v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(&state->hdl); - kfree(state); return 0; } @@ -241,7 +211,6 @@ static struct i2c_driver cs5345_driver = { .driver = { - .owner = THIS_MODULE, .name = "cs5345", }, .probe = cs5345_probe,