From 6fccc2cbdb5cd60420d60df9a549b1e8d8a83afc Mon Sep 17 00:00:00 2001 From: guillemj <> Date: Tue, 6 Feb 2007 04:32:58 +0000 Subject: [PATCH] * 3dfx_driver.c (HAVE_DEVFS): Define to 1 if LINUX_VERSION_CODE >= 2.3.46 and LINUX_VERSION_CODE <= 2.6.17 or if DEVFS_SUPPORT is defined, define to 0 otherwise. (devfs_handle): Only use if HAVE_DEVFS. (init_module): Only use devfs_mk_cdev or devfs_register if HAVE_DEVFS. (cleanup_module): Only use devfs_remove or devfs_unregister if HAVE_DEVFS. --- Device3Dfx/3dfx_driver.c | 13 ++++++++++++- Device3Dfx/ChangeLog | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Device3Dfx/3dfx_driver.c b/Device3Dfx/3dfx_driver.c index dbeedfd..9a3171b 100644 --- a/Device3Dfx/3dfx_driver.c +++ b/Device3Dfx/3dfx_driver.c @@ -68,8 +68,13 @@ #include #include #include -#if KERNEL_MIN_VER(2,3,46) || defined(DEVFS_SUPPORT) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,46) && \ + LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,17) || \ + defined(DEVFS_SUPPORT) #include +#define HAVE_DEVFS 1 +#else +#define HAVE_DEVFS 0 #endif #include #include @@ -235,10 +240,12 @@ void cleanup_module(void); static cardInfo cards[MAXCARDS]; static int numCards = 0; +#if HAVE_DEVFS #if KERNEL_MIN_VER(2,3,46) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) \ || defined(DEVFS_SUPPORT) static devfs_handle_t devfs_handle; #endif +#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) static void findCardType(int vendor, int device) @@ -807,6 +814,7 @@ int init_module(void) return ret; } +#if HAVE_DEVFS #if KERNEL_MIN_VER(2,6,0) devfs_mk_cdev(MKDEV(MAJOR_3DFX, DEVICE_VOODOO), S_IFCHR | S_IROTH | S_IWOTH | S_IRGRP | S_IWGRP, @@ -816,6 +824,7 @@ int init_module(void) MAJOR_3DFX, DEVICE_VOODOO, S_IFCHR | S_IROTH | S_IWOTH | S_IRGRP | S_IWGRP, &fops_3dfx, NULL); +#endif #endif DEBUGMSG(("3dfx: Successfully registered device 3dfx\n")); @@ -842,10 +851,12 @@ void cleanup_module(void) #ifdef CONFIG_MTRR resetmtrr_3dfx(); #endif +#if HAVE_DEVFS #if KERNEL_MIN_VER(2,6,0) devfs_remove("3dfx"); #elif KERNEL_MIN_VER(2,3,46) || defined(DEVFS_SUPPORT) devfs_unregister(devfs_handle); +#endif #endif if (unregister_chrdev(MAJOR_3DFX, "3dfx")) { diff --git a/Device3Dfx/ChangeLog b/Device3Dfx/ChangeLog index 64296e0..2c622d6 100644 --- a/Device3Dfx/ChangeLog +++ b/Device3Dfx/ChangeLog @@ -1,3 +1,13 @@ +2007-02-06 Guillem Jover + + * 3dfx_driver.c (HAVE_DEVFS): Define to 1 if + LINUX_VERSION_CODE >= 2.3.46 and LINUX_VERSION_CODE <= 2.6.17 or + if DEVFS_SUPPORT is defined, define to 0 otherwise. + (devfs_handle): Only use if HAVE_DEVFS. + (init_module): Only use devfs_mk_cdev or devfs_register if HAVE_DEVFS. + (cleanup_module): Only use devfs_remove or devfs_unregister if + HAVE_DEVFS. + 2007-02-06 Guillem Jover * Makefile (CFLAGS): Use '-march' instead of the deprecated '-mcpu'.