diff options
author | Daniel Glöckner <dg@emlix.com> | 2009-03-26 10:31:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:43 -0400 |
commit | c01f1a5a241604c35f93f10e06253ca70e88ee4e (patch) | |
tree | f5eea48a07cd7c08fd9bf34d32babf99d02e973d /drivers | |
parent | 8737f66e6415e8dbe8c8b26d63692d87a4ad5b29 (diff) |
V4L/DVB (11242): 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 <dg@emlix.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index cdc8ce3c4e56..91228b3df07d 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -198,6 +198,23 @@ static long v4l2_unlocked_ioctl(struct file *filp, | |||
198 | return vdev->fops->unlocked_ioctl(filp, cmd, arg); | 198 | return vdev->fops->unlocked_ioctl(filp, cmd, arg); |
199 | } | 199 | } |
200 | 200 | ||
201 | #ifdef CONFIG_MMU | ||
202 | #define v4l2_get_unmapped_area NULL | ||
203 | #else | ||
204 | static unsigned long v4l2_get_unmapped_area(struct file *filp, | ||
205 | unsigned long addr, unsigned long len, unsigned long pgoff, | ||
206 | unsigned long flags) | ||
207 | { | ||
208 | struct video_device *vdev = video_devdata(filp); | ||
209 | |||
210 | if (!vdev->fops->get_unmapped_area) | ||
211 | return -ENOSYS; | ||
212 | if (video_is_unregistered(vdev)) | ||
213 | return -ENODEV; | ||
214 | return vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags); | ||
215 | } | ||
216 | #endif | ||
217 | |||
201 | static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) | 218 | static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) |
202 | { | 219 | { |
203 | struct video_device *vdev = video_devdata(filp); | 220 | struct video_device *vdev = video_devdata(filp); |
@@ -250,6 +267,7 @@ static const struct file_operations v4l2_unlocked_fops = { | |||
250 | .read = v4l2_read, | 267 | .read = v4l2_read, |
251 | .write = v4l2_write, | 268 | .write = v4l2_write, |
252 | .open = v4l2_open, | 269 | .open = v4l2_open, |
270 | .get_unmapped_area = v4l2_get_unmapped_area, | ||
253 | .mmap = v4l2_mmap, | 271 | .mmap = v4l2_mmap, |
254 | .unlocked_ioctl = v4l2_unlocked_ioctl, | 272 | .unlocked_ioctl = v4l2_unlocked_ioctl, |
255 | #ifdef CONFIG_COMPAT | 273 | #ifdef CONFIG_COMPAT |
@@ -265,6 +283,7 @@ static const struct file_operations v4l2_fops = { | |||
265 | .read = v4l2_read, | 283 | .read = v4l2_read, |
266 | .write = v4l2_write, | 284 | .write = v4l2_write, |
267 | .open = v4l2_open, | 285 | .open = v4l2_open, |
286 | .get_unmapped_area = v4l2_get_unmapped_area, | ||
268 | .mmap = v4l2_mmap, | 287 | .mmap = v4l2_mmap, |
269 | .ioctl = v4l2_ioctl, | 288 | .ioctl = v4l2_ioctl, |
270 | #ifdef CONFIG_COMPAT | 289 | #ifdef CONFIG_COMPAT |