aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-12-30 05:14:19 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-01-02 14:11:52 -0500
commitaecde8b53b8ee1330a5a8206200f0d6b8845a6e0 (patch)
tree53a1aef6597a9d829864c054230b312010abc3a7 /drivers
parentda1b5c95e49bb564ae8c61ed135d34ed09acbb66 (diff)
V4L/DVB (10141): v4l2: debugging API changed to match against driver name instead of ID.
Since the i2c driver ID will be removed in the near future we have to modify the v4l2 debugging API to use the driver name instead of driver ID. Note that this API is not used in applications other than v4l2-dbg.cpp as it is for debugging and testing only. Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged with a warning that it is deprecated and will be removed in 2.6.30. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c9
-rw-r--r--drivers/media/video/cafe_ccic.c7
-rw-r--r--drivers/media/video/cs5345.c13
-rw-r--r--drivers/media/video/cs53l32a.c2
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c28
-rw-r--r--drivers/media/video/cx18/cx18-i2c.h1
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c41
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c8
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c13
-rw-r--r--drivers/media/video/cx88/cx88-video.c13
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c28
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c7
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c21
-rw-r--r--drivers/media/video/m52790.c13
-rw-r--r--drivers/media/video/msp3400-driver.c2
-rw-r--r--drivers/media/video/mt9m001.c19
-rw-r--r--drivers/media/video/mt9m111.c19
-rw-r--r--drivers/media/video/mt9t031.c18
-rw-r--r--drivers/media/video/mt9v022.c19
-rw-r--r--drivers/media/video/ov7670.c2
-rw-r--r--drivers/media/video/ov772x.c7
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c11
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.h4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c6
-rw-r--r--drivers/media/video/saa7115.c13
-rw-r--r--drivers/media/video/saa7127.c13
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c14
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c9
-rw-r--r--drivers/media/video/saa717x.c9
-rw-r--r--drivers/media/video/soc_camera.c6
-rw-r--r--drivers/media/video/tvaudio.c2
-rw-r--r--drivers/media/video/tvp5150.c13
-rw-r--r--drivers/media/video/tw9910.c6
-rw-r--r--drivers/media/video/upd64031a.c13
-rw-r--r--drivers/media/video/upd64083.c13
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c9
-rw-r--r--drivers/media/video/v4l2-common.c29
-rw-r--r--drivers/media/video/v4l2-compat-ioctl32.c3
-rw-r--r--drivers/media/video/v4l2-ioctl.c15
-rw-r--r--drivers/media/video/v4l2-subdev.c2
-rw-r--r--drivers/media/video/vp27smpx.c2
-rw-r--r--drivers/media/video/wm8739.c2
-rw-r--r--drivers/media/video/wm8775.c2
44 files changed, 236 insertions, 252 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index ebcb8e5e9c4d..d2f43bd2f841 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2039,7 +2039,7 @@ static int bttv_log_status(struct file *file, void *f)
2039 2039
2040#ifdef CONFIG_VIDEO_ADV_DEBUG 2040#ifdef CONFIG_VIDEO_ADV_DEBUG
2041static int bttv_g_register(struct file *file, void *f, 2041static int bttv_g_register(struct file *file, void *f,
2042 struct v4l2_register *reg) 2042 struct v4l2_dbg_register *reg)
2043{ 2043{
2044 struct bttv_fh *fh = f; 2044 struct bttv_fh *fh = f;
2045 struct bttv *btv = fh->btv; 2045 struct bttv *btv = fh->btv;
@@ -2047,18 +2047,19 @@ static int bttv_g_register(struct file *file, void *f,
2047 if (!capable(CAP_SYS_ADMIN)) 2047 if (!capable(CAP_SYS_ADMIN))
2048 return -EPERM; 2048 return -EPERM;
2049 2049
2050 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2050 if (!v4l2_chip_match_host(&reg->match))
2051 return -EINVAL; 2051 return -EINVAL;
2052 2052
2053 /* bt848 has a 12-bit register space */ 2053 /* bt848 has a 12-bit register space */
2054 reg->reg &= 0xfff; 2054 reg->reg &= 0xfff;
2055 reg->val = btread(reg->reg); 2055 reg->val = btread(reg->reg);
2056 reg->size = 1;
2056 2057
2057 return 0; 2058 return 0;
2058} 2059}
2059 2060
2060static int bttv_s_register(struct file *file, void *f, 2061static int bttv_s_register(struct file *file, void *f,
2061 struct v4l2_register *reg) 2062 struct v4l2_dbg_register *reg)
2062{ 2063{
2063 struct bttv_fh *fh = f; 2064 struct bttv_fh *fh = f;
2064 struct bttv *btv = fh->btv; 2065 struct bttv *btv = fh->btv;
@@ -2066,7 +2067,7 @@ static int bttv_s_register(struct file *file, void *f,
2066 if (!capable(CAP_SYS_ADMIN)) 2067 if (!capable(CAP_SYS_ADMIN))
2067 return -EPERM; 2068 return -EPERM;
2068 2069
2069 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2070 if (!v4l2_chip_match_host(&reg->match))
2070 return -EINVAL; 2071 return -EINVAL;
2071 2072
2072 /* bt848 has a 12-bit register space */ 2073 /* bt848 has a 12-bit register space */
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 476171cf5001..34a39d2e4703 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -859,7 +859,7 @@ static int __cafe_cam_reset(struct cafe_camera *cam)
859 */ 859 */
860static int cafe_cam_init(struct cafe_camera *cam) 860static int cafe_cam_init(struct cafe_camera *cam)
861{ 861{
862 struct v4l2_chip_ident chip = { V4L2_CHIP_MATCH_I2C_ADDR, 0, 0, 0 }; 862 struct v4l2_dbg_chip_ident chip;
863 int ret; 863 int ret;
864 864
865 mutex_lock(&cam->s_mutex); 865 mutex_lock(&cam->s_mutex);
@@ -869,8 +869,9 @@ static int cafe_cam_init(struct cafe_camera *cam)
869 ret = __cafe_cam_reset(cam); 869 ret = __cafe_cam_reset(cam);
870 if (ret) 870 if (ret)
871 goto out; 871 goto out;
872 chip.match_chip = cam->sensor->addr; 872 chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
873 ret = __cafe_cam_cmd(cam, VIDIOC_G_CHIP_IDENT, &chip); 873 chip.match.addr = cam->sensor->addr;
874 ret = __cafe_cam_cmd(cam, VIDIOC_DBG_G_CHIP_IDENT, &chip);
874 if (ret) 875 if (ret)
875 goto out; 876 goto out;
876 cam->sensor_type = chip.ident; 877 cam->sensor_type = chip.ident;
diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c
index 70fcd0d5de13..14bebf8a116f 100644
--- a/drivers/media/video/cs5345.c
+++ b/drivers/media/video/cs5345.c
@@ -95,25 +95,24 @@ static int cs5345_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
95} 95}
96 96
97#ifdef CONFIG_VIDEO_ADV_DEBUG 97#ifdef CONFIG_VIDEO_ADV_DEBUG
98static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 98static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
99{ 99{
100 struct i2c_client *client = v4l2_get_subdevdata(sd); 100 struct i2c_client *client = v4l2_get_subdevdata(sd);
101 101
102 if (!v4l2_chip_match_i2c_client(client, 102 if (!v4l2_chip_match_i2c_client(client, &reg->match))
103 reg->match_type, reg->match_chip))
104 return -EINVAL; 103 return -EINVAL;
105 if (!capable(CAP_SYS_ADMIN)) 104 if (!capable(CAP_SYS_ADMIN))
106 return -EPERM; 105 return -EPERM;
106 reg->size = 1;
107 reg->val = cs5345_read(sd, reg->reg & 0x1f); 107 reg->val = cs5345_read(sd, reg->reg & 0x1f);
108 return 0; 108 return 0;
109} 109}
110 110
111static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 111static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
112{ 112{
113 struct i2c_client *client = v4l2_get_subdevdata(sd); 113 struct i2c_client *client = v4l2_get_subdevdata(sd);
114 114
115 if (!v4l2_chip_match_i2c_client(client, 115 if (!v4l2_chip_match_i2c_client(client, &reg->match))
116 reg->match_type, reg->match_chip))
117 return -EINVAL; 116 return -EINVAL;
118 if (!capable(CAP_SYS_ADMIN)) 117 if (!capable(CAP_SYS_ADMIN))
119 return -EPERM; 118 return -EPERM;
@@ -122,7 +121,7 @@ static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
122} 121}
123#endif 122#endif
124 123
125static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 124static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
126{ 125{
127 struct i2c_client *client = v4l2_get_subdevdata(sd); 126 struct i2c_client *client = v4l2_get_subdevdata(sd);
128 127
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index cb65d519cf78..7292a6316e63 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -102,7 +102,7 @@ static int cs53l32a_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
102 return 0; 102 return 0;
103} 103}
104 104
105static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 105static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
106{ 106{
107 struct i2c_client *client = v4l2_get_subdevdata(sd); 107 struct i2c_client *client = v4l2_get_subdevdata(sd);
108 108
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 8941f58bed7f..83e1c6333126 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -242,7 +242,7 @@ int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg)
242 return retval; 242 return retval;
243 } 243 }
244 } 244 }
245 if (cmd != VIDIOC_G_CHIP_IDENT) 245 if (cmd != VIDIOC_DBG_G_CHIP_IDENT)
246 CX18_ERR("i2c addr 0x%02x not found for cmd 0x%x!\n", 246 CX18_ERR("i2c addr 0x%02x not found for cmd 0x%x!\n",
247 addr, cmd); 247 addr, cmd);
248 return -ENODEV; 248 return -ENODEV;
@@ -268,17 +268,6 @@ static int cx18_i2c_id_addr(struct cx18 *cx, u32 id)
268 return retval; 268 return retval;
269} 269}
270 270
271/* Find the i2c device name matching the DRIVERID */
272static const char *cx18_i2c_id_name(u32 id)
273{
274 int i;
275
276 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
277 if (hw_driverids[i] == id)
278 return hw_devicenames[i];
279 return "unknown device";
280}
281
282/* Find the i2c device name matching the CX18_HW_ flag */ 271/* Find the i2c device name matching the CX18_HW_ flag */
283static const char *cx18_i2c_hw_name(u32 hw) 272static const char *cx18_i2c_hw_name(u32 hw)
284{ 273{
@@ -326,21 +315,6 @@ int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg)
326 return cx18_call_i2c_client(cx, addr, cmd, arg); 315 return cx18_call_i2c_client(cx, addr, cmd, arg);
327} 316}
328 317
329/* Calls i2c device based on I2C driver ID. */
330int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg)
331{
332 int addr;
333
334 addr = cx18_i2c_id_addr(cx, id);
335 if (addr < 0) {
336 if (cmd != VIDIOC_G_CHIP_IDENT)
337 CX18_ERR("i2c ID 0x%08x (%s) not found for cmd 0x%x!\n",
338 id, cx18_i2c_id_name(id), cmd);
339 return addr;
340 }
341 return cx18_call_i2c_client(cx, addr, cmd, arg);
342}
343
344/* broadcast cmd for all I2C clients and for the gpio subsystem */ 318/* broadcast cmd for all I2C clients and for the gpio subsystem */
345void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg) 319void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg)
346{ 320{
diff --git a/drivers/media/video/cx18/cx18-i2c.h b/drivers/media/video/cx18/cx18-i2c.h
index 113c3f9a2cc0..4869739013bd 100644
--- a/drivers/media/video/cx18/cx18-i2c.h
+++ b/drivers/media/video/cx18/cx18-i2c.h
@@ -23,7 +23,6 @@
23 23
24int cx18_i2c_hw_addr(struct cx18 *cx, u32 hw); 24int cx18_i2c_hw_addr(struct cx18 *cx, u32 hw);
25int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg); 25int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg);
26int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg);
27int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg); 26int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg);
28void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg); 27void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg);
29int cx18_i2c_register(struct cx18 *cx, unsigned idx); 28int cx18_i2c_register(struct cx18 *cx, unsigned idx);
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index 8aa152b39545..7086aaba77d6 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -254,30 +254,24 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
254} 254}
255 255
256static int cx18_g_chip_ident(struct file *file, void *fh, 256static int cx18_g_chip_ident(struct file *file, void *fh,
257 struct v4l2_chip_ident *chip) 257 struct v4l2_dbg_chip_ident *chip)
258{ 258{
259 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 259 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
260 260
261 chip->ident = V4L2_IDENT_NONE; 261 chip->ident = V4L2_IDENT_NONE;
262 chip->revision = 0; 262 chip->revision = 0;
263 if (chip->match_type == V4L2_CHIP_MATCH_HOST) { 263 if (v4l2_chip_match_host(&chip->match)) {
264 if (v4l2_chip_match_host(chip->match_type, chip->match_chip)) 264 chip->ident = V4L2_IDENT_CX23418;
265 chip->ident = V4L2_IDENT_CX23418;
266 return 0; 265 return 0;
267 } 266 }
268 if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 267 cx18_call_i2c_clients(cx, VIDIOC_DBG_G_CHIP_IDENT, chip);
269 return cx18_i2c_id(cx, chip->match_chip, VIDIOC_G_CHIP_IDENT, 268 return 0;
270 chip);
271 if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR)
272 return cx18_call_i2c_client(cx, chip->match_chip,
273 VIDIOC_G_CHIP_IDENT, chip);
274 return -EINVAL;
275} 269}
276 270
277#ifdef CONFIG_VIDEO_ADV_DEBUG 271#ifdef CONFIG_VIDEO_ADV_DEBUG
278static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) 272static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
279{ 273{
280 struct v4l2_register *regs = arg; 274 struct v4l2_dbg_register *regs = arg;
281 unsigned long flags; 275 unsigned long flags;
282 276
283 if (!capable(CAP_SYS_ADMIN)) 277 if (!capable(CAP_SYS_ADMIN))
@@ -286,6 +280,7 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
286 return -EINVAL; 280 return -EINVAL;
287 281
288 spin_lock_irqsave(&cx18_cards_lock, flags); 282 spin_lock_irqsave(&cx18_cards_lock, flags);
283 regs->size = 4;
289 if (cmd == VIDIOC_DBG_G_REGISTER) 284 if (cmd == VIDIOC_DBG_G_REGISTER)
290 regs->val = cx18_read_enc(cx, regs->reg); 285 regs->val = cx18_read_enc(cx, regs->reg);
291 else 286 else
@@ -295,31 +290,25 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
295} 290}
296 291
297static int cx18_g_register(struct file *file, void *fh, 292static int cx18_g_register(struct file *file, void *fh,
298 struct v4l2_register *reg) 293 struct v4l2_dbg_register *reg)
299{ 294{
300 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 295 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
301 296
302 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 297 if (v4l2_chip_match_host(&reg->match))
303 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); 298 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg);
304 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 299 cx18_call_i2c_clients(cx, VIDIOC_DBG_G_REGISTER, reg);
305 return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER, 300 return 0;
306 reg);
307 return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER,
308 reg);
309} 301}
310 302
311static int cx18_s_register(struct file *file, void *fh, 303static int cx18_s_register(struct file *file, void *fh,
312 struct v4l2_register *reg) 304 struct v4l2_dbg_register *reg)
313{ 305{
314 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 306 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
315 307
316 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 308 if (v4l2_chip_match_host(&reg->match))
317 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); 309 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg);
318 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 310 cx18_call_i2c_clients(cx, VIDIOC_DBG_S_REGISTER, reg);
319 return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER, 311 return 0;
320 reg);
321 return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER,
322 reg);
323} 312}
324#endif 313#endif
325 314
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index 637c4d008846..2d81c4d04340 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1326,11 +1326,11 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1326 1326
1327#ifdef CONFIG_VIDEO_ADV_DEBUG 1327#ifdef CONFIG_VIDEO_ADV_DEBUG
1328static int vidioc_g_register(struct file *file, void *fh, 1328static int vidioc_g_register(struct file *file, void *fh,
1329 struct v4l2_register *reg) 1329 struct v4l2_dbg_register *reg)
1330{ 1330{
1331 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1331 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;
1332 1332
1333 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1333 if (!v4l2_chip_match_host(&reg->match))
1334 return -EINVAL; 1334 return -EINVAL;
1335 1335
1336 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg); 1336 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg);
@@ -1339,11 +1339,11 @@ static int vidioc_g_register(struct file *file, void *fh,
1339} 1339}
1340 1340
1341static int vidioc_s_register(struct file *file, void *fh, 1341static int vidioc_s_register(struct file *file, void *fh,
1342 struct v4l2_register *reg) 1342 struct v4l2_dbg_register *reg)
1343{ 1343{
1344 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1344 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;
1345 1345
1346 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1346 if (!v4l2_chip_match_host(&reg->match))
1347 return -EINVAL; 1347 return -EINVAL;
1348 1348
1349 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg); 1349 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg);
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 2ad277189da8..88f2fd32bfe3 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1120,25 +1120,24 @@ static int cx25840_init(struct v4l2_subdev *sd, u32 val)
1120} 1120}
1121 1121
1122#ifdef CONFIG_VIDEO_ADV_DEBUG 1122#ifdef CONFIG_VIDEO_ADV_DEBUG
1123static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1123static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1124{ 1124{
1125 struct i2c_client *client = v4l2_get_subdevdata(sd); 1125 struct i2c_client *client = v4l2_get_subdevdata(sd);
1126 1126
1127 if (!v4l2_chip_match_i2c_client(client, 1127 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1128 reg->match_type, reg->match_chip))
1129 return -EINVAL; 1128 return -EINVAL;
1130 if (!capable(CAP_SYS_ADMIN)) 1129 if (!capable(CAP_SYS_ADMIN))
1131 return -EPERM; 1130 return -EPERM;
1131 reg->size = 1;
1132 reg->val = cx25840_read(client, reg->reg & 0x0fff); 1132 reg->val = cx25840_read(client, reg->reg & 0x0fff);
1133 return 0; 1133 return 0;
1134} 1134}
1135 1135
1136static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1136static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1137{ 1137{
1138 struct i2c_client *client = v4l2_get_subdevdata(sd); 1138 struct i2c_client *client = v4l2_get_subdevdata(sd);
1139 1139
1140 if (!v4l2_chip_match_i2c_client(client, 1140 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1141 reg->match_type, reg->match_chip))
1142 return -EINVAL; 1141 return -EINVAL;
1143 if (!capable(CAP_SYS_ADMIN)) 1142 if (!capable(CAP_SYS_ADMIN))
1144 return -EPERM; 1143 return -EPERM;
@@ -1362,7 +1361,7 @@ static int cx25840_reset(struct v4l2_subdev *sd, u32 val)
1362 return 0; 1361 return 0;
1363} 1362}
1364 1363
1365static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1364static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
1366{ 1365{
1367 struct cx25840_state *state = to_state(sd); 1366 struct cx25840_state *state = to_state(sd);
1368 struct i2c_client *client = v4l2_get_subdevdata(sd); 1367 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index b93b7ab99d8c..791e69d804f9 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1447,25 +1447,26 @@ static int vidioc_s_frequency (struct file *file, void *priv,
1447 1447
1448#ifdef CONFIG_VIDEO_ADV_DEBUG 1448#ifdef CONFIG_VIDEO_ADV_DEBUG
1449static int vidioc_g_register (struct file *file, void *fh, 1449static int vidioc_g_register (struct file *file, void *fh,
1450 struct v4l2_register *reg) 1450 struct v4l2_dbg_register *reg)
1451{ 1451{
1452 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1452 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
1453 1453
1454 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1454 if (!v4l2_chip_match_host(&reg->match))
1455 return -EINVAL; 1455 return -EINVAL;
1456 /* cx2388x has a 24-bit register space */ 1456 /* cx2388x has a 24-bit register space */
1457 reg->val = cx_read(reg->reg&0xffffff); 1457 reg->val = cx_read(reg->reg & 0xffffff);
1458 reg->size = 4;
1458 return 0; 1459 return 0;
1459} 1460}
1460 1461
1461static int vidioc_s_register (struct file *file, void *fh, 1462static int vidioc_s_register (struct file *file, void *fh,
1462 struct v4l2_register *reg) 1463 struct v4l2_dbg_register *reg)
1463{ 1464{
1464 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1465 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
1465 1466
1466 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1467 if (!v4l2_chip_match_host(&reg->match))
1467 return -EINVAL; 1468 return -EINVAL;
1468 cx_write(reg->reg&0xffffff, reg->val); 1469 cx_write(reg->reg & 0xffffff, reg->val);
1469 return 0; 1470 return 0;
1470} 1471}
1471#endif 1472#endif
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 9cb7c64a88fa..416b691c33c1 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1154,7 +1154,7 @@ static int em28xx_reg_len(int reg)
1154} 1154}
1155 1155
1156static int vidioc_g_chip_ident(struct file *file, void *priv, 1156static int vidioc_g_chip_ident(struct file *file, void *priv,
1157 struct v4l2_chip_ident *chip) 1157 struct v4l2_dbg_chip_ident *chip)
1158{ 1158{
1159 struct em28xx_fh *fh = priv; 1159 struct em28xx_fh *fh = priv;
1160 struct em28xx *dev = fh->dev; 1160 struct em28xx *dev = fh->dev;
@@ -1162,20 +1162,20 @@ static int vidioc_g_chip_ident(struct file *file, void *priv,
1162 chip->ident = V4L2_IDENT_NONE; 1162 chip->ident = V4L2_IDENT_NONE;
1163 chip->revision = 0; 1163 chip->revision = 0;
1164 1164
1165 em28xx_i2c_call_clients(dev, VIDIOC_G_CHIP_IDENT, chip); 1165 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
1166 1166
1167 return 0; 1167 return 0;
1168} 1168}
1169 1169
1170 1170
1171static int vidioc_g_register(struct file *file, void *priv, 1171static int vidioc_g_register(struct file *file, void *priv,
1172 struct v4l2_register *reg) 1172 struct v4l2_dbg_register *reg)
1173{ 1173{
1174 struct em28xx_fh *fh = priv; 1174 struct em28xx_fh *fh = priv;
1175 struct em28xx *dev = fh->dev; 1175 struct em28xx *dev = fh->dev;
1176 int ret; 1176 int ret;
1177 1177
1178 switch (reg->match_type) { 1178 switch (reg->match.type) {
1179 case V4L2_CHIP_MATCH_AC97: 1179 case V4L2_CHIP_MATCH_AC97:
1180 mutex_lock(&dev->lock); 1180 mutex_lock(&dev->lock);
1181 ret = em28xx_read_ac97(dev, reg->reg); 1181 ret = em28xx_read_ac97(dev, reg->reg);
@@ -1184,6 +1184,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1184 return ret; 1184 return ret;
1185 1185
1186 reg->val = ret; 1186 reg->val = ret;
1187 reg->size = 1;
1187 return 0; 1188 return 0;
1188 case V4L2_CHIP_MATCH_I2C_DRIVER: 1189 case V4L2_CHIP_MATCH_I2C_DRIVER:
1189 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); 1190 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg);
@@ -1192,12 +1193,13 @@ static int vidioc_g_register(struct file *file, void *priv,
1192 /* Not supported yet */ 1193 /* Not supported yet */
1193 return -EINVAL; 1194 return -EINVAL;
1194 default: 1195 default:
1195 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1196 if (!v4l2_chip_match_host(&reg->match))
1196 return -EINVAL; 1197 return -EINVAL;
1197 } 1198 }
1198 1199
1199 /* Match host */ 1200 /* Match host */
1200 if (em28xx_reg_len(reg->reg) == 1) { 1201 reg->size = em28xx_reg_len(reg->reg);
1202 if (reg->size == 1) {
1201 mutex_lock(&dev->lock); 1203 mutex_lock(&dev->lock);
1202 ret = em28xx_read_reg(dev, reg->reg); 1204 ret = em28xx_read_reg(dev, reg->reg);
1203 mutex_unlock(&dev->lock); 1205 mutex_unlock(&dev->lock);
@@ -1207,7 +1209,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1207 1209
1208 reg->val = ret; 1210 reg->val = ret;
1209 } else { 1211 } else {
1210 __le64 val = 0; 1212 __le16 val = 0;
1211 mutex_lock(&dev->lock); 1213 mutex_lock(&dev->lock);
1212 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, 1214 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
1213 reg->reg, (char *)&val, 2); 1215 reg->reg, (char *)&val, 2);
@@ -1215,21 +1217,21 @@ static int vidioc_g_register(struct file *file, void *priv,
1215 if (ret < 0) 1217 if (ret < 0)
1216 return ret; 1218 return ret;
1217 1219
1218 reg->val = le64_to_cpu(val); 1220 reg->val = le16_to_cpu(val);
1219 } 1221 }
1220 1222
1221 return 0; 1223 return 0;
1222} 1224}
1223 1225
1224static int vidioc_s_register(struct file *file, void *priv, 1226static int vidioc_s_register(struct file *file, void *priv,
1225 struct v4l2_register *reg) 1227 struct v4l2_dbg_register *reg)
1226{ 1228{
1227 struct em28xx_fh *fh = priv; 1229 struct em28xx_fh *fh = priv;
1228 struct em28xx *dev = fh->dev; 1230 struct em28xx *dev = fh->dev;
1229 __le64 buf; 1231 __le16 buf;
1230 int rc; 1232 int rc;
1231 1233
1232 switch (reg->match_type) { 1234 switch (reg->match.type) {
1233 case V4L2_CHIP_MATCH_AC97: 1235 case V4L2_CHIP_MATCH_AC97:
1234 mutex_lock(&dev->lock); 1236 mutex_lock(&dev->lock);
1235 rc = em28xx_write_ac97(dev, reg->reg, reg->val); 1237 rc = em28xx_write_ac97(dev, reg->reg, reg->val);
@@ -1243,12 +1245,12 @@ static int vidioc_s_register(struct file *file, void *priv,
1243 /* Not supported yet */ 1245 /* Not supported yet */
1244 return -EINVAL; 1246 return -EINVAL;
1245 default: 1247 default:
1246 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1248 if (!v4l2_chip_match_host(&reg->match))
1247 return -EINVAL; 1249 return -EINVAL;
1248 } 1250 }
1249 1251
1250 /* Match host */ 1252 /* Match host */
1251 buf = cpu_to_le64(reg->val); 1253 buf = cpu_to_le16(reg->val);
1252 1254
1253 mutex_lock(&dev->lock); 1255 mutex_lock(&dev->lock);
1254 rc = em28xx_write_regs(dev, reg->reg, (char *)&buf, 1256 rc = em28xx_write_regs(dev, reg->reg, (char *)&buf,
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 08b762951759..e8e5921cdc34 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -902,18 +902,19 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
902 } 902 }
903 903
904 if (hw & IVTV_HW_SAA711X) { 904 if (hw & IVTV_HW_SAA711X) {
905 struct v4l2_chip_ident v = { V4L2_CHIP_MATCH_I2C_DRIVER, I2C_DRIVERID_SAA711X }; 905 struct v4l2_dbg_chip_ident v;
906 906
907 /* determine the exact saa711x model */ 907 /* determine the exact saa711x model */
908 itv->hw_flags &= ~IVTV_HW_SAA711X; 908 itv->hw_flags &= ~IVTV_HW_SAA711X;
909 909
910 v.match.type = V4L2_CHIP_MATCH_I2C_DRIVER;
911 strlcpy(v.match.name, "saa7115", sizeof(v.match.name));
910 ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, &v); 912 ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, &v);
911 if (v.ident == V4L2_IDENT_SAA7114) { 913 if (v.ident == V4L2_IDENT_SAA7114) {
912 itv->hw_flags |= IVTV_HW_SAA7114; 914 itv->hw_flags |= IVTV_HW_SAA7114;
913 /* VBI is not yet supported by the saa7114 driver. */ 915 /* VBI is not yet supported by the saa7114 driver. */
914 itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE); 916 itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE);
915 } 917 } else {
916 else {
917 itv->hw_flags |= IVTV_HW_SAA7115; 918 itv->hw_flags |= IVTV_HW_SAA7115;
918 } 919 }
919 itv->vbi.raw_decoder_line_size = 1443; 920 itv->vbi.raw_decoder_line_size = 1443;
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 1f6ca93b9840..f6b3ef6e691b 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -674,19 +674,19 @@ static int ivtv_s_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_f
674 return ret; 674 return ret;
675} 675}
676 676
677static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident *chip) 677static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_dbg_chip_ident *chip)
678{ 678{
679 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 679 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
680 680
681 chip->ident = V4L2_IDENT_NONE; 681 chip->ident = V4L2_IDENT_NONE;
682 chip->revision = 0; 682 chip->revision = 0;
683 if (chip->match_type == V4L2_CHIP_MATCH_HOST) { 683 if (chip->match.type == V4L2_CHIP_MATCH_HOST) {
684 if (v4l2_chip_match_host(chip->match_type, chip->match_chip)) 684 if (v4l2_chip_match_host(&chip->match))
685 chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416; 685 chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416;
686 return 0; 686 return 0;
687 } 687 }
688 if (chip->match_type != V4L2_CHIP_MATCH_I2C_DRIVER && 688 if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER &&
689 chip->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 689 chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
690 return -EINVAL; 690 return -EINVAL;
691 /* TODO: is this correct? */ 691 /* TODO: is this correct? */
692 return ivtv_call_all_err(itv, core, g_chip_ident, chip); 692 return ivtv_call_all_err(itv, core, g_chip_ident, chip);
@@ -695,7 +695,7 @@ static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident
695#ifdef CONFIG_VIDEO_ADV_DEBUG 695#ifdef CONFIG_VIDEO_ADV_DEBUG
696static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg) 696static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
697{ 697{
698 struct v4l2_register *regs = arg; 698 struct v4l2_dbg_register *regs = arg;
699 volatile u8 __iomem *reg_start; 699 volatile u8 __iomem *reg_start;
700 700
701 if (!capable(CAP_SYS_ADMIN)) 701 if (!capable(CAP_SYS_ADMIN))
@@ -710,6 +710,7 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
710 else 710 else
711 return -EINVAL; 711 return -EINVAL;
712 712
713 regs->size = 4;
713 if (cmd == VIDIOC_DBG_G_REGISTER) 714 if (cmd == VIDIOC_DBG_G_REGISTER)
714 regs->val = readl(regs->reg + reg_start); 715 regs->val = readl(regs->reg + reg_start);
715 else 716 else
@@ -717,11 +718,11 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
717 return 0; 718 return 0;
718} 719}
719 720
720static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *reg) 721static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg)
721{ 722{
722 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 723 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
723 724
724 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 725 if (v4l2_chip_match_host(&reg->match))
725 return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg); 726 return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg);
726 /* TODO: subdev errors should not be ignored, this should become a 727 /* TODO: subdev errors should not be ignored, this should become a
727 subdev helper function. */ 728 subdev helper function. */
@@ -729,11 +730,11 @@ static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *re
729 return 0; 730 return 0;
730} 731}
731 732
732static int ivtv_s_register(struct file *file, void *fh, struct v4l2_register *reg) 733static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg)
733{ 734{
734 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 735 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
735 736
736 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 737 if (v4l2_chip_match_host(&reg->match))
737 return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg); 738 return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg);
738 /* TODO: subdev errors should not be ignored, this should become a 739 /* TODO: subdev errors should not be ignored, this should become a
739 subdev helper function. */ 740 subdev helper function. */
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c
index 07be14a9fe7b..de397ef57b44 100644
--- a/drivers/media/video/m52790.c
+++ b/drivers/media/video/m52790.c
@@ -80,29 +80,28 @@ static int m52790_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
80} 80}
81 81
82#ifdef CONFIG_VIDEO_ADV_DEBUG 82#ifdef CONFIG_VIDEO_ADV_DEBUG
83static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 83static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
84{ 84{
85 struct m52790_state *state = to_state(sd); 85 struct m52790_state *state = to_state(sd);
86 struct i2c_client *client = v4l2_get_subdevdata(sd); 86 struct i2c_client *client = v4l2_get_subdevdata(sd);
87 87
88 if (!v4l2_chip_match_i2c_client(client, 88 if (!v4l2_chip_match_i2c_client(client, &reg->match))
89 reg->match_type, reg->match_chip))
90 return -EINVAL; 89 return -EINVAL;
91 if (!capable(CAP_SYS_ADMIN)) 90 if (!capable(CAP_SYS_ADMIN))
92 return -EPERM; 91 return -EPERM;
93 if (reg->reg != 0) 92 if (reg->reg != 0)
94 return -EINVAL; 93 return -EINVAL;
94 reg->size = 1;
95 reg->val = state->input | state->output; 95 reg->val = state->input | state->output;
96 return 0; 96 return 0;
97} 97}
98 98
99static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 99static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
100{ 100{
101 struct m52790_state *state = to_state(sd); 101 struct m52790_state *state = to_state(sd);
102 struct i2c_client *client = v4l2_get_subdevdata(sd); 102 struct i2c_client *client = v4l2_get_subdevdata(sd);
103 103
104 if (!v4l2_chip_match_i2c_client(client, 104 if (!v4l2_chip_match_i2c_client(client, &reg->match))
105 reg->match_type, reg->match_chip))
106 return -EINVAL; 105 return -EINVAL;
107 if (!capable(CAP_SYS_ADMIN)) 106 if (!capable(CAP_SYS_ADMIN))
108 return -EPERM; 107 return -EPERM;
@@ -115,7 +114,7 @@ static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
115} 114}
116#endif 115#endif
117 116
118static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 117static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
119{ 118{
120 struct i2c_client *client = v4l2_get_subdevdata(sd); 119 struct i2c_client *client = v4l2_get_subdevdata(sd);
121 120
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index b8577ade4050..4d7a91852117 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -733,7 +733,7 @@ static int msp_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
733 return 0; 733 return 0;
734} 734}
735 735
736static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 736static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
737{ 737{
738 struct msp_state *state = to_state(sd); 738 struct msp_state *state = to_state(sd);
739 struct i2c_client *client = v4l2_get_subdevdata(sd); 739 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 1a1a12453672..c1bf75ef2741 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -343,14 +343,14 @@ static int mt9m001_try_fmt(struct soc_camera_device *icd,
343} 343}
344 344
345static int mt9m001_get_chip_id(struct soc_camera_device *icd, 345static int mt9m001_get_chip_id(struct soc_camera_device *icd,
346 struct v4l2_chip_ident *id) 346 struct v4l2_dbg_chip_ident *id)
347{ 347{
348 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 348 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
349 349
350 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 350 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
351 return -EINVAL; 351 return -EINVAL;
352 352
353 if (id->match_chip != mt9m001->client->addr) 353 if (id->match.addr != mt9m001->client->addr)
354 return -ENODEV; 354 return -ENODEV;
355 355
356 id->ident = mt9m001->model; 356 id->ident = mt9m001->model;
@@ -361,16 +361,17 @@ static int mt9m001_get_chip_id(struct soc_camera_device *icd,
361 361
362#ifdef CONFIG_VIDEO_ADV_DEBUG 362#ifdef CONFIG_VIDEO_ADV_DEBUG
363static int mt9m001_get_register(struct soc_camera_device *icd, 363static int mt9m001_get_register(struct soc_camera_device *icd,
364 struct v4l2_register *reg) 364 struct v4l2_dbg_register *reg)
365{ 365{
366 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 366 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
367 367
368 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 368 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
369 return -EINVAL; 369 return -EINVAL;
370 370
371 if (reg->match_chip != mt9m001->client->addr) 371 if (reg->match.addr != mt9m001->client->addr)
372 return -ENODEV; 372 return -ENODEV;
373 373
374 reg->size = 2;
374 reg->val = reg_read(icd, reg->reg); 375 reg->val = reg_read(icd, reg->reg);
375 376
376 if (reg->val > 0xffff) 377 if (reg->val > 0xffff)
@@ -380,14 +381,14 @@ static int mt9m001_get_register(struct soc_camera_device *icd,
380} 381}
381 382
382static int mt9m001_set_register(struct soc_camera_device *icd, 383static int mt9m001_set_register(struct soc_camera_device *icd,
383 struct v4l2_register *reg) 384 struct v4l2_dbg_register *reg)
384{ 385{
385 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 386 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
386 387
387 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 388 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
388 return -EINVAL; 389 return -EINVAL;
389 390
390 if (reg->match_chip != mt9m001->client->addr) 391 if (reg->match.addr != mt9m001->client->addr)
391 return -ENODEV; 392 return -ENODEV;
392 393
393 if (reg_write(icd, reg->reg, reg->val) < 0) 394 if (reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index c89ea41fe259..5b8e20979cce 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -514,14 +514,14 @@ static int mt9m111_try_fmt(struct soc_camera_device *icd,
514} 514}
515 515
516static int mt9m111_get_chip_id(struct soc_camera_device *icd, 516static int mt9m111_get_chip_id(struct soc_camera_device *icd,
517 struct v4l2_chip_ident *id) 517 struct v4l2_dbg_chip_ident *id)
518{ 518{
519 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 519 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
520 520
521 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 521 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
522 return -EINVAL; 522 return -EINVAL;
523 523
524 if (id->match_chip != mt9m111->client->addr) 524 if (id->match.addr != mt9m111->client->addr)
525 return -ENODEV; 525 return -ENODEV;
526 526
527 id->ident = mt9m111->model; 527 id->ident = mt9m111->model;
@@ -532,18 +532,19 @@ static int mt9m111_get_chip_id(struct soc_camera_device *icd,
532 532
533#ifdef CONFIG_VIDEO_ADV_DEBUG 533#ifdef CONFIG_VIDEO_ADV_DEBUG
534static int mt9m111_get_register(struct soc_camera_device *icd, 534static int mt9m111_get_register(struct soc_camera_device *icd,
535 struct v4l2_register *reg) 535 struct v4l2_dbg_register *reg)
536{ 536{
537 int val; 537 int val;
538 538
539 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 539 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
540 540
541 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 541 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
542 return -EINVAL; 542 return -EINVAL;
543 if (reg->match_chip != mt9m111->client->addr) 543 if (reg->match.addr != mt9m111->client->addr)
544 return -ENODEV; 544 return -ENODEV;
545 545
546 val = mt9m111_reg_read(icd, reg->reg); 546 val = mt9m111_reg_read(icd, reg->reg);
547 reg->size = 2;
547 reg->val = (u64)val; 548 reg->val = (u64)val;
548 549
549 if (reg->val > 0xffff) 550 if (reg->val > 0xffff)
@@ -553,14 +554,14 @@ static int mt9m111_get_register(struct soc_camera_device *icd,
553} 554}
554 555
555static int mt9m111_set_register(struct soc_camera_device *icd, 556static int mt9m111_set_register(struct soc_camera_device *icd,
556 struct v4l2_register *reg) 557 struct v4l2_dbg_register *reg)
557{ 558{
558 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 559 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
559 560
560 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 561 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
561 return -EINVAL; 562 return -EINVAL;
562 563
563 if (reg->match_chip != mt9m111->client->addr) 564 if (reg->match.addr != mt9m111->client->addr)
564 return -ENODEV; 565 return -ENODEV;
565 566
566 if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0) 567 if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index 1a9d53966d06..349d8e365530 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -326,14 +326,14 @@ static int mt9t031_try_fmt(struct soc_camera_device *icd,
326} 326}
327 327
328static int mt9t031_get_chip_id(struct soc_camera_device *icd, 328static int mt9t031_get_chip_id(struct soc_camera_device *icd,
329 struct v4l2_chip_ident *id) 329 struct v4l2_dbg_chip_ident *id)
330{ 330{
331 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 331 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
332 332
333 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 333 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
334 return -EINVAL; 334 return -EINVAL;
335 335
336 if (id->match_chip != mt9t031->client->addr) 336 if (id->match.addr != mt9t031->client->addr)
337 return -ENODEV; 337 return -ENODEV;
338 338
339 id->ident = mt9t031->model; 339 id->ident = mt9t031->model;
@@ -344,14 +344,14 @@ static int mt9t031_get_chip_id(struct soc_camera_device *icd,
344 344
345#ifdef CONFIG_VIDEO_ADV_DEBUG 345#ifdef CONFIG_VIDEO_ADV_DEBUG
346static int mt9t031_get_register(struct soc_camera_device *icd, 346static int mt9t031_get_register(struct soc_camera_device *icd,
347 struct v4l2_register *reg) 347 struct v4l2_dbg_register *reg)
348{ 348{
349 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 349 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
350 350
351 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 351 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
352 return -EINVAL; 352 return -EINVAL;
353 353
354 if (reg->match_chip != mt9t031->client->addr) 354 if (reg->match.addr != mt9t031->client->addr)
355 return -ENODEV; 355 return -ENODEV;
356 356
357 reg->val = reg_read(icd, reg->reg); 357 reg->val = reg_read(icd, reg->reg);
@@ -363,14 +363,14 @@ static int mt9t031_get_register(struct soc_camera_device *icd,
363} 363}
364 364
365static int mt9t031_set_register(struct soc_camera_device *icd, 365static int mt9t031_set_register(struct soc_camera_device *icd,
366 struct v4l2_register *reg) 366 struct v4l2_dbg_register *reg)
367{ 367{
368 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 368 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
369 369
370 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 370 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
371 return -EINVAL; 371 return -EINVAL;
372 372
373 if (reg->match_chip != mt9t031->client->addr) 373 if (reg->match.addr != mt9t031->client->addr)
374 return -ENODEV; 374 return -ENODEV;
375 375
376 if (reg_write(icd, reg->reg, reg->val) < 0) 376 if (reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index 14a5f9c21ffa..b04c8cb1644d 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -422,14 +422,14 @@ static int mt9v022_try_fmt(struct soc_camera_device *icd,
422} 422}
423 423
424static int mt9v022_get_chip_id(struct soc_camera_device *icd, 424static int mt9v022_get_chip_id(struct soc_camera_device *icd,
425 struct v4l2_chip_ident *id) 425 struct v4l2_dbg_chip_ident *id)
426{ 426{
427 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 427 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
428 428
429 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 429 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
430 return -EINVAL; 430 return -EINVAL;
431 431
432 if (id->match_chip != mt9v022->client->addr) 432 if (id->match.addr != mt9v022->client->addr)
433 return -ENODEV; 433 return -ENODEV;
434 434
435 id->ident = mt9v022->model; 435 id->ident = mt9v022->model;
@@ -440,16 +440,17 @@ static int mt9v022_get_chip_id(struct soc_camera_device *icd,
440 440
441#ifdef CONFIG_VIDEO_ADV_DEBUG 441#ifdef CONFIG_VIDEO_ADV_DEBUG
442static int mt9v022_get_register(struct soc_camera_device *icd, 442static int mt9v022_get_register(struct soc_camera_device *icd,
443 struct v4l2_register *reg) 443 struct v4l2_dbg_register *reg)
444{ 444{
445 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 445 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
446 446
447 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 447 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
448 return -EINVAL; 448 return -EINVAL;
449 449
450 if (reg->match_chip != mt9v022->client->addr) 450 if (reg->match.addr != mt9v022->client->addr)
451 return -ENODEV; 451 return -ENODEV;
452 452
453 reg->size = 2;
453 reg->val = reg_read(icd, reg->reg); 454 reg->val = reg_read(icd, reg->reg);
454 455
455 if (reg->val > 0xffff) 456 if (reg->val > 0xffff)
@@ -459,14 +460,14 @@ static int mt9v022_get_register(struct soc_camera_device *icd,
459} 460}
460 461
461static int mt9v022_set_register(struct soc_camera_device *icd, 462static int mt9v022_set_register(struct soc_camera_device *icd,
462 struct v4l2_register *reg) 463 struct v4l2_dbg_register *reg)
463{ 464{
464 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 465 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
465 466
466 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 467 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
467 return -EINVAL; 468 return -EINVAL;
468 469
469 if (reg->match_chip != mt9v022->client->addr) 470 if (reg->match.addr != mt9v022->client->addr)
470 return -ENODEV; 471 return -ENODEV;
471 472
472 if (reg_write(icd, reg->reg, reg->val) < 0) 473 if (reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index ea032f5f2f41..ca26b0c50cf2 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -1310,7 +1310,7 @@ static int ov7670_command(struct i2c_client *client, unsigned int cmd,
1310 void *arg) 1310 void *arg)
1311{ 1311{
1312 switch (cmd) { 1312 switch (cmd) {
1313 case VIDIOC_G_CHIP_IDENT: 1313 case VIDIOC_DBG_G_CHIP_IDENT:
1314 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0); 1314 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0);
1315 1315
1316 case VIDIOC_INT_RESET: 1316 case VIDIOC_INT_RESET:
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 54b736fcc07a..3c9e0ba974e9 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -724,7 +724,7 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
724} 724}
725 725
726static int ov772x_get_chip_id(struct soc_camera_device *icd, 726static int ov772x_get_chip_id(struct soc_camera_device *icd,
727 struct v4l2_chip_ident *id) 727 struct v4l2_dbg_chip_ident *id)
728{ 728{
729 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 729 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
730 730
@@ -736,11 +736,12 @@ static int ov772x_get_chip_id(struct soc_camera_device *icd,
736 736
737#ifdef CONFIG_VIDEO_ADV_DEBUG 737#ifdef CONFIG_VIDEO_ADV_DEBUG
738static int ov772x_get_register(struct soc_camera_device *icd, 738static int ov772x_get_register(struct soc_camera_device *icd,
739 struct v4l2_register *reg) 739 struct v4l2_dbg_register *reg)
740{ 740{
741 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 741 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
742 int ret; 742 int ret;
743 743
744 reg->size = 1;
744 if (reg->reg > 0xff) 745 if (reg->reg > 0xff)
745 return -EINVAL; 746 return -EINVAL;
746 747
@@ -754,7 +755,7 @@ static int ov772x_get_register(struct soc_camera_device *icd,
754} 755}
755 756
756static int ov772x_set_register(struct soc_camera_device *icd, 757static int ov772x_set_register(struct soc_camera_device *icd,
757 struct v4l2_register *reg) 758 struct v4l2_dbg_register *reg)
758{ 759{
759 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 760 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
760 761
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 4358079f1966..8fb92ac78c7b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -4732,26 +4732,25 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
4732 4732
4733 4733
4734int pvr2_hdw_register_access(struct pvr2_hdw *hdw, 4734int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
4735 u32 match_type, u32 match_chip, u64 reg_id, 4735 struct v4l2_dbg_match *match, u64 reg_id,
4736 int setFl,u64 *val_ptr) 4736 int setFl, u64 *val_ptr)
4737{ 4737{
4738#ifdef CONFIG_VIDEO_ADV_DEBUG 4738#ifdef CONFIG_VIDEO_ADV_DEBUG
4739 struct pvr2_i2c_client *cp; 4739 struct pvr2_i2c_client *cp;
4740 struct v4l2_register req; 4740 struct v4l2_dbg_register req;
4741 int stat = 0; 4741 int stat = 0;
4742 int okFl = 0; 4742 int okFl = 0;
4743 4743
4744 if (!capable(CAP_SYS_ADMIN)) return -EPERM; 4744 if (!capable(CAP_SYS_ADMIN)) return -EPERM;
4745 4745
4746 req.match_type = match_type; 4746 req.match = *match;
4747 req.match_chip = match_chip;
4748 req.reg = reg_id; 4747 req.reg = reg_id;
4749 if (setFl) req.val = *val_ptr; 4748 if (setFl) req.val = *val_ptr;
4750 mutex_lock(&hdw->i2c_list_lock); do { 4749 mutex_lock(&hdw->i2c_list_lock); do {
4751 list_for_each_entry(cp, &hdw->i2c_clients, list) { 4750 list_for_each_entry(cp, &hdw->i2c_clients, list) {
4752 if (!v4l2_chip_match_i2c_client( 4751 if (!v4l2_chip_match_i2c_client(
4753 cp->client, 4752 cp->client,
4754 req.match_type, req.match_chip)) { 4753 &req.match)) {
4755 continue; 4754 continue;
4756 } 4755 }
4757 stat = pvr2_i2c_client_cmd( 4756 stat = pvr2_i2c_client_cmd(
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 49482d1f2b28..1b4fec337c6b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -242,8 +242,8 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
242 setFl - true to set the register, false to read it 242 setFl - true to set the register, false to read it
243 val_ptr - storage location for source / result. */ 243 val_ptr - storage location for source / result. */
244int pvr2_hdw_register_access(struct pvr2_hdw *, 244int pvr2_hdw_register_access(struct pvr2_hdw *,
245 u32 match_type, u32 match_chip,u64 reg_id, 245 struct v4l2_dbg_match *match, u64 reg_id,
246 int setFl,u64 *val_ptr); 246 int setFl, u64 *val_ptr);
247 247
248/* The following entry points are all lower level things you normally don't 248/* The following entry points are all lower level things you normally don't
249 want to worry about. */ 249 want to worry about. */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index b9aedceb2c44..878fd52a73b3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -851,11 +851,11 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
851 case VIDIOC_DBG_G_REGISTER: 851 case VIDIOC_DBG_G_REGISTER:
852 { 852 {
853 u64 val; 853 u64 val;
854 struct v4l2_register *req = (struct v4l2_register *)arg; 854 struct v4l2_dbg_register *req = (struct v4l2_dbg_register *)arg;
855 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val; 855 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val;
856 ret = pvr2_hdw_register_access( 856 ret = pvr2_hdw_register_access(
857 hdw,req->match_type,req->match_chip,req->reg, 857 hdw, &req->match, req->reg,
858 cmd == VIDIOC_DBG_S_REGISTER,&val); 858 cmd == VIDIOC_DBG_S_REGISTER, &val);
859 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val; 859 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val;
860 break; 860 break;
861 } 861 }
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 22708ecdf1bb..46c796c3fec8 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1371,25 +1371,24 @@ static int saa711x_g_vbi_data(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_dat
1371} 1371}
1372 1372
1373#ifdef CONFIG_VIDEO_ADV_DEBUG 1373#ifdef CONFIG_VIDEO_ADV_DEBUG
1374static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1374static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1375{ 1375{
1376 struct i2c_client *client = v4l2_get_subdevdata(sd); 1376 struct i2c_client *client = v4l2_get_subdevdata(sd);
1377 1377
1378 if (!v4l2_chip_match_i2c_client(client, 1378 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1379 reg->match_type, reg->match_chip))
1380 return -EINVAL; 1379 return -EINVAL;
1381 if (!capable(CAP_SYS_ADMIN)) 1380 if (!capable(CAP_SYS_ADMIN))
1382 return -EPERM; 1381 return -EPERM;
1383 reg->val = saa711x_read(sd, reg->reg & 0xff); 1382 reg->val = saa711x_read(sd, reg->reg & 0xff);
1383 reg->size = 1;
1384 return 0; 1384 return 0;
1385} 1385}
1386 1386
1387static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1387static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1388{ 1388{
1389 struct i2c_client *client = v4l2_get_subdevdata(sd); 1389 struct i2c_client *client = v4l2_get_subdevdata(sd);
1390 1390
1391 if (!v4l2_chip_match_i2c_client(client, 1391 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1392 reg->match_type, reg->match_chip))
1393 return -EINVAL; 1392 return -EINVAL;
1394 if (!capable(CAP_SYS_ADMIN)) 1393 if (!capable(CAP_SYS_ADMIN))
1395 return -EPERM; 1394 return -EPERM;
@@ -1398,7 +1397,7 @@ static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
1398} 1397}
1399#endif 1398#endif
1400 1399
1401static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1400static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
1402{ 1401{
1403 struct saa711x_state *state = to_state(sd); 1402 struct saa711x_state *state = to_state(sd);
1404 struct i2c_client *client = v4l2_get_subdevdata(sd); 1403 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index bfc85654795e..d6848f7a503b 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -623,25 +623,24 @@ static int saa7127_s_vbi_data(struct v4l2_subdev *sd, const struct v4l2_sliced_v
623} 623}
624 624
625#ifdef CONFIG_VIDEO_ADV_DEBUG 625#ifdef CONFIG_VIDEO_ADV_DEBUG
626static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 626static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
627{ 627{
628 struct i2c_client *client = v4l2_get_subdevdata(sd); 628 struct i2c_client *client = v4l2_get_subdevdata(sd);
629 629
630 if (!v4l2_chip_match_i2c_client(client, 630 if (!v4l2_chip_match_i2c_client(client, &reg->match))
631 reg->match_type, reg->match_chip))
632 return -EINVAL; 631 return -EINVAL;
633 if (!capable(CAP_SYS_ADMIN)) 632 if (!capable(CAP_SYS_ADMIN))
634 return -EPERM; 633 return -EPERM;
635 reg->val = saa7127_read(sd, reg->reg & 0xff); 634 reg->val = saa7127_read(sd, reg->reg & 0xff);
635 reg->size = 1;
636 return 0; 636 return 0;
637} 637}
638 638
639static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 639static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
640{ 640{
641 struct i2c_client *client = v4l2_get_subdevdata(sd); 641 struct i2c_client *client = v4l2_get_subdevdata(sd);
642 642
643 if (!v4l2_chip_match_i2c_client(client, 643 if (!v4l2_chip_match_i2c_client(client, &reg->match))
644 reg->match_type, reg->match_chip))
645 return -EINVAL; 644 return -EINVAL;
646 if (!capable(CAP_SYS_ADMIN)) 645 if (!capable(CAP_SYS_ADMIN))
647 return -EPERM; 646 return -EPERM;
@@ -650,7 +649,7 @@ static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
650} 649}
651#endif 650#endif
652 651
653static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 652static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
654{ 653{
655 struct saa7127_state *state = to_state(sd); 654 struct saa7127_state *state = to_state(sd);
656 struct i2c_client *client = v4l2_get_subdevdata(sd); 655 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index 1fb6eccdade3..1fee6e84a512 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -838,7 +838,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
838 h->standard = *((v4l2_std_id *) arg); 838 h->standard = *((v4l2_std_id *) arg);
839 break; 839 break;
840 840
841 case VIDIOC_G_CHIP_IDENT: 841 case VIDIOC_DBG_G_CHIP_IDENT:
842 return v4l2_chip_ident_i2c_client(client, 842 return v4l2_chip_ident_i2c_client(client,
843 arg, h->chip, h->revision); 843 arg, h->chip, h->revision);
844 844
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 3beba480137f..c9d8beb87a60 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -405,7 +405,7 @@ static int empress_querymenu(struct file *file, void *priv,
405} 405}
406 406
407static int empress_g_chip_ident(struct file *file, void *fh, 407static int empress_g_chip_ident(struct file *file, void *fh,
408 struct v4l2_chip_ident *chip) 408 struct v4l2_dbg_chip_ident *chip)
409{ 409{
410 struct saa7134_dev *dev = file->private_data; 410 struct saa7134_dev *dev = file->private_data;
411 411
@@ -413,12 +413,12 @@ static int empress_g_chip_ident(struct file *file, void *fh,
413 chip->revision = 0; 413 chip->revision = 0;
414 if (dev->mpeg_i2c_client == NULL) 414 if (dev->mpeg_i2c_client == NULL)
415 return -EINVAL; 415 return -EINVAL;
416 if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER && 416 if (chip->match.type == V4L2_CHIP_MATCH_I2C_DRIVER &&
417 chip->match_chip == I2C_DRIVERID_SAA6752HS) 417 !strcmp(chip->match.name, "saa6752hs"))
418 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip); 418 return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
419 if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR && 419 if (chip->match.type == V4L2_CHIP_MATCH_I2C_ADDR &&
420 chip->match_chip == dev->mpeg_i2c_client->addr) 420 chip->match.addr == dev->mpeg_i2c_client->addr)
421 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip); 421 return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
422 return -EINVAL; 422 return -EINVAL;
423} 423}
424 424
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 6b2ab57538ee..a1f7e351f572 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -2247,24 +2247,25 @@ static int saa7134_g_parm(struct file *file, void *fh,
2247 2247
2248#ifdef CONFIG_VIDEO_ADV_DEBUG 2248#ifdef CONFIG_VIDEO_ADV_DEBUG
2249static int vidioc_g_register (struct file *file, void *priv, 2249static int vidioc_g_register (struct file *file, void *priv,
2250 struct v4l2_register *reg) 2250 struct v4l2_dbg_register *reg)
2251{ 2251{
2252 struct saa7134_fh *fh = priv; 2252 struct saa7134_fh *fh = priv;
2253 struct saa7134_dev *dev = fh->dev; 2253 struct saa7134_dev *dev = fh->dev;
2254 2254
2255 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2255 if (!v4l2_chip_match_host(&reg->match))
2256 return -EINVAL; 2256 return -EINVAL;
2257 reg->val = saa_readb(reg->reg); 2257 reg->val = saa_readb(reg->reg);
2258 reg->size = 1;
2258 return 0; 2259 return 0;
2259} 2260}
2260 2261
2261static int vidioc_s_register (struct file *file, void *priv, 2262static int vidioc_s_register (struct file *file, void *priv,
2262 struct v4l2_register *reg) 2263 struct v4l2_dbg_register *reg)
2263{ 2264{
2264 struct saa7134_fh *fh = priv; 2265 struct saa7134_fh *fh = priv;
2265 struct saa7134_dev *dev = fh->dev; 2266 struct saa7134_dev *dev = fh->dev;
2266 2267
2267 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2268 if (!v4l2_chip_match_host(&reg->match))
2268 return -EINVAL; 2269 return -EINVAL;
2269 saa_writeb(reg->reg&0xffffff, reg->val); 2270 saa_writeb(reg->reg&0xffffff, reg->val);
2270 return 0; 2271 return 0;
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c
index 9befca65905e..454ad1dd7507 100644
--- a/drivers/media/video/saa717x.c
+++ b/drivers/media/video/saa717x.c
@@ -1171,25 +1171,26 @@ static int saa717x_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
1171} 1171}
1172 1172
1173#ifdef CONFIG_VIDEO_ADV_DEBUG 1173#ifdef CONFIG_VIDEO_ADV_DEBUG
1174static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1174static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1175{ 1175{
1176 struct i2c_client *client = v4l2_get_subdevdata(sd); 1176 struct i2c_client *client = v4l2_get_subdevdata(sd);
1177 1177
1178 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) 1178 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1179 return -EINVAL; 1179 return -EINVAL;
1180 if (!capable(CAP_SYS_ADMIN)) 1180 if (!capable(CAP_SYS_ADMIN))
1181 return -EPERM; 1181 return -EPERM;
1182 reg->val = saa717x_read(sd, reg->reg); 1182 reg->val = saa717x_read(sd, reg->reg);
1183 reg->size = 1;
1183 return 0; 1184 return 0;
1184} 1185}
1185 1186
1186static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1187static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1187{ 1188{
1188 struct i2c_client *client = v4l2_get_subdevdata(sd); 1189 struct i2c_client *client = v4l2_get_subdevdata(sd);
1189 u16 addr = reg->reg & 0xffff; 1190 u16 addr = reg->reg & 0xffff;
1190 u8 val = reg->val & 0xff; 1191 u8 val = reg->val & 0xff;
1191 1192
1192 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) 1193 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1193 return -EINVAL; 1194 return -EINVAL;
1194 if (!capable(CAP_SYS_ADMIN)) 1195 if (!capable(CAP_SYS_ADMIN))
1195 return -EPERM; 1196 return -EPERM;
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 9986e02bcf1a..fcb05f06de8f 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -699,7 +699,7 @@ static int soc_camera_s_crop(struct file *file, void *fh,
699} 699}
700 700
701static int soc_camera_g_chip_ident(struct file *file, void *fh, 701static int soc_camera_g_chip_ident(struct file *file, void *fh,
702 struct v4l2_chip_ident *id) 702 struct v4l2_dbg_chip_ident *id)
703{ 703{
704 struct soc_camera_file *icf = file->private_data; 704 struct soc_camera_file *icf = file->private_data;
705 struct soc_camera_device *icd = icf->icd; 705 struct soc_camera_device *icd = icf->icd;
@@ -712,7 +712,7 @@ static int soc_camera_g_chip_ident(struct file *file, void *fh,
712 712
713#ifdef CONFIG_VIDEO_ADV_DEBUG 713#ifdef CONFIG_VIDEO_ADV_DEBUG
714static int soc_camera_g_register(struct file *file, void *fh, 714static int soc_camera_g_register(struct file *file, void *fh,
715 struct v4l2_register *reg) 715 struct v4l2_dbg_register *reg)
716{ 716{
717 struct soc_camera_file *icf = file->private_data; 717 struct soc_camera_file *icf = file->private_data;
718 struct soc_camera_device *icd = icf->icd; 718 struct soc_camera_device *icd = icf->icd;
@@ -724,7 +724,7 @@ static int soc_camera_g_register(struct file *file, void *fh,
724} 724}
725 725
726static int soc_camera_s_register(struct file *file, void *fh, 726static int soc_camera_s_register(struct file *file, void *fh,
727 struct v4l2_register *reg) 727 struct v4l2_dbg_register *reg)
728{ 728{
729 struct soc_camera_file *icf = file->private_data; 729 struct soc_camera_file *icf = file->private_data;
730 struct soc_camera_device *icd = icf->icd; 730 struct soc_camera_device *icd = icf->icd;
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index d0c794da735b..5aeccb301cea 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1762,7 +1762,7 @@ static int tvaudio_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *fr
1762 return 0; 1762 return 0;
1763} 1763}
1764 1764
1765static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1765static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
1766{ 1766{
1767 struct i2c_client *client = v4l2_get_subdevdata(sd); 1767 struct i2c_client *client = v4l2_get_subdevdata(sd);
1768 1768
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index a388a9f0cb18..2cd64ef27b95 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -963,7 +963,7 @@ static int tvp5150_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
963 963
964 964
965static int tvp5150_g_chip_ident(struct v4l2_subdev *sd, 965static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
966 struct v4l2_chip_ident *chip) 966 struct v4l2_dbg_chip_ident *chip)
967{ 967{
968 int rev; 968 int rev;
969 struct i2c_client *client = v4l2_get_subdevdata(sd); 969 struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -977,25 +977,24 @@ static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
977 977
978 978
979#ifdef CONFIG_VIDEO_ADV_DEBUG 979#ifdef CONFIG_VIDEO_ADV_DEBUG
980static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 980static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
981{ 981{
982 struct i2c_client *client = v4l2_get_subdevdata(sd); 982 struct i2c_client *client = v4l2_get_subdevdata(sd);
983 983
984 if (!v4l2_chip_match_i2c_client(client, 984 if (!v4l2_chip_match_i2c_client(client, &reg->match))
985 reg->match_type, reg->match_chip))
986 return -EINVAL; 985 return -EINVAL;
987 if (!capable(CAP_SYS_ADMIN)) 986 if (!capable(CAP_SYS_ADMIN))
988 return -EPERM; 987 return -EPERM;
989 reg->val = tvp5150_read(sd, reg->reg & 0xff); 988 reg->val = tvp5150_read(sd, reg->reg & 0xff);
989 reg->size = 1;
990 return 0; 990 return 0;
991} 991}
992 992
993static int tvp5150_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 993static int tvp5150_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
994{ 994{
995 struct i2c_client *client = v4l2_get_subdevdata(sd); 995 struct i2c_client *client = v4l2_get_subdevdata(sd);
996 996
997 if (!v4l2_chip_match_i2c_client(client, 997 if (!v4l2_chip_match_i2c_client(client, &reg->match))
998 reg->match_type, reg->match_chip))
999 return -EINVAL; 998 return -EINVAL;
1000 if (!capable(CAP_SYS_ADMIN)) 999 if (!capable(CAP_SYS_ADMIN))
1001 return -EPERM; 1000 return -EPERM;
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index d5cdc4be1a35..52c0357faa5d 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -575,7 +575,7 @@ static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd)
575} 575}
576 576
577static int tw9910_get_chip_id(struct soc_camera_device *icd, 577static int tw9910_get_chip_id(struct soc_camera_device *icd,
578 struct v4l2_chip_ident *id) 578 struct v4l2_dbg_chip_ident *id)
579{ 579{
580 id->ident = V4L2_IDENT_TW9910; 580 id->ident = V4L2_IDENT_TW9910;
581 id->revision = 0; 581 id->revision = 0;
@@ -606,7 +606,7 @@ static int tw9910_enum_input(struct soc_camera_device *icd,
606 606
607#ifdef CONFIG_VIDEO_ADV_DEBUG 607#ifdef CONFIG_VIDEO_ADV_DEBUG
608static int tw9910_get_register(struct soc_camera_device *icd, 608static int tw9910_get_register(struct soc_camera_device *icd,
609 struct v4l2_register *reg) 609 struct v4l2_dbg_register *reg)
610{ 610{
611 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 611 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd);
612 int ret; 612 int ret;
@@ -627,7 +627,7 @@ static int tw9910_get_register(struct soc_camera_device *icd,
627} 627}
628 628
629static int tw9910_set_register(struct soc_camera_device *icd, 629static int tw9910_set_register(struct soc_camera_device *icd,
630 struct v4l2_register *reg) 630 struct v4l2_dbg_register *reg)
631{ 631{
632 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 632 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd);
633 633
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index 7a609a3a6dbe..4f16effb530f 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -147,7 +147,7 @@ static int upd64031a_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing
147 return upd64031a_s_frequency(sd, NULL); 147 return upd64031a_s_frequency(sd, NULL);
148} 148}
149 149
150static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 150static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
151{ 151{
152 struct i2c_client *client = v4l2_get_subdevdata(sd); 152 struct i2c_client *client = v4l2_get_subdevdata(sd);
153 153
@@ -162,25 +162,24 @@ static int upd64031a_log_status(struct v4l2_subdev *sd)
162} 162}
163 163
164#ifdef CONFIG_VIDEO_ADV_DEBUG 164#ifdef CONFIG_VIDEO_ADV_DEBUG
165static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 165static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
166{ 166{
167 struct i2c_client *client = v4l2_get_subdevdata(sd); 167 struct i2c_client *client = v4l2_get_subdevdata(sd);
168 168
169 if (!v4l2_chip_match_i2c_client(client, 169 if (!v4l2_chip_match_i2c_client(client, &reg->match))
170 reg->match_type, reg->match_chip))
171 return -EINVAL; 170 return -EINVAL;
172 if (!capable(CAP_SYS_ADMIN)) 171 if (!capable(CAP_SYS_ADMIN))
173 return -EPERM; 172 return -EPERM;
174 reg->val = upd64031a_read(sd, reg->reg & 0xff); 173 reg->val = upd64031a_read(sd, reg->reg & 0xff);
174 reg->size = 1;
175 return 0; 175 return 0;
176} 176}
177 177
178static int upd64031a_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 178static int upd64031a_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
179{ 179{
180 struct i2c_client *client = v4l2_get_subdevdata(sd); 180 struct i2c_client *client = v4l2_get_subdevdata(sd);
181 181
182 if (!v4l2_chip_match_i2c_client(client, 182 if (!v4l2_chip_match_i2c_client(client, &reg->match))
183 reg->match_type, reg->match_chip))
184 return -EINVAL; 183 return -EINVAL;
185 if (!capable(CAP_SYS_ADMIN)) 184 if (!capable(CAP_SYS_ADMIN))
186 return -EPERM; 185 return -EPERM;
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c
index 58412cb9c01a..4b712f69d1b7 100644
--- a/drivers/media/video/upd64083.c
+++ b/drivers/media/video/upd64083.c
@@ -120,25 +120,24 @@ static int upd64083_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing
120} 120}
121 121
122#ifdef CONFIG_VIDEO_ADV_DEBUG 122#ifdef CONFIG_VIDEO_ADV_DEBUG
123static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 123static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
124{ 124{
125 struct i2c_client *client = v4l2_get_subdevdata(sd); 125 struct i2c_client *client = v4l2_get_subdevdata(sd);
126 126
127 if (!v4l2_chip_match_i2c_client(client, 127 if (!v4l2_chip_match_i2c_client(client, &reg->match))
128 reg->match_type, reg->match_chip))
129 return -EINVAL; 128 return -EINVAL;
130 if (!capable(CAP_SYS_ADMIN)) 129 if (!capable(CAP_SYS_ADMIN))
131 return -EPERM; 130 return -EPERM;
132 reg->val = upd64083_read(sd, reg->reg & 0xff); 131 reg->val = upd64083_read(sd, reg->reg & 0xff);
132 reg->size = 1;
133 return 0; 133 return 0;
134} 134}
135 135
136static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 136static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
137{ 137{
138 struct i2c_client *client = v4l2_get_subdevdata(sd); 138 struct i2c_client *client = v4l2_get_subdevdata(sd);
139 139
140 if (!v4l2_chip_match_i2c_client(client, 140 if (!v4l2_chip_match_i2c_client(client, &reg->match))
141 reg->match_type, reg->match_chip))
142 return -EINVAL; 141 return -EINVAL;
143 if (!capable(CAP_SYS_ADMIN)) 142 if (!capable(CAP_SYS_ADMIN))
144 return -EPERM; 143 return -EPERM;
@@ -147,7 +146,7 @@ static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg
147} 146}
148#endif 147#endif
149 148
150static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 149static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
151{ 150{
152 struct i2c_client *client = v4l2_get_subdevdata(sd); 151 struct i2c_client *client = v4l2_get_subdevdata(sd);
153 152
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 7c61c6d5cede..2be5e47ed081 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -477,12 +477,12 @@ static int usbvision_v4l2_close(struct file *file)
477 */ 477 */
478#ifdef CONFIG_VIDEO_ADV_DEBUG 478#ifdef CONFIG_VIDEO_ADV_DEBUG
479static int vidioc_g_register (struct file *file, void *priv, 479static int vidioc_g_register (struct file *file, void *priv,
480 struct v4l2_register *reg) 480 struct v4l2_dbg_register *reg)
481{ 481{
482 struct usb_usbvision *usbvision = video_drvdata(file); 482 struct usb_usbvision *usbvision = video_drvdata(file);
483 int errCode; 483 int errCode;
484 484
485 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 485 if (!v4l2_chip_match_host(&reg->match))
486 return -EINVAL; 486 return -EINVAL;
487 /* NT100x has a 8-bit register space */ 487 /* NT100x has a 8-bit register space */
488 errCode = usbvision_read_reg(usbvision, reg->reg&0xff); 488 errCode = usbvision_read_reg(usbvision, reg->reg&0xff);
@@ -492,16 +492,17 @@ static int vidioc_g_register (struct file *file, void *priv,
492 return errCode; 492 return errCode;
493 } 493 }
494 reg->val = errCode; 494 reg->val = errCode;
495 reg->size = 1;
495 return 0; 496 return 0;
496} 497}
497 498
498static int vidioc_s_register (struct file *file, void *priv, 499static int vidioc_s_register (struct file *file, void *priv,
499 struct v4l2_register *reg) 500 struct v4l2_dbg_register *reg)
500{ 501{
501 struct usb_usbvision *usbvision = video_drvdata(file); 502 struct usb_usbvision *usbvision = video_drvdata(file);
502 int errCode; 503 int errCode;
503 504
504 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 505 if (!v4l2_chip_match_host(&reg->match))
505 return -EINVAL; 506 return -EINVAL;
506 /* NT100x has a 8-bit register space */ 507 /* NT100x has a 8-bit register space */
507 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); 508 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index c676b0b0f708..b8f2be8d5c0e 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -797,11 +797,11 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
797} 797}
798EXPORT_SYMBOL(v4l2_ctrl_next); 798EXPORT_SYMBOL(v4l2_ctrl_next);
799 799
800int v4l2_chip_match_host(u32 match_type, u32 match_chip) 800int v4l2_chip_match_host(const struct v4l2_dbg_match *match)
801{ 801{
802 switch (match_type) { 802 switch (match->type) {
803 case V4L2_CHIP_MATCH_HOST: 803 case V4L2_CHIP_MATCH_HOST:
804 return match_chip == 0; 804 return match->addr == 0;
805 default: 805 default:
806 return 0; 806 return 0;
807 } 807 }
@@ -809,23 +809,34 @@ int v4l2_chip_match_host(u32 match_type, u32 match_chip)
809EXPORT_SYMBOL(v4l2_chip_match_host); 809EXPORT_SYMBOL(v4l2_chip_match_host);
810 810
811#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) 811#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
812int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) 812int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match)
813{ 813{
814 switch (match_type) { 814 int len;
815
816 if (c == NULL || match == NULL)
817 return 0;
818
819 switch (match->type) {
815 case V4L2_CHIP_MATCH_I2C_DRIVER: 820 case V4L2_CHIP_MATCH_I2C_DRIVER:
816 return (c != NULL && c->driver != NULL && c->driver->id == match_chip); 821 if (c->driver == NULL || c->driver->driver.name == NULL)
822 return 0;
823 len = strlen(c->driver->driver.name);
824 /* legacy drivers have a ' suffix, don't try to match that */
825 if (len && c->driver->driver.name[len - 1] == '\'')
826 len--;
827 return len && !strncmp(c->driver->driver.name, match->name, len);
817 case V4L2_CHIP_MATCH_I2C_ADDR: 828 case V4L2_CHIP_MATCH_I2C_ADDR:
818 return (c != NULL && c->addr == match_chip); 829 return c->addr == match->addr;
819 default: 830 default:
820 return 0; 831 return 0;
821 } 832 }
822} 833}
823EXPORT_SYMBOL(v4l2_chip_match_i2c_client); 834EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
824 835
825int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, 836int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
826 u32 ident, u32 revision) 837 u32 ident, u32 revision)
827{ 838{
828 if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip)) 839 if (!v4l2_chip_match_i2c_client(c, &chip->match))
829 return 0; 840 return 0;
830 if (chip->ident == V4L2_IDENT_NONE) { 841 if (chip->ident == V4L2_IDENT_NONE) {
831 chip->ident = ident; 842 chip->ident = ident;
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index ec81b9737bd7..110376be5d2b 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -1046,7 +1046,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
1046 case VIDIOC_TRY_ENCODER_CMD: 1046 case VIDIOC_TRY_ENCODER_CMD:
1047 case VIDIOC_DBG_S_REGISTER: 1047 case VIDIOC_DBG_S_REGISTER:
1048 case VIDIOC_DBG_G_REGISTER: 1048 case VIDIOC_DBG_G_REGISTER:
1049 case VIDIOC_G_CHIP_IDENT: 1049 case VIDIOC_DBG_G_CHIP_IDENT:
1050 case VIDIOC_G_CHIP_IDENT_OLD:
1050 case VIDIOC_S_HW_FREQ_SEEK: 1051 case VIDIOC_S_HW_FREQ_SEEK:
1051 ret = do_video_ioctl(file, cmd, arg); 1052 ret = do_video_ioctl(file, cmd, arg);
1052 break; 1053 break;
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 8f629ef5b9ec..52d687b165e0 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -266,7 +266,7 @@ static const char *v4l2_ioctls[] = {
266 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", 266 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
267 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", 267 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
268 268
269 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT", 269 [_IOC_NR(VIDIOC_DBG_G_CHIP_IDENT)] = "VIDIOC_DBG_G_CHIP_IDENT",
270 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK", 270 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK",
271#endif 271#endif
272}; 272};
@@ -1720,7 +1720,7 @@ static long __video_do_ioctl(struct file *file,
1720#ifdef CONFIG_VIDEO_ADV_DEBUG 1720#ifdef CONFIG_VIDEO_ADV_DEBUG
1721 case VIDIOC_DBG_G_REGISTER: 1721 case VIDIOC_DBG_G_REGISTER:
1722 { 1722 {
1723 struct v4l2_register *p = arg; 1723 struct v4l2_dbg_register *p = arg;
1724 1724
1725 if (!capable(CAP_SYS_ADMIN)) 1725 if (!capable(CAP_SYS_ADMIN))
1726 ret = -EPERM; 1726 ret = -EPERM;
@@ -1730,7 +1730,7 @@ static long __video_do_ioctl(struct file *file,
1730 } 1730 }
1731 case VIDIOC_DBG_S_REGISTER: 1731 case VIDIOC_DBG_S_REGISTER:
1732 { 1732 {
1733 struct v4l2_register *p = arg; 1733 struct v4l2_dbg_register *p = arg;
1734 1734
1735 if (!capable(CAP_SYS_ADMIN)) 1735 if (!capable(CAP_SYS_ADMIN))
1736 ret = -EPERM; 1736 ret = -EPERM;
@@ -1739,9 +1739,9 @@ static long __video_do_ioctl(struct file *file,
1739 break; 1739 break;
1740 } 1740 }
1741#endif 1741#endif
1742 case VIDIOC_G_CHIP_IDENT: 1742 case VIDIOC_DBG_G_CHIP_IDENT:
1743 { 1743 {
1744 struct v4l2_chip_ident *p = arg; 1744 struct v4l2_dbg_chip_ident *p = arg;
1745 1745
1746 if (!ops->vidioc_g_chip_ident) 1746 if (!ops->vidioc_g_chip_ident)
1747 break; 1747 break;
@@ -1750,6 +1750,11 @@ static long __video_do_ioctl(struct file *file,
1750 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); 1750 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
1751 break; 1751 break;
1752 } 1752 }
1753 case VIDIOC_G_CHIP_IDENT_OLD:
1754 printk(KERN_ERR "VIDIOC_G_CHIP_IDENT has been deprecated and will disappear in 2.6.30.\n");
1755 printk(KERN_ERR "It is a debugging ioctl and must not be used in applications!\n");
1756 return -EINVAL;
1757
1753 case VIDIOC_S_HW_FREQ_SEEK: 1758 case VIDIOC_S_HW_FREQ_SEEK:
1754 { 1759 {
1755 struct v4l2_hw_freq_seek *p = arg; 1760 struct v4l2_hw_freq_seek *p = arg;
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index e3612f29d0df..fbe9cc0d433a 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -37,7 +37,7 @@ int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg)
37 return v4l2_subdev_call(sd, core, queryctrl, arg); 37 return v4l2_subdev_call(sd, core, queryctrl, arg);
38 case VIDIOC_LOG_STATUS: 38 case VIDIOC_LOG_STATUS:
39 return v4l2_subdev_call(sd, core, log_status); 39 return v4l2_subdev_call(sd, core, log_status);
40 case VIDIOC_G_CHIP_IDENT: 40 case VIDIOC_DBG_G_CHIP_IDENT:
41 return v4l2_subdev_call(sd, core, g_chip_ident, arg); 41 return v4l2_subdev_call(sd, core, g_chip_ident, arg);
42 case VIDIOC_INT_S_STANDBY: 42 case VIDIOC_INT_S_STANDBY:
43 return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0); 43 return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0);
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c
index f72b859486ad..5d73f66d9f55 100644
--- a/drivers/media/video/vp27smpx.c
+++ b/drivers/media/video/vp27smpx.c
@@ -113,7 +113,7 @@ static int vp27smpx_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
113 return 0; 113 return 0;
114} 114}
115 115
116static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 116static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
117{ 117{
118 struct i2c_client *client = v4l2_get_subdevdata(sd); 118 struct i2c_client *client = v4l2_get_subdevdata(sd);
119 119
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index 12a31e7a5f6d..f2864d5cd180 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -233,7 +233,7 @@ static int wm8739_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
233 return -EINVAL; 233 return -EINVAL;
234} 234}
235 235
236static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 236static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
237{ 237{
238 struct i2c_client *client = v4l2_get_subdevdata(sd); 238 struct i2c_client *client = v4l2_get_subdevdata(sd);
239 239
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index d0220b0ec0bc..53fcd42843e0 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -130,7 +130,7 @@ static int wm8775_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
130 return 0; 130 return 0;
131} 131}
132 132
133static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 133static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
134{ 134{
135 struct i2c_client *client = v4l2_get_subdevdata(sd); 135 struct i2c_client *client = v4l2_get_subdevdata(sd);
136 136