aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videodev.c
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-01-23 20:38:13 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:55 -0500
commit52ebc763d8e0c9f2ab48af89a75e90e2318bac86 (patch)
tree5699ff9425fb1da30a18b00661fcea659ace6a72 /drivers/media/video/videodev.c
parentdbbff48f39263f7e5c96a55624da87879de2bf71 (diff)
V4L/DVB (5146): Make VIDIOC_INT_[SG]_REGISTER ioctls no longer internal only
The direct register access ioctls were defined as kernel internal only, but they are very useful for debugging hardware from userspace and are used as such. Officially export them. VIDIOC_INT_[SG]_REGISTER is renamed to VIDIOC_DBG_[SG]_REGISTER Definition of ioctl and struct v4l2_register is moved from v4l2-common.h to videodev2.h. Types used in struct v4l2_register are changed to the userspace exportable versions (u32 -> __u32, etc). Use of VIDIOC_DBG_S_REGISTER requires CAP_SYS_ADMIN permission, so move the check into the video_ioctl2() dispatcher so it doesn't need to be duplicated in each driver's call-back function. CAP_SYS_ADMIN check is added to pvrusb2 (which doesn't use video_ioctl2). Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/videodev.c')
-rw-r--r--drivers/media/video/videodev.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 4b5d5f771e4c..764a53b70db2 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -1454,17 +1454,19 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1454 break; 1454 break;
1455 } 1455 }
1456#ifdef CONFIG_VIDEO_ADV_DEBUG 1456#ifdef CONFIG_VIDEO_ADV_DEBUG
1457 case VIDIOC_INT_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 (vfd->vidioc_g_register)
1461 ret=vfd->vidioc_g_register(file, fh, p); 1461 ret=vfd->vidioc_g_register(file, fh, p);
1462 break; 1462 break;
1463 } 1463 }
1464 case VIDIOC_INT_S_REGISTER: 1464 case VIDIOC_DBG_S_REGISTER:
1465 { 1465 {
1466 struct v4l2_register *p=arg; 1466 struct v4l2_register *p=arg;
1467 if (vfd->vidioc_s_register) 1467 if (!capable(CAP_SYS_ADMIN))
1468 ret=-EPERM;
1469 else if (vfd->vidioc_s_register)
1468 ret=vfd->vidioc_s_register(file, fh, p); 1470 ret=vfd->vidioc_s_register(file, fh, p);
1469 break; 1471 break;
1470 } 1472 }