[linux-dvb] problems in em28xx-video.c

Markus Rechberger mrechberger at gmail.com
Wed Sep 19 11:53:57 CEST 2007


On 9/19/07, kevin liu <lwtbenben at gmail.com> wrote:
> Dear Markus:
>     In em28xx-video.c, when you design memory map function,
>     You used this state:
> ++++++++
> for(i=0; i<dev->num_frames; i++){
>     if(dev->frame[i].buf.m.offset >> PAGE_SHIFT == vma->pgoff)
>         break;
> }
> ++++++++
> Why dev->frame[i].buf.m.off>>PAGE_SHIFT == vma->pgoff;

it's just a check if vma->pgoff is out of range or not

> I see the mmap function implemented in Linux device driver3, it is like
> this:
> if(remap_pfn_range(vma, vma_start, vm->vm_pgoff, vma_size,
> vma->vm_page_prot))
>      return -EAGAIN;
> ......
> ......
>
> And where did the frame[i].buf come from?

/* frames */
struct em28xx_frame_t {
        void *bufmem;
        struct v4l2_buffer buf;
        enum em28xx_frame_state state;
        struct list_head frame;
        unsigned long vma_use_count;
        int top_field;
        int fieldbytesused;
};


> Could you please give me some explanation?

You hit the first part of the book which isn't uptodate anymore :-)

http://groups.google.de/group/linux.kernel/browse_thread/thread/d5cdcf4d9212178f/965817de9083403e?hl=de&lnk=st&q=remap_pfn_range+vm_insert_page&rnum=4#965817de9083403e

Markus



More information about the linux-dvb mailing list