Hi all,
I've rewritten a driver for the 2.1.xxx kernels and (of course:( )
I've got some trouble.
The driver got a mmap-operation which maps some pages (produced
by calling __get_free_pages() ) to the user space. It seems to
work for one process, but it fails if I call the mmap for the
same device multiple times (from different processes). The first
time succeeds but the second call hangs and the mmap-operation was
not called.
Here comes a part of the code:
(PDEBUG ist a debug macro which expands to something like printk(...) )
static int ma_mmap(struct file *filp, struct vm_area_struct *vma)
{
Ma_Dev *dev = (Ma_Dev *)filp->private_data;
PDEBUG("mmap for %d\n",dev->id); // <-- the second process never
// reaches this statement:(
if (dev->id < 0 || dev->id > 3) {
PDEBUG("ma_mmap called for false device\n");
return 0;
}
if (vma->vm_end - vma->vm_start != (1<<MA_QUOTA)*PAGE_SIZE)
return -EINVAL;
if (remap_page_range(vma->vm_start,
virt_to_phys((char *)dev->dma_offset_send),
(vma->vm_end-vma->vm_start), vma->vm_page_prot))
return -EAGAIN;
vma->vm_ops = &simple_vm_ops; // a struct vm_operations_struct
MOD_INC_USE_COUNT;
vma->vm_file = filp;
filp->f_count++;
return 0;
I've looked at the code for the sound-driver which comes with theQuote:}
kernel sources, and they did the same. So what's going wrong?
Regards
Mathias
--
Tel.: +49 621 292 1620 Fax.: +49 621 292 5597