Commit dfbd5d4d authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB: tvp7002: fix compilation breakage when advanced debug is enabled

> On Mon, 22 Feb 2010 08:21:44 -0800 Randy Dunlap wrote:
> drivers/media/video/tvp7002.c:896: error: 'struct tvp7002' has no member named 'registers'
>
> so where are these registers??

Hmm, that code is a remnant from older revisions of this driver. Unfortunately,
when I compiled this driver before creating my pull request I forgot to turn on
the CONFIG_VIDEO_ADV_DEBUG option and so I never saw it.

Also fixed the g_register function: it never returned a register
value in the original code.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Acked-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0b675536
...@@ -859,13 +859,17 @@ static int tvp7002_g_register(struct v4l2_subdev *sd, ...@@ -859,13 +859,17 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,
struct v4l2_dbg_register *reg) struct v4l2_dbg_register *reg)
{ {
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
u8 val;
int ret;
if (!v4l2_chip_match_i2c_client(client, &reg->match)) if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL; return -EINVAL;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
return reg->val < 0 ? -EINVAL : 0; ret = tvp7002_read(sd, reg->reg & 0xff, &val);
reg->val = val;
return ret;
} }
/* /*
...@@ -881,21 +885,13 @@ static int tvp7002_s_register(struct v4l2_subdev *sd, ...@@ -881,21 +885,13 @@ static int tvp7002_s_register(struct v4l2_subdev *sd,
struct v4l2_dbg_register *reg) struct v4l2_dbg_register *reg)
{ {
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
struct tvp7002 *device = to_tvp7002(sd);
int wres;
if (!v4l2_chip_match_i2c_client(client, &reg->match)) if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL; return -EINVAL;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
wres = tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff); return tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff);
/* Update the register value in device's table */
if (!wres)
device->registers[reg->reg].value = reg->val;
return wres < 0 ? -EINVAL : 0;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment