On Thu, Apr 21, 2011 at 3:59 PM, Daniel GlÃckner <daniel-gl@xxxxxxx> wrote: > Hi Bob, > > On Thu, Apr 21, 2011 at 11:17:42AM +0800, Bob Liu wrote: >> +#ifdef CONFIG_MMU >> Â Â Â if (i == queue->count || size != queue->buf_size) { >> +#else >> + Â Â if (i == queue->count || PAGE_ALIGN(size) != queue->buf_size) { >> +#endif > > on mmu systems do_mmap_pgoff contains a len = PAGE_ALIGN(len); line. > If we depend on this behavior, why not do it here as well and get rid > of the #ifdef? > If do it in do_mmap_pgoff() the whole system will be effected, I am not sure whether it's correct and needed for other subsystem. >> +unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, >> + Â Â Â Â Â Â unsigned long addr, unsigned long len, unsigned long pgoff) >> +{ >> + Â Â struct uvc_buffer *buffer; >> + Â Â unsigned int i; >> + Â Â int ret = 0; > > You still didn't change ret to unsigned long. > Oh, Sorry. My fault. >> + Â Â addr = (unsigned long)queue->mem + buffer->buf.m.offset; >> + Â Â ret = addr; > > Why the intermediate step using addr? > If don't return addr, do_mmap_pgoff() will return failure and we can't setup vma correctly. See mm/nommu.c line 1386(add = file->f_op->get_unmmapped_area() ). >> diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c >> index 498e674..221e73f 100644 >> --- a/drivers/media/video/v4l2-dev.c >> +++ b/drivers/media/video/v4l2-dev.c >> @@ -368,6 +368,23 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) >> Â Â Â return ret; >> Â} >> >> +#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_registered(vdev)) >> + Â Â Â Â Â Â return -ENODEV; >> + Â Â return vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags); >> +} >> +#endif >> + >> Â/* Override for the open function */ >> Âstatic int v4l2_open(struct inode *inode, struct file *filp) >> Â{ >> @@ -452,6 +469,7 @@ static const struct file_operations v4l2_fops = { >> Â Â Â .write = v4l2_write, >> Â Â Â .open = v4l2_open, >> Â Â Â .mmap = v4l2_mmap, >> + Â Â .get_unmapped_area = v4l2_get_unmapped_area, >> Â Â Â .unlocked_ioctl = v4l2_ioctl, >> Â#ifdef CONFIG_COMPAT >> Â Â Â .compat_ioctl = v4l2_compat_ioctl32, >> diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h >> index 8266d5a..0616a43 100644 >> --- a/include/media/v4l2-dev.h >> +++ b/include/media/v4l2-dev.h >> @@ -63,6 +63,8 @@ struct v4l2_file_operations { >> Â Â Â long (*ioctl) (struct file *, unsigned int, unsigned long); >> Â Â Â long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); >> Â Â Â int (*mmap) (struct file *, struct vm_area_struct *); >> + Â Â unsigned long (*get_unmapped_area) (struct file *, unsigned long, >> + Â Â Â Â Â Â Â Â Â Â unsigned long, unsigned long, unsigned long); >> Â Â Â int (*open) (struct file *); >> Â Â Â int (*release) (struct file *); >> Â}; > > I'd prefer a git revert c29fcff3daafbf46d64a543c1950bbd206ad8c1c for > this block instead of reverting it together with the UVC changes. > Okay, I will confirm that and do it. Thanks a lot for your review. -- Regards, --Bob -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html