aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-06-09 11:13:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 16:34:05 -0400
commitcc4b7e7f5755d304ffbfc1d44c11ba8e981347b0 (patch)
tree4dfba4dd98324231104c04676c12c9897b0efed7 /drivers/media
parent2e90c6c38a3a5775cccd728eea74fdacbb29e029 (diff)
[media] v4l2-dev.c: also add debug support for the fops
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/v4l2-dev.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index b82778174eef..d13c47fc7202 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -305,6 +305,9 @@ static ssize_t v4l2_read(struct file *filp, char __user *buf,
305 ret = vdev->fops->read(filp, buf, sz, off); 305 ret = vdev->fops->read(filp, buf, sz, off);
306 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags)) 306 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags))
307 mutex_unlock(vdev->lock); 307 mutex_unlock(vdev->lock);
308 if (vdev->debug)
309 printk(KERN_DEBUG "%s: read: %zd (%d)\n",
310 video_device_node_name(vdev), sz, ret);
308 return ret; 311 return ret;
309} 312}
310 313
@@ -323,6 +326,9 @@ static ssize_t v4l2_write(struct file *filp, const char __user *buf,
323 ret = vdev->fops->write(filp, buf, sz, off); 326 ret = vdev->fops->write(filp, buf, sz, off);
324 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags)) 327 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags))
325 mutex_unlock(vdev->lock); 328 mutex_unlock(vdev->lock);
329 if (vdev->debug)
330 printk(KERN_DEBUG "%s: write: %zd (%d)\n",
331 video_device_node_name(vdev), sz, ret);
326 return ret; 332 return ret;
327} 333}
328 334
@@ -339,6 +345,9 @@ static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll)
339 ret = vdev->fops->poll(filp, poll); 345 ret = vdev->fops->poll(filp, poll);
340 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags)) 346 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags))
341 mutex_unlock(vdev->lock); 347 mutex_unlock(vdev->lock);
348 if (vdev->debug)
349 printk(KERN_DEBUG "%s: poll: %08x\n",
350 video_device_node_name(vdev), ret);
342 return ret; 351 return ret;
343} 352}
344 353
@@ -403,12 +412,17 @@ static unsigned long v4l2_get_unmapped_area(struct file *filp,
403 unsigned long flags) 412 unsigned long flags)
404{ 413{
405 struct video_device *vdev = video_devdata(filp); 414 struct video_device *vdev = video_devdata(filp);
415 int ret;
406 416
407 if (!vdev->fops->get_unmapped_area) 417 if (!vdev->fops->get_unmapped_area)
408 return -ENOSYS; 418 return -ENOSYS;
409 if (!video_is_registered(vdev)) 419 if (!video_is_registered(vdev))
410 return -ENODEV; 420 return -ENODEV;
411 return vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags); 421 ret = vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags);
422 if (vdev->debug)
423 printk(KERN_DEBUG "%s: get_unmapped_area (%d)\n",
424 video_device_node_name(vdev), ret);
425 return ret;
412} 426}
413#endif 427#endif
414 428
@@ -426,6 +440,9 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm)
426 ret = vdev->fops->mmap(filp, vm); 440 ret = vdev->fops->mmap(filp, vm);
427 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags)) 441 if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags))
428 mutex_unlock(vdev->lock); 442 mutex_unlock(vdev->lock);
443 if (vdev->debug)
444 printk(KERN_DEBUG "%s: mmap (%d)\n",
445 video_device_node_name(vdev), ret);
429 return ret; 446 return ret;
430} 447}
431 448
@@ -464,6 +481,9 @@ err:
464 /* decrease the refcount in case of an error */ 481 /* decrease the refcount in case of an error */
465 if (ret) 482 if (ret)
466 video_put(vdev); 483 video_put(vdev);
484 if (vdev->debug)
485 printk(KERN_DEBUG "%s: open (%d)\n",
486 video_device_node_name(vdev), ret);
467 return ret; 487 return ret;
468} 488}
469 489
@@ -483,6 +503,9 @@ static int v4l2_release(struct inode *inode, struct file *filp)
483 /* decrease the refcount unconditionally since the release() 503 /* decrease the refcount unconditionally since the release()
484 return value is ignored. */ 504 return value is ignored. */
485 video_put(vdev); 505 video_put(vdev);
506 if (vdev->debug)
507 printk(KERN_DEBUG "%s: release\n",
508 video_device_node_name(vdev));
486 return ret; 509 return ret;
487} 510}
488 511