Re: patch to NVIDIA_kernel & kernel 2.5.5

From: J.A. Magallon (jamagallon@able.es)
Date: Wed Feb 20 2002 - 17:50:56 EST


On 20020220 Nicholas Petreley wrote:
>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
>

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....

-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Feb 23 2002 - 21:00:28 EST