Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366643
b: refs/heads/master
c: ffdc78e
h: refs/heads/master
i:
  366641: a99fc2e
  366639: 2c2347a
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 21, 2013
1 parent 4679745 commit cf1a973
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b6ba2057f7823352bbc44ee846faa03b36e8b6ac
refs/heads/master: ffdc78efe1a8a013036aa7a63402f2708ed4f483
17 changes: 13 additions & 4 deletions trunk/drivers/media/v4l2-core/videobuf2-dma-sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
#include <media/videobuf2-memops.h>
#include <media/videobuf2-dma-sg.h>

static int debug;
module_param(debug, int, 0644);

#define dprintk(level, fmt, arg...) \
do { \
if (debug >= level) \
printk(KERN_DEBUG "vb2-dma-sg: " fmt, ## arg); \
} while (0)

struct vb2_dma_sg_buf {
void *vaddr;
struct page **pages;
Expand Down Expand Up @@ -74,7 +83,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_fla

atomic_inc(&buf->refcount);

printk(KERN_DEBUG "%s: Allocated buffer of %d pages\n",
dprintk(1, "%s: Allocated buffer of %d pages\n",
__func__, buf->sg_desc.num_pages);
return buf;

Expand All @@ -97,7 +106,7 @@ static void vb2_dma_sg_put(void *buf_priv)
int i = buf->sg_desc.num_pages;

if (atomic_dec_and_test(&buf->refcount)) {
printk(KERN_DEBUG "%s: Freeing buffer of %d pages\n", __func__,
dprintk(1, "%s: Freeing buffer of %d pages\n", __func__,
buf->sg_desc.num_pages);
if (buf->vaddr)
vm_unmap_ram(buf->vaddr, buf->sg_desc.num_pages);
Expand Down Expand Up @@ -163,7 +172,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,
return buf;

userptr_fail_get_user_pages:
printk(KERN_DEBUG "get_user_pages requested/got: %d/%d]\n",
dprintk(1, "get_user_pages requested/got: %d/%d]\n",
num_pages_from_user, buf->sg_desc.num_pages);
while (--num_pages_from_user >= 0)
put_page(buf->pages[num_pages_from_user]);
Expand All @@ -186,7 +195,7 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)
struct vb2_dma_sg_buf *buf = buf_priv;
int i = buf->sg_desc.num_pages;

printk(KERN_DEBUG "%s: Releasing userspace buffer of %d pages\n",
dprintk(1, "%s: Releasing userspace buffer of %d pages\n",
__func__, buf->sg_desc.num_pages);
if (buf->vaddr)
vm_unmap_ram(buf->vaddr, buf->sg_desc.num_pages);
Expand Down

0 comments on commit cf1a973

Please sign in to comment.