patch to NVIDIA_kernel & kernel 2.5.5
I think you may not have meant to do this part of the patch in nv.c:
+/*
if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED))
+*/
+ if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
return -EAGAIN;
How about this instead:
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED))
return -EAGAIN;
+#else
+ if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
+ return -EAGAIN;
+#endif
Signature · 5 lines
*********************************************************** Nicholas Petreley http://www.VarLinux.org [email protected] http://www.computerworld.com http://www.petreley.org http://www.linuxworld.com Eph 6:12 ***********************************************************
Hello
Oh right this is an mistake (darn!!!) But it leads only ;-) to problems when compiled for kernel < 2.5.0
Quoted 33 lines · On 20-Feb-02 Nicholas Petreley wrote:
I think you may not have meant to do this part of the patch in
nv.c:(quoted diff) +3
-0+/* if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED)) +*/ + if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN;How about this instead:
(quoted diff) +5
-0+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN; +#else + if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) + return -EAGAIN; +#endifSignature · 11 lines
-- *********************************************************** Nicholas Petreley http://www.VarLinux.org [email protected] http://www.computerworld.com http://www.petreley.org http://www.linuxworld.com Eph 6:12 *********************************************************** - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
-----------------------------------------------
E-Mail: Martin Huenniger <[email protected]>
Date: 20-Feb-02
Time: 21:40:17
-----------------------------------------------
Quoted 12 lines · On 20020220 Nicholas Petreley wrote:
I think you may not have meant to do this part of the patch in
nv.c:(quoted diff) +3
-0+/* if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED)) +*/ + if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN;How about this instead:
Review
Quoted 7 lines
(quoted diff) +5
-0+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN; +#else + if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) + return -EAGAIN; +#endif
and why not:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
#define NV_IS_CTRL_DEV(inode) NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev) #define REMAP_PR(vma, start, page, size, flags) \
remap_page_range(start, page, size, flags)
#else
#define NV_IS_CTRL_DEV(inode) NV_DEVICE_IS_CONTROL_DEVICE(kdev_val(inode->i_rdev) #define REMAP_PR(vma, start, page, size, flags) \
remap_page_range(vma,start, page, size, flags)
#endif
so you just leave the code readable:
- if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
+ if (NV_IS_CTRL_DEV(inode))
and
- if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED))
+ if (REMAP_PR(vma,start, page, PAGE_SIZE, PAGE_SHARED))
instead of polluted by tons of #ifdefs....
Signature · 4 lines
J.A. Magallon # Let the source be with you... mailto:[email protected] Mandrake Linux release 8.2 (Cooker) for i586 Linux werewolf 2.4.18-rc2-jam1 #1 SMP Tue Feb 19 00:35:21 CET 2002 i686