aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c14
-rw-r--r--drivers/media/video/saa7115.c14
-rw-r--r--drivers/media/video/saa7127.c14
-rw-r--r--drivers/media/video/tvp5150.c14
-rw-r--r--drivers/media/video/upd64031a.c16
-rw-r--r--drivers/media/video/upd64083.c16
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c40
-rw-r--r--drivers/media/video/videodev.c4
8 files changed, 41 insertions, 91 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 6515b2a78417..923577723297 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -629,15 +629,6 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
629 /* ioctls to allow direct access to the 629 /* ioctls to allow direct access to the
630 * cx25840 registers for testing */ 630 * cx25840 registers for testing */
631 case VIDIOC_DBG_G_REGISTER: 631 case VIDIOC_DBG_G_REGISTER:
632 {
633 struct v4l2_register *reg = arg;
634
635 if (reg->i2c_id != I2C_DRIVERID_CX25840)
636 return -EINVAL;
637 reg->val = cx25840_read(client, reg->reg & 0x0fff);
638 break;
639 }
640
641 case VIDIOC_DBG_S_REGISTER: 632 case VIDIOC_DBG_S_REGISTER:
642 { 633 {
643 struct v4l2_register *reg = arg; 634 struct v4l2_register *reg = arg;
@@ -646,7 +637,10 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
646 return -EINVAL; 637 return -EINVAL;
647 if (!capable(CAP_SYS_ADMIN)) 638 if (!capable(CAP_SYS_ADMIN))
648 return -EPERM; 639 return -EPERM;
649 cx25840_write(client, reg->reg & 0x0fff, reg->val & 0xff); 640 if (cmd == VIDIOC_DBG_G_REGISTER)
641 reg->val = cx25840_read(client, reg->reg & 0x0fff);
642 else
643 cx25840_write(client, reg->reg & 0x0fff, reg->val & 0xff);
650 break; 644 break;
651 } 645 }
652#endif 646#endif
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index bb6aa135002a..71777216b607 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1418,15 +1418,6 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar
1418 1418
1419#ifdef CONFIG_VIDEO_ADV_DEBUG 1419#ifdef CONFIG_VIDEO_ADV_DEBUG
1420 case VIDIOC_DBG_G_REGISTER: 1420 case VIDIOC_DBG_G_REGISTER:
1421 {
1422 struct v4l2_register *reg = arg;
1423
1424 if (reg->i2c_id != I2C_DRIVERID_SAA711X)
1425 return -EINVAL;
1426 reg->val = saa711x_read(client, reg->reg & 0xff);
1427 break;
1428 }
1429
1430 case VIDIOC_DBG_S_REGISTER: 1421 case VIDIOC_DBG_S_REGISTER:
1431 { 1422 {
1432 struct v4l2_register *reg = arg; 1423 struct v4l2_register *reg = arg;
@@ -1435,7 +1426,10 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar
1435 return -EINVAL; 1426 return -EINVAL;
1436 if (!capable(CAP_SYS_ADMIN)) 1427 if (!capable(CAP_SYS_ADMIN))
1437 return -EPERM; 1428 return -EPERM;
1438 saa711x_write(client, reg->reg & 0xff, reg->val & 0xff); 1429 if (cmd == VIDIOC_DBG_G_REGISTER)
1430 reg->val = saa711x_read(client, reg->reg & 0xff);
1431 else
1432 saa711x_write(client, reg->reg & 0xff, reg->val & 0xff);
1439 break; 1433 break;
1440 } 1434 }
1441#endif 1435#endif
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index 304375ade4a9..bd9c4f3ad02e 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -615,15 +615,6 @@ static int saa7127_command(struct i2c_client *client,
615 615
616#ifdef CONFIG_VIDEO_ADV_DEBUG 616#ifdef CONFIG_VIDEO_ADV_DEBUG
617 case VIDIOC_DBG_G_REGISTER: 617 case VIDIOC_DBG_G_REGISTER:
618 {
619 struct v4l2_register *reg = arg;
620
621 if (reg->i2c_id != I2C_DRIVERID_SAA7127)
622 return -EINVAL;
623 reg->val = saa7127_read(client, reg->reg & 0xff);
624 break;
625 }
626
627 case VIDIOC_DBG_S_REGISTER: 618 case VIDIOC_DBG_S_REGISTER:
628 { 619 {
629 struct v4l2_register *reg = arg; 620 struct v4l2_register *reg = arg;
@@ -632,7 +623,10 @@ static int saa7127_command(struct i2c_client *client,
632 return -EINVAL; 623 return -EINVAL;
633 if (!capable(CAP_SYS_ADMIN)) 624 if (!capable(CAP_SYS_ADMIN))
634 return -EPERM; 625 return -EPERM;
635 saa7127_write(client, reg->reg & 0xff, reg->val & 0xff); 626 if (cmd == VIDIOC_DBG_G_REGISTER)
627 reg->val = saa7127_read(client, reg->reg & 0xff);
628 else
629 saa7127_write(client, reg->reg & 0xff, reg->val & 0xff);
636 break; 630 break;
637 } 631 }
638#endif 632#endif
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 65d4389690a0..886b5df7c9d1 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -951,15 +951,6 @@ static int tvp5150_command(struct i2c_client *c,
951 951
952#ifdef CONFIG_VIDEO_ADV_DEBUG 952#ifdef CONFIG_VIDEO_ADV_DEBUG
953 case VIDIOC_DBG_G_REGISTER: 953 case VIDIOC_DBG_G_REGISTER:
954 {
955 struct v4l2_register *reg = arg;
956
957 if (reg->i2c_id != I2C_DRIVERID_TVP5150)
958 return -EINVAL;
959 reg->val = tvp5150_read(c, reg->reg & 0xff);
960 break;
961 }
962
963 case VIDIOC_DBG_S_REGISTER: 954 case VIDIOC_DBG_S_REGISTER:
964 { 955 {
965 struct v4l2_register *reg = arg; 956 struct v4l2_register *reg = arg;
@@ -968,7 +959,10 @@ static int tvp5150_command(struct i2c_client *c,
968 return -EINVAL; 959 return -EINVAL;
969 if (!capable(CAP_SYS_ADMIN)) 960 if (!capable(CAP_SYS_ADMIN))
970 return -EPERM; 961 return -EPERM;
971 tvp5150_write(c, reg->reg & 0xff, reg->val & 0xff); 962 if (cmd == VIDIOC_DBG_G_REGISTER)
963 reg->val = tvp5150_read(c, reg->reg & 0xff);
964 else
965 tvp5150_write(c, reg->reg & 0xff, reg->val & 0xff);
972 break; 966 break;
973 } 967 }
974#endif 968#endif
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index 0eee82ba52bc..b3b5fd536dc3 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -163,26 +163,18 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *
163 163
164#ifdef CONFIG_VIDEO_ADV_DEBUG 164#ifdef CONFIG_VIDEO_ADV_DEBUG
165 case VIDIOC_DBG_G_REGISTER: 165 case VIDIOC_DBG_G_REGISTER:
166 {
167 struct v4l2_register *reg = arg;
168
169 if (reg->i2c_id != I2C_DRIVERID_UPD64031A)
170 return -EINVAL;
171 reg->val = upd64031a_read(client, reg->reg & 0xff);
172 break;
173 }
174
175 case VIDIOC_DBG_S_REGISTER: 166 case VIDIOC_DBG_S_REGISTER:
176 { 167 {
177 struct v4l2_register *reg = arg; 168 struct v4l2_register *reg = arg;
178 u8 addr = reg->reg & 0xff;
179 u8 val = reg->val & 0xff;
180 169
181 if (reg->i2c_id != I2C_DRIVERID_UPD64031A) 170 if (reg->i2c_id != I2C_DRIVERID_UPD64031A)
182 return -EINVAL; 171 return -EINVAL;
183 if (!capable(CAP_SYS_ADMIN)) 172 if (!capable(CAP_SYS_ADMIN))
184 return -EPERM; 173 return -EPERM;
185 upd64031a_write(client, addr, val); 174 if (cmd == VIDIOC_DBG_G_REGISTER)
175 reg->val = upd64031a_read(client, reg->reg & 0xff);
176 else
177 upd64031a_write(client, reg->reg & 0xff, reg->val & 0xff);
186 break; 178 break;
187 } 179 }
188#endif 180#endif
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c
index 3f0eec0cdb45..8852903e7a92 100644
--- a/drivers/media/video/upd64083.c
+++ b/drivers/media/video/upd64083.c
@@ -140,26 +140,18 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a
140 140
141#ifdef CONFIG_VIDEO_ADV_DEBUG 141#ifdef CONFIG_VIDEO_ADV_DEBUG
142 case VIDIOC_DBG_G_REGISTER: 142 case VIDIOC_DBG_G_REGISTER:
143 {
144 struct v4l2_register *reg = arg;
145
146 if (reg->i2c_id != I2C_DRIVERID_UPD64083)
147 return -EINVAL;
148 reg->val = upd64083_read(client, reg->reg & 0xff);
149 break;
150 }
151
152 case VIDIOC_DBG_S_REGISTER: 143 case VIDIOC_DBG_S_REGISTER:
153 { 144 {
154 struct v4l2_register *reg = arg; 145 struct v4l2_register *reg = arg;
155 u8 addr = reg->reg & 0xff;
156 u8 val = reg->val & 0xff;
157 146
158 if (reg->i2c_id != I2C_DRIVERID_UPD64083) 147 if (reg->i2c_id != I2C_DRIVERID_UPD64083)
159 return -EINVAL; 148 return -EINVAL;
160 if (!capable(CAP_SYS_ADMIN)) 149 if (!capable(CAP_SYS_ADMIN))
161 return -EPERM; 150 return -EPERM;
162 upd64083_write(client, addr, val); 151 if (cmd == VIDIOC_DBG_G_REGISTER)
152 reg->val = upd64083_read(client, reg->reg & 0xff);
153 else
154 upd64083_write(client, reg->reg & 0xff, reg->val & 0xff);
163 break; 155 break;
164 } 156 }
165#endif 157#endif
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index b6fabeeb8ab8..6a61ebcdf130 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -520,25 +520,6 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file,
520#ifdef CONFIG_VIDEO_ADV_DEBUG 520#ifdef CONFIG_VIDEO_ADV_DEBUG
521 /* ioctls to allow direct acces to the NT100x registers */ 521 /* ioctls to allow direct acces to the NT100x registers */
522 case VIDIOC_DBG_G_REGISTER: 522 case VIDIOC_DBG_G_REGISTER:
523 {
524 struct v4l2_register *reg = arg;
525 int errCode;
526
527 if (reg->i2c_id != 0)
528 return -EINVAL;
529 /* NT100x has a 8-bit register space */
530 errCode = usbvision_read_reg(usbvision, reg->reg&0xff);
531 if (errCode < 0) {
532 err("%s: VIDIOC_DBG_G_REGISTER failed: error %d", __FUNCTION__, errCode);
533 }
534 else {
535 reg->val=(unsigned char)errCode;
536 PDEBUG(DBG_IOCTL, "VIDIOC_DBG_G_REGISTER reg=0x%02X, value=0x%02X",
537 (unsigned int)reg->reg, reg->val);
538 errCode = 0; // No error
539 }
540 return errCode;
541 }
542 case VIDIOC_DBG_S_REGISTER: 523 case VIDIOC_DBG_S_REGISTER:
543 { 524 {
544 struct v4l2_register *reg = arg; 525 struct v4l2_register *reg = arg;
@@ -548,15 +529,22 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file,
548 return -EINVAL; 529 return -EINVAL;
549 if (!capable(CAP_SYS_ADMIN)) 530 if (!capable(CAP_SYS_ADMIN))
550 return -EPERM; 531 return -EPERM;
551 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); 532 /* NT100x has a 8-bit register space */
533 if (cmd == VIDIOC_DBG_G_REGISTER)
534 errCode = usbvision_read_reg(usbvision, reg->reg&0xff);
535 else
536 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
552 if (errCode < 0) { 537 if (errCode < 0) {
553 err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", __FUNCTION__, errCode); 538 err("%s: VIDIOC_DBG_%c_REGISTER failed: error %d", __FUNCTION__,
554 } 539 cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', errCode);
555 else { 540 return errCode;
556 PDEBUG(DBG_IOCTL, "VIDIOC_DBG_S_REGISTER reg=0x%02X, value=0x%02X",
557 (unsigned int)reg->reg, reg->val);
558 errCode = 0;
559 } 541 }
542 if (cmd == VIDIOC_DBG_S_REGISTER)
543 reg->val = (u8)errCode;
544
545 PDEBUG(DBG_IOCTL, "VIDIOC_DBG_%c_REGISTER reg=0x%02X, value=0x%02X",
546 cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S',
547 (unsigned int)reg->reg, reg->val);
560 return 0; 548 return 0;
561 } 549 }
562#endif 550#endif
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 764a53b70db2..dc9b1ef678aa 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -1457,7 +1457,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1457 case VIDIOC_DBG_G_REGISTER: 1457 case VIDIOC_DBG_G_REGISTER:
1458 { 1458 {
1459 struct v4l2_register *p=arg; 1459 struct v4l2_register *p=arg;
1460 if (vfd->vidioc_g_register) 1460 if (!capable(CAP_SYS_ADMIN))
1461 ret=-EPERM;
1462 else if (vfd->vidioc_g_register)
1461 ret=vfd->vidioc_g_register(file, fh, p); 1463 ret=vfd->vidioc_g_register(file, fh, p);
1462 break; 1464 break;
1463 } 1465 }