]> err.no Git - linux-2.6/commitdiff
V4L/DVB (5175): Pvrusb2: VIDIOC_DBG_[S|G]_REGISTER fixups
authorMike Isely <isely@pobox.com>
Sun, 28 Jan 2007 19:08:36 +0000 (16:08 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 21 Feb 2007 15:35:13 +0000 (13:35 -0200)
Support 64 bit register IDs internally.  Only allow root access to
this API (for both set and get).  Note that actual 64 bit access only
becomes possible once the definition for v4l2_register is updated, but
this change clears the way for it from the viewpoint of the pvrusb2
driver.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/pvrusb2/pvrusb2-hdw.c
drivers/media/video/pvrusb2/pvrusb2-hdw.h
drivers/media/video/pvrusb2/pvrusb2-v4l2.c

index 8ba72968639b3d0a8f86314096e8865d45d591b0..40b2f2a6d3cc88c9e185bc7752dd06b30ae3f17a 100644 (file)
@@ -3253,7 +3253,7 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
 
 
 int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
-                            u32 chip_id, u32 reg_id,
+                            u32 chip_id, u64 reg_id,
                             int setFl,u32 *val_ptr)
 {
 #ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -3263,6 +3263,8 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
        int stat = 0;
        int okFl = 0;
 
+       if (!capable(CAP_SYS_ADMIN)) return -EPERM;
+
        req.i2c_id = chip_id;
        req.reg = reg_id;
        if (setFl) req.val = *val_ptr;
index e6df8e4a7fe04ea9aeec3f0e95db858ddc8dd106..566a8ef7e1216abbdf9b33ad8041a8c0dccd70dc 100644 (file)
@@ -222,7 +222,7 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
    setFl   - true to set the register, false to read it
    val_ptr - storage location for source / result. */
 int pvr2_hdw_register_access(struct pvr2_hdw *,
-                            u32 chip_id,u32 reg_id,
+                            u32 chip_id,u64 reg_id,
                             int setFl,u32 *val_ptr);
 
 /* The following entry points are all lower level things you normally don't
index 024b6d80ea0acc438a2a3b88f6155d7aa6371123..4fe4136204c7bc443776fec9ebe69c976a2a1523 100644 (file)
@@ -738,10 +738,6 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
        }
 #ifdef CONFIG_VIDEO_ADV_DEBUG
        case VIDIOC_DBG_S_REGISTER:
-               if (!capable(CAP_SYS_ADMIN)) {
-                       ret = -EPERM;
-                       break;
-               } /* fall through */
        case VIDIOC_DBG_G_REGISTER:
        {
                u32 val;