The patch number 11242 was added via Mauro Carvalho Chehab <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <[email protected]>

------

From: Daniel Gl?ckner  <[email protected]>
allow v4l2 drivers to provide a get_unmapped_area handler


Shared memory mappings on nommu machines require a get_unmapped_area
file operation that suggests an address for the mapping. This patch
adds a way for v4l2 drivers to provide this callback.

Signed-off-by: Daniel Gl?ckner <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>


---

 linux/drivers/media/video/v4l2-dev.c |   19 +++++++++++++++++++
 linux/include/media/v4l2-dev.h       |    2 ++
 2 files changed, 21 insertions(+)

diff -r c835d33070ea -r 70a36945a1a0 linux/drivers/media/video/v4l2-dev.c
--- a/linux/drivers/media/video/v4l2-dev.c      Sun Mar 15 10:13:55 2009 +0000
+++ b/linux/drivers/media/video/v4l2-dev.c      Thu Mar 26 14:31:08 2009 +0000
@@ -236,6 +236,23 @@ static long v4l2_unlocked_ioctl(struct f
        return vdev->fops->unlocked_ioctl(filp, cmd, arg);
 }
 
+#ifdef CONFIG_MMU
+#define v4l2_get_unmapped_area NULL
+#else
+static unsigned long v4l2_get_unmapped_area(struct file *filp,
+               unsigned long addr, unsigned long len, unsigned long pgoff,
+               unsigned long flags)
+{
+       struct video_device *vdev = video_devdata(filp);
+
+       if (!vdev->fops->get_unmapped_area)
+               return -ENOSYS;
+       if (video_is_unregistered(vdev))
+               return -ENODEV;
+       return vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags);
+}
+#endif
+
 static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm)
 {
        struct video_device *vdev = video_devdata(filp);
@@ -288,6 +305,7 @@ static const struct file_operations v4l2
        .read = v4l2_read,
        .write = v4l2_write,
        .open = v4l2_open,
+       .get_unmapped_area = v4l2_get_unmapped_area,
        .mmap = v4l2_mmap,
        .unlocked_ioctl = v4l2_unlocked_ioctl,
 #ifdef CONFIG_COMPAT
@@ -303,6 +321,7 @@ static const struct file_operations v4l2
        .read = v4l2_read,
        .write = v4l2_write,
        .open = v4l2_open,
+       .get_unmapped_area = v4l2_get_unmapped_area,
        .mmap = v4l2_mmap,
        .ioctl = v4l2_ioctl,
 #ifdef CONFIG_COMPAT
diff -r c835d33070ea -r 70a36945a1a0 linux/include/media/v4l2-dev.h
--- a/linux/include/media/v4l2-dev.h    Sun Mar 15 10:13:55 2009 +0000
+++ b/linux/include/media/v4l2-dev.h    Thu Mar 26 14:31:08 2009 +0000
@@ -40,6 +40,8 @@ struct v4l2_file_operations {
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
        long (*ioctl) (struct file *, unsigned int, unsigned long);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
+       unsigned long (*get_unmapped_area) (struct file *, unsigned long,
+                               unsigned long, unsigned long, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
        int (*open) (struct file *);
        int (*release) (struct file *);


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/70a36945a1a01e15dbd164a4941db5fbb4f22662

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to