Re: mmap() of PCI space in device driver

Scott C. Karlin (scott@CS.Princeton.EDU)
Fri, 18 Jun 1999 15:27:52 -0400 (EDT)


Alan Cox writes:
>
> This may help

Thanks.

> static int dma_mmap(struct file *file, struct vm_area_struct *vma)
> {
> struct dmaram *dp = dma_dev[MINOR(file->f_dentry->d_inode->i_rdev)];
> int size;
>
> if(dp->raw_buf == NULL)
> return -EIO;
> size = vma->vm_end - vma->vm_start;
> if(size != dp->buffsize)
> return -EINVAL;
> if(remap_page_range(vma->vm_start, dp->raw_buf_phys,
> size, vma->vm_page_prot))
> return -EAGAIN;
> return 0;
> }

In the driver I'm porting, the mmap function ends with:

vma->vm_inode = file->f_dentry->d_inode;
file->f_dentry->d_inode->i_count += 1;
return 0;

I notice that the above mmap function doesn't mess with inodes
or i_counts. Are these still needed in some form in 2.2.x?
Was the driver I'm porting incorrect to begin with?

-Scott

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/