V4L/DVB (7558): videobuf: Improve command output for debug purposes
authorMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 13 Apr 2008 18:06:24 +0000 (15:06 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:08:48 +0000 (14:08 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/ivtv/ivtv-ioctl.c
drivers/media/video/pwc/pwc-v4l.c
drivers/media/video/videodev.c

index 1beb296a17635eae7e107dbc1aae2a139a67f793..90f59c4155aef9b8a8d680bbe38dd527ea1b4c32 100644 (file)
@@ -1632,6 +1632,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
                if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
                        printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
                        v4l_printk_ioctl(cmd);
+                       printk("\n");
                }
                return ivtv_debug_ioctls(filp, cmd, arg);
 
@@ -1675,6 +1676,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
                if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
                        printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
                        v4l_printk_ioctl(cmd);
+                       printk("\n");
                }
                return ivtv_v4l2_ioctls(itv, filp, cmd, arg);
 
@@ -1688,6 +1690,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
                if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
                        printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
                        v4l_printk_ioctl(cmd);
+                       printk("\n");
                }
                return ivtv_control_ioctls(itv, cmd, arg);
 
index 32fbe1ae62519c30d595b545c53e3320a8621f44..1742889874df08c6f944b4b066fa1111fcff2e4a 100644 (file)
@@ -351,8 +351,10 @@ int pwc_video_do_ioctl(struct inode *inode, struct file *file,
                return -EFAULT;
 
 #ifdef CONFIG_USB_PWC_DEBUG
-       if (PWC_DEBUG_LEVEL_IOCTL & pwc_trace)
+       if (PWC_DEBUG_LEVEL_IOCTL & pwc_trace) {
                v4l_printk_ioctl(cmd);
+               printk("\n");
+       }
 #endif
 
 
index 0bf056622d6a89449f28ed2cbf3fb03d761c8d1b..4c4ee566d25788ac01302738854d1477434ebc29 100644 (file)
@@ -18,9 +18,9 @@
 
 #define dbgarg(cmd, fmt, arg...) \
                if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {                \
-                       printk (KERN_DEBUG "%s: ",  vfd->name);         \
+                       printk(KERN_DEBUG "%s: ",  vfd->name);          \
                        v4l_printk_ioctl(cmd);                          \
-                       printk (KERN_DEBUG "%s: " fmt, vfd->name, ## arg); \
+                       printk(" " fmt,  ## arg);                       \
                }
 
 #define dbgarg2(fmt, arg...) \
@@ -378,38 +378,45 @@ static const char *v4l2_int_ioctls[] = {
    external ioctl messages as well as internal V4L ioctl */
 void v4l_printk_ioctl(unsigned int cmd)
 {
-       char *dir;
+       char *dir, *type;
 
-       switch (_IOC_DIR(cmd)) {
-       case _IOC_NONE:              dir = "--"; break;
-       case _IOC_READ:              dir = "r-"; break;
-       case _IOC_WRITE:             dir = "-w"; break;
-       case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
-       default:                     dir = "*ERR*"; break;
-       }
        switch (_IOC_TYPE(cmd)) {
        case 'd':
-               printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n",
-                      (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
-                      v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
-               break;
+               if (_IOC_NR(cmd) >= V4L2_INT_IOCTLS) {
+                       type = "v4l2_int";
+                       break;
+               }
+               printk("%s", v4l2_int_ioctls[_IOC_NR(cmd)]);
+               return;
 #ifdef CONFIG_VIDEO_V4L1_COMPAT
        case 'v':
-               printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
-                      (_IOC_NR(cmd) < V4L1_IOCTLS) ?
-                      v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
-               break;
+               if (_IOC_NR(cmd) >= V4L1_IOCTLS) {
+                       type = "v4l1";
+                       break;
+               }
+               printk("%s", v4l1_ioctls[_IOC_NR(cmd)]);
+               return;
 #endif
        case 'V':
-               printk("v4l2 ioctl %s, dir=%s (0x%08x)\n",
-                      (_IOC_NR(cmd) < V4L2_IOCTLS) ?
-                      v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
-               break;
-
+               if (_IOC_NR(cmd) >= V4L2_IOCTLS) {
+                       type = "v4l2";
+                       break;
+               }
+               printk("%s", v4l2_ioctls[_IOC_NR(cmd)]);
+               return;
        default:
-               printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n",
-                      _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
+               type = "unknown";
+       }
+
+       switch (_IOC_DIR(cmd)) {
+       case _IOC_NONE:              dir = "--"; break;
+       case _IOC_READ:              dir = "r-"; break;
+       case _IOC_WRITE:             dir = "-w"; break;
+       case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
+       default:                     dir = "*ERR*"; break;
        }
+       printk("%s ioctl '%c', dir=%s, #%d (0x%08x)",
+               type, _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
 }
 EXPORT_SYMBOL(v4l_printk_ioctl);