Re: [PATCH] media: vb2: Print the queue pointer in debug messages
Hi Laurent, I love your patch! Perhaps something to improve: [auto build test WARNING on linuxtv-media/master] [also build test WARNING on v4.17-rc2 next-20180426] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Laurent-Pinchart/media-vb2-Print-the-queue-pointer-in-debug-messages/20180428-184113 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-a1-201816 (attached as .config) compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/media/common/videobuf2/videobuf2-core.c: In function '__vb2_buf_mem_alloc': >> drivers/media/common/videobuf2/videobuf2-core.c:72:9: warning: format '%p' >> expects argument of type 'void *', but argument 4 has type 'unsigned int' >> [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:210:14: note: in expansion of macro 'call_ptr_memop' mem_priv = call_ptr_memop(vb, alloc, ^ >> drivers/media/common/videobuf2/videobuf2-core.c:72:9: warning: format '%d' >> expects argument of type 'int', but argument 5 has type 'char *' [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:210:14: note: in expansion of macro 'call_ptr_memop' mem_priv = call_ptr_memop(vb, alloc, ^ >> drivers/media/common/videobuf2/videobuf2-core.c:72:9: warning: format '%s' >> expects a matching 'char *' argument [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:210:14: note: in expansion of macro 'call_ptr_memop' mem_priv = call_ptr_memop(vb, alloc, ^ drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%p' expects argument of type 'void *', but argument 4 has type 'unsigned int' [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:227:3: note: in expansion of macro 'call_void_memop' call_void_memop(vb, put, vb->planes[plane - 1].mem_priv); ^ drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%d' expects argument of type 'int', but argument 5 has type 'char *' [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:227:3: note: in expansion of macro 'call_void_memop' call_void_memop(vb, put, vb->planes[plane - 1].mem_priv); ^ drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%s' expects a matching 'char *' argument [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:227:3: note: in expansion of macro 'call_void_memop' call_void_memop(vb, put, vb->planes[plane - 1].mem_priv); ^ drivers/media/common/videobuf2/videobuf2-core.c: In function '__vb2_buf_mem_free': drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%p' expects argument of type 'void *', but argument 4 has type 'unsigned int' [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:242:3: note: in expansion of macro 'call_void_memop' call_void_memop(vb, put, vb->planes[plane].mem_priv); ^ drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%d' expects argument of type 'int', but argument 5 has type 'char *' [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:242:3: note: in expansion of macro 'call_void_memop' call_void_memop(vb, put, vb->planes[plane].mem_priv); ^ drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%s' expects a matching 'char *' argument [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:242:3: note: in expansion of macro 'call_void_memop' call_void_memop(vb, put, vb->planes[plane].mem_priv); ^ drivers/media/common/videobuf2/videobuf2-core.c: In function '__vb2_buf_userptr_put': drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%p' expects argument of type 'void *', but argument 4 has type 'unsigned int' [-Wformat=] struct vb2_queue *_q = (vb)->vb2_queue;\ ^ drivers/media/common/videobuf2/videobuf2-core.c:259:4: note: in expansion of macro 'call_void_memop' call_void_memop(vb, put_userptr, vb->planes[plane].mem_priv); ^ drivers/media/common/videobuf2/videobuf2-core.c:84:9: warning: format '%d' expects argument of type 'int', but argument 5 has type 'char *'
Re: [PATCH] media: vb2: Print the queue pointer in debug messages
Hi Laurent, I love your patch! Perhaps something to improve: [auto build test WARNING on linuxtv-media/master] [also build test WARNING on v4.17-rc2 next-20180426] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Laurent-Pinchart/media-vb2-Print-the-queue-pointer-in-debug-messages/20180428-184113 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-x014-201816 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): In file included from include/linux/printk.h:7:0, from include/linux/kernel.h:14, from drivers/media//common/videobuf2/videobuf2-core.c:20: drivers/media//common/videobuf2/videobuf2-core.c: In function '__vb2_buf_mem_alloc': >> include/linux/kern_levels.h:5:18: warning: format '%p' expects argument of >> type 'void *', but argument 4 has type 'unsigned int' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ >> drivers/media//common/videobuf2/videobuf2-core.c:40:4: note: in expansion of >> macro 'pr_info' pr_info("(q=%p) %s: " fmt, q, __func__, ## arg);\ ^~~ >> drivers/media//common/videobuf2/videobuf2-core.c:54:2: note: in expansion of >> macro 'dprintk' dprintk((vb)->vb2_queue, 2, "call_memop(%p, %d, %s)%s\n", \ ^~~ >> drivers/media//common/videobuf2/videobuf2-core.c:75:2: note: in expansion of >> macro 'log_memop' log_memop(vb, op); \ ^ >> drivers/media//common/videobuf2/videobuf2-core.c:210:14: note: in expansion >> of macro 'call_ptr_memop' mem_priv = call_ptr_memop(vb, alloc, ^~ >> include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of >> type 'int', but argument 5 has type 'char *' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ >> drivers/media//common/videobuf2/videobuf2-core.c:40:4: note: in expansion of >> macro 'pr_info' pr_info("(q=%p) %s: " fmt, q, __func__, ## arg);\ ^~~ >> drivers/media//common/videobuf2/videobuf2-core.c:54:2: note: in expansion of >> macro 'dprintk' dprintk((vb)->vb2_queue, 2, "call_memop(%p, %d, %s)%s\n", \ ^~~ >> drivers/media//common/videobuf2/videobuf2-core.c:75:2: note: in expansion of >> macro 'log_memop' log_memop(vb, op); \ ^ >> drivers/media//common/videobuf2/videobuf2-core.c:210:14: note: in expansion >> of macro 'call_ptr_memop' mem_priv = call_ptr_memop(vb, alloc, ^~ include/linux/kern_levels.h:5:18: warning: format '%s' expects a matching 'char *' argument [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ >> drivers/media//common/videobuf2/videobuf2-core.c:40:4: note: in expansion of >> macro 'pr_info' pr_info("(q=%p) %s: " fmt, q, __func__, ## arg);\ ^~~ >> drivers/media//common/videobuf2/videobuf2-core.c:54:2: note: in expansion of >> macro 'dprintk' dprintk((vb)->vb2_queue, 2, "call_memop(%p, %d, %s)%s\n", \ ^~~ >> drivers/media//common/videobuf2/videobuf2-core.c:75:2: note: in expansion of >> macro 'log_memop' log_memop(vb, op); \ ^ >> drivers/media//common/videobuf2/videobuf2-core.c:210:14: note: in expansion >> of macro 'call_ptr_memop' mem_priv = call_ptr_memop(vb, alloc, ^~ >> include/linux/kern_levels.h:5:18: warning: format '%p' expects argument of >> type 'void *', but argument 4 has type 'unsigned int' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:311:9: note: in
[PATCH] media: vb2: Print the queue pointer in debug messages
When debugging issues that involve more than one video queue, messages related to multiple queues get interleaved without any easy way to tell which queue they relate to. Fix this by printing the queue pointer for all debug messages in the vb2 core and V4L2 layers. Signed-off-by: Laurent Pinchart--- drivers/media/common/videobuf2/videobuf2-core.c | 193 drivers/media/common/videobuf2/videobuf2-v4l2.c | 39 ++--- 2 files changed, 118 insertions(+), 114 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index d3f7bb33a54d..e35e79c32550 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -34,10 +34,10 @@ static int debug; module_param(debug, int, 0644); -#define dprintk(level, fmt, arg...)\ - do {\ - if (debug >= level) \ - pr_info("%s: " fmt, __func__, ## arg); \ +#define dprintk(q, level, fmt, arg...) \ + do {\ + if (debug >= level) \ + pr_info("(q=%p) %s: " fmt, q, __func__, ## arg);\ } while (0) #ifdef CONFIG_VIDEO_ADV_DEBUG @@ -51,8 +51,8 @@ module_param(debug, int, 0644); */ #define log_memop(vb, op) \ - dprintk(2, "call_memop(%p, %d, %s)%s\n",\ - (vb)->vb2_queue, (vb)->index, #op, \ + dprintk((vb)->vb2_queue, 2, "call_memop(%p, %d, %s)%s\n", \ + (vb)->index, #op, \ (vb)->vb2_queue->mem_ops->op ? "" : " (nop)") #define call_memop(vb, op, args...)\ @@ -90,7 +90,7 @@ module_param(debug, int, 0644); }) #define log_qop(q, op) \ - dprintk(2, "call_qop(%p, %s)%s\n", q, #op, \ + dprintk(q, 2, "call_qop(%p, %s)%s\n", q, #op, \ (q)->ops->op ? "" : " (nop)") #define call_qop(q, op, args...) \ @@ -113,8 +113,8 @@ module_param(debug, int, 0644); }) #define log_vb_qop(vb, op, args...)\ - dprintk(2, "call_vb_qop(%p, %d, %s)%s\n", \ - (vb)->vb2_queue, (vb)->index, #op, \ + dprintk((vb)->vb2_queue, 2, "call_vb_qop(%p, %d, %s)%s\n", \ + (vb)->index, #op, \ (vb)->vb2_queue->ops->op ? "" : " (nop)") #define call_vb_qop(vb, op, args...) \ @@ -241,7 +241,8 @@ static void __vb2_buf_mem_free(struct vb2_buffer *vb) for (plane = 0; plane < vb->num_planes; ++plane) { call_void_memop(vb, put, vb->planes[plane].mem_priv); vb->planes[plane].mem_priv = NULL; - dprintk(3, "freed plane %d of buffer %d\n", plane, vb->index); + dprintk(vb->vb2_queue, 3, "freed plane %d of buffer %d\n", + plane, vb->index); } } @@ -311,7 +312,7 @@ static void __setup_offsets(struct vb2_buffer *vb) for (plane = 0; plane < vb->num_planes; ++plane) { vb->planes[plane].m.offset = off; - dprintk(3, "buffer %d, plane %d offset 0x%08lx\n", + dprintk(q, 3, "buffer %d, plane %d offset 0x%08lx\n", vb->index, plane, off); off += vb->planes[plane].length; @@ -342,7 +343,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory, /* Allocate videobuf buffer structures */ vb = kzalloc(q->buf_struct_size, GFP_KERNEL); if (!vb) { - dprintk(1, "memory alloc for buffer struct failed\n"); + dprintk(q, 1, "memory alloc for buffer struct failed\n"); break; } @@ -362,7 +363,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory, if (memory == VB2_MEMORY_MMAP) { ret = __vb2_buf_mem_alloc(vb); if (ret) { - dprintk(1, "failed allocating memory for buffer %d\n", + dprintk(q, 1, "failed allocating memory for buffer %d\n", buffer); q->bufs[vb->index] = NULL; kfree(vb); @@ -376,7 +377,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q,