diff options
-rw-r--r-- | drivers/media/video/tvp7002.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/media/video/tvp7002.c b/drivers/media/video/tvp7002.c index 0f0270b1ad7a..5a878bca02d4 100644 --- a/drivers/media/video/tvp7002.c +++ b/drivers/media/video/tvp7002.c | |||
@@ -859,13 +859,17 @@ static int tvp7002_g_register(struct v4l2_subdev *sd, | |||
859 | struct v4l2_dbg_register *reg) | 859 | struct v4l2_dbg_register *reg) |
860 | { | 860 | { |
861 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 861 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
862 | u8 val; | ||
863 | int ret; | ||
862 | 864 | ||
863 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | 865 | if (!v4l2_chip_match_i2c_client(client, ®->match)) |
864 | return -EINVAL; | 866 | return -EINVAL; |
865 | if (!capable(CAP_SYS_ADMIN)) | 867 | if (!capable(CAP_SYS_ADMIN)) |
866 | return -EPERM; | 868 | return -EPERM; |
867 | 869 | ||
868 | return reg->val < 0 ? -EINVAL : 0; | 870 | ret = tvp7002_read(sd, reg->reg & 0xff, &val); |
871 | reg->val = val; | ||
872 | return ret; | ||
869 | } | 873 | } |
870 | 874 | ||
871 | /* | 875 | /* |
@@ -881,21 +885,13 @@ static int tvp7002_s_register(struct v4l2_subdev *sd, | |||
881 | struct v4l2_dbg_register *reg) | 885 | struct v4l2_dbg_register *reg) |
882 | { | 886 | { |
883 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 887 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
884 | struct tvp7002 *device = to_tvp7002(sd); | ||
885 | int wres; | ||
886 | 888 | ||
887 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | 889 | if (!v4l2_chip_match_i2c_client(client, ®->match)) |
888 | return -EINVAL; | 890 | return -EINVAL; |
889 | if (!capable(CAP_SYS_ADMIN)) | 891 | if (!capable(CAP_SYS_ADMIN)) |
890 | return -EPERM; | 892 | return -EPERM; |
891 | 893 | ||
892 | wres = tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff); | 894 | return tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff); |
893 | |||
894 | /* Update the register value in device's table */ | ||
895 | if (!wres) | ||
896 | device->registers[reg->reg].value = reg->val; | ||
897 | |||
898 | return wres < 0 ? -EINVAL : 0; | ||
899 | } | 895 | } |
900 | #endif | 896 | #endif |
901 | 897 | ||