* 3dfx_device.c (VMA_OFFSET_ALIGNED): New macro.
(mmap_3dfx): Use VMA_OFFSET_ALIGNED, instead of checking for specific kernel versions and changing behaviour.
This commit is contained in:
@@ -174,8 +174,10 @@ static struct pci_card {
|
|||||||
*/
|
*/
|
||||||
#if !KERNEL_MIN_VER(2,3,14)
|
#if !KERNEL_MIN_VER(2,3,14)
|
||||||
#define VM_OFFSET(vma) (vma->vm_offset)
|
#define VM_OFFSET(vma) (vma->vm_offset)
|
||||||
|
#define VM_OFFSET_ALIGNED(vma) ((vma->vm_offset) & ~PAGE_MASK)
|
||||||
#else
|
#else
|
||||||
#define VM_OFFSET(vma) (vma->vm_pgoff << PAGE_SHIFT)
|
#define VM_OFFSET(vma) (vma->vm_pgoff << PAGE_SHIFT)
|
||||||
|
#define VM_OFFSET_ALIGNED(vma) ((vma->vm_pgoff) & ~PAGE_MASK)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if KERNEL_MIN_VER(2,6,0)
|
#if KERNEL_MIN_VER(2,6,0)
|
||||||
@@ -311,20 +313,10 @@ static int mmap_3dfx(struct file *file, struct vm_area_struct *vma)
|
|||||||
VM_OFFSET(vma)));
|
VM_OFFSET(vma)));
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
/*
|
if (VMA_OFFSET_ALIGNED(vma)) {
|
||||||
* This one is a special case, the macro doesn't help.
|
|
||||||
*/
|
|
||||||
#if !KERNEL_MIN_VER(2,3,14)
|
|
||||||
if ((vma->vm_offset) & ~PAGE_MASK) {
|
|
||||||
DEBUGMSG(("3dfx: Map request not page aligned\n"));
|
DEBUGMSG(("3dfx: Map request not page aligned\n"));
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if ((vma->vm_pgoff) & ~PAGE_MASK) {
|
|
||||||
DEBUGMSG(("3dfx: Map request not page aligned\n"));
|
|
||||||
return -ENXIO;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
len = vma->vm_end - vma->vm_start;
|
len = vma->vm_end - vma->vm_start;
|
||||||
if ((len < 0) || (len > 0x2000000)) {
|
if ((len < 0) || (len > 0x2000000)) {
|
||||||
DEBUGMSG(("3dfx: Invalid mapping size requested\n"));
|
DEBUGMSG(("3dfx: Invalid mapping size requested\n"));
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
2006-12-03 Guillem Jover <guillem@hadrons.org>
|
||||||
|
|
||||||
|
* 3dfx_device.c (VMA_OFFSET_ALIGNED): New macro.
|
||||||
|
(mmap_3dfx): Use VMA_OFFSET_ALIGNED, instead of checking for specific
|
||||||
|
kernel versions and changing behaviour.
|
||||||
|
|
||||||
2006-12-03 Guillem Jover <guillem@hadrons.org>
|
2006-12-03 Guillem Jover <guillem@hadrons.org>
|
||||||
|
|
||||||
* 3dfx_device.c: Indentation fixes.
|
* 3dfx_device.c: Indentation fixes.
|
||||||
|
|||||||
Reference in New Issue
Block a user