On Fri, 06 Apr 2012 09:29:20 +0200
Antonio Ospite <osp...@studenti.unina.it> wrote:

> Package: nvidia-kernel-dkms
> Version: 295.33-2
> Severity: normal
> Tags: upstream
> 
> Dear Maintainer,
> 
> I am attaching a patch to fix building the kernel module with recent kernels
> like 3.4.0-rc1.
> 

Actually it looks like asm/switch_to.h is not even needed, the patch
attached to this message should be better.

Sorry for the noise.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
Make the kernel module build against kernels >= 3.4

In newer kernels asm/system.h is not available anymore, its content has
been scattered into other header files, to avoid circular dependencies,
see https://lkml.org/lkml/2012/3/7/389 and
https://lkml.org/lkml/2012/3/28/381

All the needed pieces are already brought in by other header files in
this case, so just avoid including asm/system.h when compiling against
newer kernels.

This patch has been tested against 3.3.0 and 3.4.0-rc1

Signed-off-by: Antonio Ospite <osp...@studenti.unina.it>

diff -pruN nvidia-295.33.orig/conftest.h nvidia-295.33/conftest.h
--- nvidia-295.33.orig/conftest.h	2012-04-06 08:53:45.000000000 +0200
+++ nvidia-295.33/conftest.h	2012-04-06 09:45:14.000000000 +0200
@@ -324,3 +324,10 @@
 #else
  #undef NV_GENERATED_UTSRELEASE_H_PRESENT
 #endif
+
+/* Check for asm/system.h */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+ #define NV_LINUX_ASM_SYSTEM_H_PRESENT
+#else
+ #undef NV_LINUX_ASM_SYSTEM_H_PRESENT
+#endif
diff -pruN nvidia-295.33.orig/nv-linux.h nvidia-295.33/nv-linux.h
--- nvidia-295.33.orig/nv-linux.h	2012-04-06 08:53:45.000000000 +0200
+++ nvidia-295.33/nv-linux.h	2012-04-06 09:45:16.000000000 +0200
@@ -113,12 +113,15 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                         */
-#include <asm/system.h>             /* cli, sli, save_flags             */
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */
 #include <asm/pgtable.h>            /* pte bit definitions              */
 
+#if defined(NV_LINUX_ASM_SYSTEM_H_PRESENT)
+#include <asm/system.h>             /* cli, sli, save_flags             */
+#endif
+
 #if defined(NVCPU_X86_64) && !defined(KERNEL_2_4) && !defined(HAVE_COMPAT_IOCTL)
 #include <linux/syscalls.h>         /* sys_ioctl()                      */
 #include <linux/ioctl32.h>          /* register_ioctl32_conversion()    */

Attachment: pgpq7EJ5Ew4IX.pgp
Description: PGP signature

Reply via email to