aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/video4linux/v4l2-framework.txt16
-rw-r--r--drivers/media/video/v4l2-dev.c4
-rw-r--r--include/media/v4l2-dev.h5
3 files changed, 21 insertions, 4 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index b806edaf3e7..74d677c8b03 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -561,6 +561,8 @@ video_device helper functions
561 561
562There are a few useful helper functions: 562There are a few useful helper functions:
563 563
564- file/video_device private data
565
564You can set/get driver private data in the video_device struct using: 566You can set/get driver private data in the video_device struct using:
565 567
566void *video_get_drvdata(struct video_device *vdev); 568void *video_get_drvdata(struct video_device *vdev);
@@ -575,8 +577,7 @@ struct video_device *video_devdata(struct file *file);
575 577
576returns the video_device belonging to the file struct. 578returns the video_device belonging to the file struct.
577 579
578The final helper function combines video_get_drvdata with 580The video_drvdata function combines video_get_drvdata with video_devdata:
579video_devdata:
580 581
581void *video_drvdata(struct file *file); 582void *video_drvdata(struct file *file);
582 583
@@ -584,6 +585,17 @@ You can go from a video_device struct to the v4l2_device struct using:
584 585
585struct v4l2_device *v4l2_dev = vdev->v4l2_dev; 586struct v4l2_device *v4l2_dev = vdev->v4l2_dev;
586 587
588- Device node name
589
590The video_device node kernel name can be retrieved using
591
592const char *video_device_node_name(struct video_device *vdev);
593
594The name is used as a hint by userspace tools such as udev. The function
595should be used where possible instead of accessing the video_device::num and
596video_device::minor fields.
597
598
587video buffer helper functions 599video buffer helper functions
588----------------------------- 600-----------------------------
589 601
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 500cbe9891a..aa3e0f9aa3b 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -551,8 +551,8 @@ static int __video_register_device(struct video_device *vdev, int type, int nr,
551 vdev->dev.release = v4l2_device_release; 551 vdev->dev.release = v4l2_device_release;
552 552
553 if (nr != -1 && nr != vdev->num && warn_if_nr_in_use) 553 if (nr != -1 && nr != vdev->num && warn_if_nr_in_use)
554 printk(KERN_WARNING "%s: requested %s%d, got %s%d\n", 554 printk(KERN_WARNING "%s: requested %s%d, got %s\n", __func__,
555 __func__, name_base, nr, name_base, vdev->num); 555 name_base, nr, video_device_node_name(vdev));
556 556
557 /* Part 5: Activate this minor. The char device can now be used. */ 557 /* Part 5: Activate this minor. The char device can now be used. */
558 mutex_lock(&videodev_lock); 558 mutex_lock(&videodev_lock);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 73c9867d744..9135f57351f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -141,6 +141,11 @@ static inline void *video_drvdata(struct file *file)
141 return video_get_drvdata(video_devdata(file)); 141 return video_get_drvdata(video_devdata(file));
142} 142}
143 143
144static inline const char *video_device_node_name(struct video_device *vdev)
145{
146 return dev_name(&vdev->dev);
147}
148
144static inline int video_is_unregistered(struct video_device *vdev) 149static inline int video_is_unregistered(struct video_device *vdev)
145{ 150{
146 return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags); 151 return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags);