Re: [REVIEWv2 PATCH 04/13] vb2: use correct prefix

2014-04-09 Thread Pawel Osciak
On Mon, Apr 7, 2014 at 10:11 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> Many dprintk's in vb2 use a hardcoded prefix with the function name. In
> many cases that is now outdated. To keep things consistent the dprintk
> macro has been changed to print the function name in addition to the "vb2:"
> prefix. Superfluous prefixes elsewhere in the code have been removed.
>
> Signed-off-by: Hans Verkuil 
> ---
>  drivers/media/v4l2-core/videobuf2-core.c | 133 
> +++
>  1 file changed, 65 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
> b/drivers/media/v4l2-core/videobuf2-core.c
> index b2582cb..1421075 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -27,10 +27,10 @@
>  static int debug;
>  module_param(debug, int, 0644);
>
> -#define dprintk(level, fmt, arg...)\
> -   do {\
> -   if (debug >= level) \
> -   printk(KERN_DEBUG "vb2: " fmt, ## arg); \
> +#define dprintk(level, fmt, arg...)  
> \
> +   do {  
> \
> +   if (debug >= level)   
> \
> +   pr_debug("vb2: %s: " fmt, __func__, ## arg); \
> } while (0)
>
>  #ifdef CONFIG_VIDEO_ADV_DEBUG
> @@ -371,7 +371,7 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned 
> int buffers)
> if (q->bufs[buffer] == NULL)
> continue;
> if (q->bufs[buffer]->state == VB2_BUF_STATE_PREPARING) {
> -   dprintk(1, "reqbufs: preparing buffers, cannot 
> free\n");
> +   dprintk(1, "preparing buffers, cannot free\n");
> return -EAGAIN;
> }
> }
> @@ -656,12 +656,12 @@ int vb2_querybuf(struct vb2_queue *q, struct 
> v4l2_buffer *b)
> int ret;
>
> if (b->type != q->type) {
> -   dprintk(1, "querybuf: wrong buffer type\n");
> +   dprintk(1, "wrong buffer type\n");
> return -EINVAL;
> }
>
> if (b->index >= q->num_buffers) {
> -   dprintk(1, "querybuf: buffer index out of range\n");
> +   dprintk(1, "buffer index out of range\n");
> return -EINVAL;
> }
> vb = q->bufs[b->index];
> @@ -721,12 +721,12 @@ static int __verify_memory_type(struct vb2_queue *q,
>  {
> if (memory != V4L2_MEMORY_MMAP && memory != V4L2_MEMORY_USERPTR &&
> memory != V4L2_MEMORY_DMABUF) {
> -   dprintk(1, "reqbufs: unsupported memory type\n");
> +   dprintk(1, "unsupported memory type\n");
> return -EINVAL;
> }
>
> if (type != q->type) {
> -   dprintk(1, "reqbufs: requested type is incorrect\n");
> +   dprintk(1, "requested type is incorrect\n");
> return -EINVAL;
> }
>
> @@ -735,17 +735,17 @@ static int __verify_memory_type(struct vb2_queue *q,
>  * are available.
>  */
> if (memory == V4L2_MEMORY_MMAP && __verify_mmap_ops(q)) {
> -   dprintk(1, "reqbufs: MMAP for current setup unsupported\n");
> +   dprintk(1, "MMAP for current setup unsupported\n");
> return -EINVAL;
> }
>
> if (memory == V4L2_MEMORY_USERPTR && __verify_userptr_ops(q)) {
> -   dprintk(1, "reqbufs: USERPTR for current setup 
> unsupported\n");
> +   dprintk(1, "USERPTR for current setup unsupported\n");
> return -EINVAL;
> }
>
> if (memory == V4L2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) {
> -   dprintk(1, "reqbufs: DMABUF for current setup unsupported\n");
> +   dprintk(1, "DMABUF for current setup unsupported\n");
> return -EINVAL;
> }
>
> @@ -755,7 +755,7 @@ static int __verify_memory_type(struct vb2_queue *q,
>  * do the memory and type validation.
>  */
> if (q->fileio) {
> -   dprintk(1, "reqbufs: file io in progress\n");
> +   dprintk(1, "file io in progress\n");
> return -EBUSY;
> }
> return 0;
> @@ -790,7 +790,7 @@ static int __reqbufs(struct vb2_queue *q, struct 
> v4l2_requestbuffers *req)
> int ret;
>
> if (q->streaming) {
> -   dprintk(1, "reqbufs: streaming active\n");
> +   dprintk(1, "streaming active\n");
> return -EBUSY;
> }
>
> @@ -800,7 +800,7 @@ static int __reqbufs(struct vb2_queue *q, struct 
> v4l2_requestbuffers *req)
>  * are not in use and can be freed.
>  */
> if (q

Re: [REVIEWv2 PATCH 04/13] vb2: use correct prefix

2014-04-09 Thread Pawel Osciak
On Mon, Apr 7, 2014 at 10:11 PM, Hans Verkuil  wrote:
> From: Hans Verkuil 
>
> Many dprintk's in vb2 use a hardcoded prefix with the function name. In
> many cases that is now outdated. To keep things consistent the dprintk
> macro has been changed to print the function name in addition to the "vb2:"
> prefix. Superfluous prefixes elsewhere in the code have been removed.
>
> Signed-off-by: Hans Verkuil 

Acked-by: Pawel Osciak 

> ---
>  drivers/media/v4l2-core/videobuf2-core.c | 133 
> +++
>  1 file changed, 65 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
> b/drivers/media/v4l2-core/videobuf2-core.c
> index b2582cb..1421075 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -27,10 +27,10 @@
>  static int debug;
>  module_param(debug, int, 0644);
>
> -#define dprintk(level, fmt, arg...)\
> -   do {\
> -   if (debug >= level) \
> -   printk(KERN_DEBUG "vb2: " fmt, ## arg); \
> +#define dprintk(level, fmt, arg...)  
> \
> +   do {  
> \
> +   if (debug >= level)   
> \
> +   pr_debug("vb2: %s: " fmt, __func__, ## arg); \
> } while (0)
>
>  #ifdef CONFIG_VIDEO_ADV_DEBUG
> @@ -371,7 +371,7 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned 
> int buffers)
> if (q->bufs[buffer] == NULL)
> continue;
> if (q->bufs[buffer]->state == VB2_BUF_STATE_PREPARING) {
> -   dprintk(1, "reqbufs: preparing buffers, cannot 
> free\n");
> +   dprintk(1, "preparing buffers, cannot free\n");
> return -EAGAIN;
> }
> }
> @@ -656,12 +656,12 @@ int vb2_querybuf(struct vb2_queue *q, struct 
> v4l2_buffer *b)
> int ret;
>
> if (b->type != q->type) {
> -   dprintk(1, "querybuf: wrong buffer type\n");
> +   dprintk(1, "wrong buffer type\n");
> return -EINVAL;
> }
>
> if (b->index >= q->num_buffers) {
> -   dprintk(1, "querybuf: buffer index out of range\n");
> +   dprintk(1, "buffer index out of range\n");
> return -EINVAL;
> }
> vb = q->bufs[b->index];
> @@ -721,12 +721,12 @@ static int __verify_memory_type(struct vb2_queue *q,
>  {
> if (memory != V4L2_MEMORY_MMAP && memory != V4L2_MEMORY_USERPTR &&
> memory != V4L2_MEMORY_DMABUF) {
> -   dprintk(1, "reqbufs: unsupported memory type\n");
> +   dprintk(1, "unsupported memory type\n");
> return -EINVAL;
> }
>
> if (type != q->type) {
> -   dprintk(1, "reqbufs: requested type is incorrect\n");
> +   dprintk(1, "requested type is incorrect\n");
> return -EINVAL;
> }
>
> @@ -735,17 +735,17 @@ static int __verify_memory_type(struct vb2_queue *q,
>  * are available.
>  */
> if (memory == V4L2_MEMORY_MMAP && __verify_mmap_ops(q)) {
> -   dprintk(1, "reqbufs: MMAP for current setup unsupported\n");
> +   dprintk(1, "MMAP for current setup unsupported\n");
> return -EINVAL;
> }
>
> if (memory == V4L2_MEMORY_USERPTR && __verify_userptr_ops(q)) {
> -   dprintk(1, "reqbufs: USERPTR for current setup 
> unsupported\n");
> +   dprintk(1, "USERPTR for current setup unsupported\n");
> return -EINVAL;
> }
>
> if (memory == V4L2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) {
> -   dprintk(1, "reqbufs: DMABUF for current setup unsupported\n");
> +   dprintk(1, "DMABUF for current setup unsupported\n");
> return -EINVAL;
> }
>
> @@ -755,7 +755,7 @@ static int __verify_memory_type(struct vb2_queue *q,
>  * do the memory and type validation.
>  */
> if (q->fileio) {
> -   dprintk(1, "reqbufs: file io in progress\n");
> +   dprintk(1, "file io in progress\n");
> return -EBUSY;
> }
> return 0;
> @@ -790,7 +790,7 @@ static int __reqbufs(struct vb2_queue *q, struct 
> v4l2_requestbuffers *req)
> int ret;
>
> if (q->streaming) {
> -   dprintk(1, "reqbufs: streaming active\n");
> +   dprintk(1, "streaming active\n");
> return -EBUSY;
> }
>
> @@ -800,7 +800,7 @@ static int __reqbufs(struct vb2_queue *q, struct 
> v4l2_requestbuffers *req)
>  * are not in use and can be freed.
>  

[REVIEWv2 PATCH 04/13] vb2: use correct prefix

2014-04-07 Thread Hans Verkuil
From: Hans Verkuil 

Many dprintk's in vb2 use a hardcoded prefix with the function name. In
many cases that is now outdated. To keep things consistent the dprintk
macro has been changed to print the function name in addition to the "vb2:"
prefix. Superfluous prefixes elsewhere in the code have been removed.

Signed-off-by: Hans Verkuil 
---
 drivers/media/v4l2-core/videobuf2-core.c | 133 +++
 1 file changed, 65 insertions(+), 68 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index b2582cb..1421075 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -27,10 +27,10 @@
 static int debug;
 module_param(debug, int, 0644);
 
-#define dprintk(level, fmt, arg...)\
-   do {\
-   if (debug >= level) \
-   printk(KERN_DEBUG "vb2: " fmt, ## arg); \
+#define dprintk(level, fmt, arg...)  \
+   do {  \
+   if (debug >= level)   \
+   pr_debug("vb2: %s: " fmt, __func__, ## arg); \
} while (0)
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -371,7 +371,7 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned 
int buffers)
if (q->bufs[buffer] == NULL)
continue;
if (q->bufs[buffer]->state == VB2_BUF_STATE_PREPARING) {
-   dprintk(1, "reqbufs: preparing buffers, cannot free\n");
+   dprintk(1, "preparing buffers, cannot free\n");
return -EAGAIN;
}
}
@@ -656,12 +656,12 @@ int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer 
*b)
int ret;
 
if (b->type != q->type) {
-   dprintk(1, "querybuf: wrong buffer type\n");
+   dprintk(1, "wrong buffer type\n");
return -EINVAL;
}
 
if (b->index >= q->num_buffers) {
-   dprintk(1, "querybuf: buffer index out of range\n");
+   dprintk(1, "buffer index out of range\n");
return -EINVAL;
}
vb = q->bufs[b->index];
@@ -721,12 +721,12 @@ static int __verify_memory_type(struct vb2_queue *q,
 {
if (memory != V4L2_MEMORY_MMAP && memory != V4L2_MEMORY_USERPTR &&
memory != V4L2_MEMORY_DMABUF) {
-   dprintk(1, "reqbufs: unsupported memory type\n");
+   dprintk(1, "unsupported memory type\n");
return -EINVAL;
}
 
if (type != q->type) {
-   dprintk(1, "reqbufs: requested type is incorrect\n");
+   dprintk(1, "requested type is incorrect\n");
return -EINVAL;
}
 
@@ -735,17 +735,17 @@ static int __verify_memory_type(struct vb2_queue *q,
 * are available.
 */
if (memory == V4L2_MEMORY_MMAP && __verify_mmap_ops(q)) {
-   dprintk(1, "reqbufs: MMAP for current setup unsupported\n");
+   dprintk(1, "MMAP for current setup unsupported\n");
return -EINVAL;
}
 
if (memory == V4L2_MEMORY_USERPTR && __verify_userptr_ops(q)) {
-   dprintk(1, "reqbufs: USERPTR for current setup unsupported\n");
+   dprintk(1, "USERPTR for current setup unsupported\n");
return -EINVAL;
}
 
if (memory == V4L2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) {
-   dprintk(1, "reqbufs: DMABUF for current setup unsupported\n");
+   dprintk(1, "DMABUF for current setup unsupported\n");
return -EINVAL;
}
 
@@ -755,7 +755,7 @@ static int __verify_memory_type(struct vb2_queue *q,
 * do the memory and type validation.
 */
if (q->fileio) {
-   dprintk(1, "reqbufs: file io in progress\n");
+   dprintk(1, "file io in progress\n");
return -EBUSY;
}
return 0;
@@ -790,7 +790,7 @@ static int __reqbufs(struct vb2_queue *q, struct 
v4l2_requestbuffers *req)
int ret;
 
if (q->streaming) {
-   dprintk(1, "reqbufs: streaming active\n");
+   dprintk(1, "streaming active\n");
return -EBUSY;
}
 
@@ -800,7 +800,7 @@ static int __reqbufs(struct vb2_queue *q, struct 
v4l2_requestbuffers *req)
 * are not in use and can be freed.
 */
if (q->memory == V4L2_MEMORY_MMAP && __buffers_in_use(q)) {
-   dprintk(1, "reqbufs: memory in use, cannot free\n");
+   dprintk(1, "memory in use, cannot free\n");
return -EBUSY;
}
 
@@ -931,8 +931,7 @@ stat