From d1e26d5f16b1cdb4905212dffbbff09d46076282 Mon Sep 17 00:00:00 2001 From: Frodo Looijaard Date: Fri, 3 Sep 1999 11:11:03 +0000 Subject: [PATCH] mkpatch updates * mkpatch now correctly works when kernel-side files do not yet exist. I forgot to propagate a change in the i2c version. * __init* handling in mkpatch and compat.h * New i801 defines added to mkpatch git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@545 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/busses/i2c-i801.c | 7 ------- kernel/include/compat.h | 8 ++++++++ mkpatch/mkpatch.pl | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/kernel/busses/i2c-i801.c b/kernel/busses/i2c-i801.c index b25623df..af568825 100644 --- a/kernel/busses/i2c-i801.c +++ b/kernel/busses/i2c-i801.c @@ -42,13 +42,6 @@ #include #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) -#include -#else -#define __init -#define __initdata -#endif - /* I801 SMBus address offsets */ #define SMBHSTSTS (0 + i801_smba) #define SMBHSTCNT (2 + i801_smba) diff --git a/kernel/include/compat.h b/kernel/include/compat.h index 9b326470..e37cadee 100644 --- a/kernel/include/compat.h +++ b/kernel/include/compat.h @@ -93,6 +93,14 @@ #define init_MUTEX(s) do { *(s) = MUTEX; } while(0) #endif +/* Including init.h should be safe, even if it is not used. */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#define __initdata +#endif + /* For old 2.0 kernels */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,34)) #define PCI_DEVICE_ID_VIA_82C586_3 0x3040 diff --git a/mkpatch/mkpatch.pl b/mkpatch/mkpatch.pl index a86ec07e..c7cc86c9 100755 --- a/mkpatch/mkpatch.pl +++ b/mkpatch/mkpatch.pl @@ -31,8 +31,17 @@ sub print_diff my ($package_root,$kernel_root,$kernel_file,$package_file) = @_; my ($diff_command,$dummy); - $diff_command = "diff -u2 $kernel_root/$kernel_file "; - $diff_command .= "$package_root/$package_file"; + $diff_command = "diff -u2"; + if ( -e "$kernel_root/$kernel_file") { + $diff_command .= " $kernel_root/$kernel_file "; + } else { + $diff_command .= " /dev/null "; + } + if ( -e "$package_root/$package_file") { + $diff_command .= " $package_root/$package_file "; + } else { + $diff_command .= " /dev/null"; + } open INPUT, "$diff_command|" or die "Can't execute `$diff_command'"; $dummy = ; $dummy = ; @@ -530,8 +539,17 @@ EOF #define init_MUTEX(s) do { *(s) = MUTEX; } while(0) #endif EOF - } + if (`grep '__init' "$package_root/$package_file"`) { + print OUTPUT << 'EOF'; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#define __initdata +#endif +EOF + } if (`grep 'PCI_DEVICE_ID_VIA_82C586_3' "$package_root/$package_file"`) { print OUTPUT << 'EOF'; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,34)) @@ -566,9 +584,20 @@ EOF #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,31)) #define PCI_DEVICE_ID_APPLE_HYDRA 0x000e #endif +EOF + } + if (`grep 'PCI_DEVICE_ID_INTEL_82801AA_3\|PCI_DEVICE_ID_INTEL_82801AB_3' "$package_root/$package_file"`) { + print OUTPUT << 'EOF'; +#ifndef PCI_DEVICE_ID_INTEL_82801AA_3 +#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 +#endif +#ifndef PCI_DEVICE_ID_INTEL_82801AB_3 +#define PCI_DEVICE_ID_INTEL_82801AB_3 0x2423 +#endif EOF } print OUTPUT << 'EOF'; + /* --> END OF COMPATIBILITY SECTION */ EOF