From 888d32f50ba48c992559be8ada4786df0cf03de6 Mon Sep 17 00:00:00 2001 From: Frodo Looijaard Date: Mon, 24 Jan 2000 20:07:29 +0000 Subject: [PATCH] Removing kernel 2.0 and 2.1 compatibility pass 2 Eliminated compat.h git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@705 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/busses/i2c-ali15x3.c | 25 +++---- kernel/busses/i2c-amd756.c | 10 +-- kernel/busses/i2c-hydra.c | 1 - kernel/busses/i2c-i801.c | 30 ++++---- kernel/busses/i2c-isa.c | 1 - kernel/busses/i2c-piix4.c | 22 ++---- kernel/busses/i2c-sis5595.c | 4 +- kernel/busses/i2c-via.c | 1 - kernel/busses/i2c-viapro.c | 25 +++---- kernel/busses/i2c-voodoo3.c | 1 - kernel/chips/adm1021.c | 9 ++- kernel/chips/adm9240.c | 8 ++- kernel/chips/bt869.c | 9 ++- kernel/chips/eeprom.c | 9 ++- kernel/chips/gl518sm.c | 9 ++- kernel/chips/gl520sm.c | 10 ++- kernel/chips/icspll.c | 8 +++ kernel/chips/lm75.c | 11 ++- kernel/chips/lm78.c | 10 ++- kernel/chips/lm80.c | 10 ++- kernel/chips/ltc1710.c | 11 ++- kernel/chips/matorb.c | 11 ++- kernel/chips/maxilife.c | 11 ++- kernel/chips/sis5595.c | 14 ++-- kernel/chips/thmc50.c | 10 ++- kernel/chips/w83781d.c | 10 ++- kernel/include/compat.h | 137 ------------------------------------ kernel/sensors.c | 20 +++--- 28 files changed, 187 insertions(+), 250 deletions(-) delete mode 100644 kernel/include/compat.h diff --git a/kernel/busses/i2c-ali15x3.c b/kernel/busses/i2c-ali15x3.c index e2b597f8..ee98dc7c 100644 --- a/kernel/busses/i2c-ali15x3.c +++ b/kernel/busses/i2c-ali15x3.c @@ -70,7 +70,6 @@ #include #include #include "version.h" -#include "compat.h" #include @@ -215,18 +214,15 @@ int ali15x3_setup(void) if the lock bits are 1, but in fact the address registers are zero unless you clear the lock bits. */ - pci_read_config_byte_united(ALI15X3_dev, ALI15X3_bus ,ALI15X3_devfn, - SMBATPC, &temp); + pci_read_config_byte(ALI15X3_dev, SMBATPC, &temp); if(temp & ALI15X3_LOCK) { temp &= ~ALI15X3_LOCK; - pci_write_config_byte_united(ALI15X3_dev, ALI15X3_bus ,ALI15X3_devfn, - SMBATPC, temp); + pci_write_config_byte(ALI15X3_dev, SMBATPC, temp); } /* Determine the address of the SMBus area */ - pci_read_config_word_united(ALI15X3_dev, ALI15X3_bus ,ALI15X3_devfn, - SMBBA,&ali15x3_smba); + pci_read_config_word(ALI15X3_dev, SMBBA,&ali15x3_smba); ali15x3_smba &= (0xffff & ~ (ALI15X3_SMB_IOSIZE - 1)); if(ali15x3_smba == 0) { printk("i2c-ali15x3.o: ALI15X3_smb region uninitialized - upgrade BIOS?\n"); @@ -245,8 +241,7 @@ int ali15x3_setup(void) goto END; /* check if whole device is enabled */ - pci_read_config_byte_united(ALI15X3_dev, ALI15X3_bus ,ALI15X3_devfn, - SMBCOM, &temp); + pci_read_config_byte(ALI15X3_dev, SMBCOM, &temp); if ((temp & 1) == 0) { printk("SMBUS: Error: SMB device not enabled - upgrade BIOS?\n"); error_return=-ENODEV; @@ -254,8 +249,7 @@ int ali15x3_setup(void) } /* Is SMB Host controller enabled? */ - pci_read_config_byte_united(ALI15X3_dev, ALI15X3_bus, ALI15X3_devfn, - SMBHSTCFG, &temp); + pci_read_config_byte(ALI15X3_dev, SMBHSTCFG, &temp); #ifdef FORCE_ALI15X3_ENABLE /* This should never need to be done. NOTE: This assumes I/O space and other allocations WERE @@ -263,8 +257,7 @@ int ali15x3_setup(void) things after enabling this. :') Check for Bios updates before resorting to this. */ if ((temp & 1) == 0) { - pci_write_config_byte_united(ALI15X3_dev, ALI15X3_bus, ALI15X3_devfn, - SMBHSTCFG, temp | 1); + pci_write_config_byte(ALI15X3_dev, SMBHSTCFG, temp | 1); printk("i2c-ali15x3.o: WARNING: ALI15X3 SMBus interface has been FORCEFULLY " "ENABLED!!\n"); } @@ -277,8 +270,7 @@ int ali15x3_setup(void) #endif /* FORCE_ALI15X3_ENABLE */ /* set SMB clock to 74KHz as recommended in data sheet */ - pci_write_config_byte_united(ALI15X3_dev, ALI15X3_bus ,ALI15X3_devfn, - SMBCLK, 0x20); + pci_write_config_byte(ALI15X3_dev, SMBCLK, 0x20); /* Everything is happy, let's grab the memory and set things up. */ request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, "ali15x3-smb"); @@ -291,8 +283,7 @@ int ali15x3_setup(void) if ((....... & 0x0F) == 1) printk("i2c-ali15x3.o: ALI15X3 using Interrupt 9 for SMBus.\n"); */ - pci_read_config_byte_united(ALI15X3_dev, ALI15X3_bus, ALI15X3_devfn, SMBREV, - &temp); + pci_read_config_byte(ALI15X3_dev, SMBREV, &temp); printk("i2c-ali15x3.o: SMBREV = 0x%X\n",temp); printk("i2c-ali15x3.o: ALI15X3_smba = 0x%X\n",ali15x3_smba); #endif /* DEBUG */ diff --git a/kernel/busses/i2c-amd756.c b/kernel/busses/i2c-amd756.c index 23f2d62c..caa8f3e5 100644 --- a/kernel/busses/i2c-amd756.c +++ b/kernel/busses/i2c-amd756.c @@ -36,7 +36,6 @@ #include #include #include "version.h" -#include "compat.h" #include @@ -160,8 +159,7 @@ int amd756_setup(void) /* Determine the address of the SMBus areas */ /* Technically it is a dword but... */ - pci_read_config_word_united(AMD756_dev, AMD756_bus, AMD756_devfn, - SMBBA, &amd756_smba); + pci_read_config_word(AMD756_dev, SMBBA, &amd756_smba); amd756_smba &= 0xfff0; if (check_region(amd756_smba, 8)) { @@ -170,8 +168,7 @@ int amd756_setup(void) goto END; } - pci_read_config_byte_united(AMD756_dev, AMD756_bus, AMD756_devfn, - SMBGCFG, &temp); + pci_read_config_byte(AMD756_dev, SMBGCFG, &temp); if ((temp & 128) == 0) { printk("SMBUS: Error: Host SMBus controller I/O not enabled!\n"); @@ -193,8 +190,7 @@ int amd756_setup(void) "of date)!\n"); */ - pci_read_config_byte_united(AMD756_dev, AMD756_bus, AMD756_devfn, SMBREV, - &temp); + pci_read_config_byte(AMD756_dev, SMBREV, &temp); printk("i2c-amd756.o: SMBREV = 0x%X\n",temp); printk("i2c-amd756.o: AMD756_smba = 0x%X\n",amd756_smba); #endif /* DEBUG */ diff --git a/kernel/busses/i2c-hydra.c b/kernel/busses/i2c-hydra.c index 231ca8ad..e4ab7b74 100644 --- a/kernel/busses/i2c-hydra.c +++ b/kernel/busses/i2c-hydra.c @@ -34,7 +34,6 @@ #include #include -#include "compat.h" #include diff --git a/kernel/busses/i2c-i801.c b/kernel/busses/i2c-i801.c index 8be894c0..0d387fe6 100644 --- a/kernel/busses/i2c-i801.c +++ b/kernel/busses/i2c-i801.c @@ -35,9 +35,16 @@ #include #include #include +#include #include #include "version.h" -#include "compat.h" + +#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 /* I801 SMBus address offsets */ #define SMBHSTSTS (0 + i801_smba) @@ -168,8 +175,7 @@ int i801_setup(void) i801_smba = force_addr & 0xfff0; force = 0; } else { - pci_read_config_word_united(I801_dev, I801_bus ,I801_devfn, - SMBBA,&i801_smba); + pci_read_config_word(I801_dev, SMBBA,&i801_smba); i801_smba &= 0xfff0; } @@ -179,17 +185,13 @@ int i801_setup(void) goto END; } - pci_read_config_byte_united(I801_dev, I801_bus, I801_devfn, - SMBHSTCFG, &temp); + pci_read_config_byte(I801_dev, SMBHSTCFG, &temp); /* If force_addr is set, we program the new address here. Just to make sure, we disable the I801 first. */ if (force_addr) { - pci_write_config_byte_united(I801_dev, I801_bus, I801_devfn, - SMBHSTCFG, temp & 0xfe); - pci_write_config_word_united(I801_dev, I801_bus ,I801_devfn, - SMBBA,i801_smba); - pci_write_config_byte_united(I801_dev, I801_bus, I801_devfn, - SMBHSTCFG, temp | 0x01); + pci_write_config_byte(I801_dev, SMBHSTCFG, temp & 0xfe); + pci_write_config_word(I801_dev, SMBBA,i801_smba); + pci_write_config_byte(I801_dev, SMBHSTCFG, temp | 0x01); printk("i2c-i801.o: WARNING: I801 SMBus interface set to new " "address %04x!\n",i801_smba); } else if ((temp & 1) == 0) { @@ -200,8 +202,7 @@ int i801_setup(void) done by the Bios! Don't complain if your hardware does weird things after enabling this. :') Check for Bios updates before resorting to this. */ - pci_write_config_byte_united(I801_dev, I801_bus, I801_devfn, - SMBHSTCFG, temp | 1); + pci_write_config_byte(I801_dev, SMBHSTCFG, temp | 1); printk("i2c-i801.o: WARNING: I801 SMBus interface has been FORCEFULLY " "ENABLED!\n"); } else { @@ -222,8 +223,7 @@ int i801_setup(void) else printk("i2c-i801.o: I801 using PCI Interrupt for SMBus.\n"); - pci_read_config_byte_united(I801_dev, I801_bus, I801_devfn, SMBREV, - &temp); + pci_read_config_byte(I801_dev, SMBREV, &temp); printk("i2c-i801.o: SMBREV = 0x%X\n",temp); printk("i2c-i801.o: I801_smba = 0x%X\n",i801_smba); #endif /* DEBUG */ diff --git a/kernel/busses/i2c-isa.c b/kernel/busses/i2c-isa.c index dee457d0..f46cd049 100644 --- a/kernel/busses/i2c-isa.c +++ b/kernel/busses/i2c-isa.c @@ -30,7 +30,6 @@ #include -#include "compat.h" #include diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c index 478e612c..0527f817 100644 --- a/kernel/busses/i2c-piix4.c +++ b/kernel/busses/i2c-piix4.c @@ -31,7 +31,6 @@ #include #include #include "version.h" -#include "compat.h" #include @@ -168,8 +167,7 @@ int piix4_setup(void) force = 0; } else { - pci_read_config_word_united(PIIX4_dev, PIIX4_bus ,PIIX4_devfn, - SMBBA,&piix4_smba); + pci_read_config_word(PIIX4_dev, SMBBA,&piix4_smba); piix4_smba &= 0xfff0; } @@ -179,17 +177,13 @@ int piix4_setup(void) goto END; } - pci_read_config_byte_united(PIIX4_dev, PIIX4_bus, PIIX4_devfn, - SMBHSTCFG, &temp); + pci_read_config_byte(PIIX4_dev, SMBHSTCFG, &temp); /* If force_addr is set, we program the new address here. Just to make sure, we disable the PIIX4 first. */ if (force_addr) { - pci_write_config_byte_united(PIIX4_dev, PIIX4_bus, PIIX4_devfn, - SMBHSTCFG, temp & 0xfe); - pci_write_config_word_united(PIIX4_dev, PIIX4_bus ,PIIX4_devfn, - SMBBA,piix4_smba); - pci_write_config_byte_united(PIIX4_dev, PIIX4_bus, PIIX4_devfn, - SMBHSTCFG, temp | 0x01); + pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp & 0xfe); + pci_write_config_word(PIIX4_dev, SMBBA,piix4_smba); + pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp | 0x01); printk("i2c-piix4.o: WARNING: PIIX4 SMBus interface set to new " "address %04x!\n",piix4_smba); } else if ((temp & 1) == 0) { @@ -200,8 +194,7 @@ int piix4_setup(void) done by the Bios! Don't complain if your hardware does weird things after enabling this. :') Check for Bios updates before resorting to this. */ - pci_write_config_byte_united(PIIX4_dev, PIIX4_bus, PIIX4_devfn, - SMBHSTCFG, temp | 1); + pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp | 1); printk("i2c-piix4.o: WARNING: PIIX4 SMBus interface has been FORCEFULLY " "ENABLED!\n"); } else { @@ -223,8 +216,7 @@ int piix4_setup(void) printk("i2c-piix4.o: PIIX4: Illegal Interrupt configuration (or code out " "of date)!\n"); - pci_read_config_byte_united(PIIX4_dev, PIIX4_bus, PIIX4_devfn, SMBREV, - &temp); + pci_read_config_byte(PIIX4_dev, SMBREV, &temp); printk("i2c-piix4.o: SMBREV = 0x%X\n",temp); printk("i2c-piix4.o: PIIX4_smba = 0x%X\n",piix4_smba); #endif /* DEBUG */ diff --git a/kernel/busses/i2c-sis5595.c b/kernel/busses/i2c-sis5595.c index 0ed469fd..3e80e203 100644 --- a/kernel/busses/i2c-sis5595.c +++ b/kernel/busses/i2c-sis5595.c @@ -36,7 +36,6 @@ #include #include #include "version.h" -#include "compat.h" #include @@ -160,8 +159,7 @@ int sis5595_setup(void) } /* Determine the address of the SMBus areas */ - pci_read_config_word_united(SIS5595_dev, SIS5595_bus ,SIS5595_devfn, - ACPI_BASE,&sis5595_base); + pci_read_config_word(SIS5595_dev, ACPI_BASE,&sis5595_base); #ifdef DEBUG printk("ACPI Base address: %04x\n",sis5595_base); #endif diff --git a/kernel/busses/i2c-via.c b/kernel/busses/i2c-via.c index 8c4bb0fd..b598cc11 100644 --- a/kernel/busses/i2c-via.c +++ b/kernel/busses/i2c-via.c @@ -31,7 +31,6 @@ #include #include -#include "compat.h" #include diff --git a/kernel/busses/i2c-viapro.c b/kernel/busses/i2c-viapro.c index 361aa6fc..58d21e7d 100644 --- a/kernel/busses/i2c-viapro.c +++ b/kernel/busses/i2c-viapro.c @@ -31,7 +31,6 @@ #include #include #include "version.h" -#include "compat.h" #include @@ -180,12 +179,10 @@ int vt596_setup(void) } /* Determine the configuration space registers for the SMBus areas */ - if ((! pci_read_config_word_united(VT596_dev, VT596_bus ,VT596_devfn, - SMBBA1, &vt596_smba)) && (vt596_smba & 0x1)) { + if ((! pci_read_config_word(VT596_dev, SMBBA1, &vt596_smba)) && (vt596_smba & 0x1)) { smb_cf_base = SMBBA1; smb_cf_hstcfg = 0xD2; - } else if ((! pci_read_config_word_united(VT596_dev, VT596_bus ,VT596_devfn, - SMBBA2, &vt596_smba)) && (vt596_smba & 0x1)) { + } else if ((! pci_read_config_word(VT596_dev, SMBBA2, &vt596_smba)) && (vt596_smba & 0x1)) { smb_cf_base = SMBBA2; smb_cf_hstcfg = 0x84; } else { @@ -208,17 +205,13 @@ int vt596_setup(void) goto END; } - pci_read_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, - SMBHSTCFG, &temp); + pci_read_config_byte(VT596_dev, SMBHSTCFG, &temp); /* If force_addr is set, we program the new address here. Just to make sure, we disable the VT596 first. */ if (force_addr) { - pci_write_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, - SMBHSTCFG, temp & 0xfe); - pci_write_config_word_united(VT596_dev, VT596_bus ,VT596_devfn, - SMBBA,vt596_smba); - pci_write_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, - SMBHSTCFG, temp | 0x01); + pci_write_config_byte(VT596_dev, SMBHSTCFG, temp & 0xfe); + pci_write_config_word(VT596_dev, SMBBA,vt596_smba); + pci_write_config_byte(VT596_dev, SMBHSTCFG, temp | 0x01); printk("i2c-viapro.o: WARNING: VT596 SMBus interface set to new " "address %04x!\n",vt596_smba); } else if ((temp & 1) == 0) { @@ -227,8 +220,7 @@ int vt596_setup(void) done by the Bios! Don't complain if your hardware does weird things after enabling this. :') Check for Bios updates before resorting to this. */ - pci_write_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, - SMBHSTCFG, temp | 1); + pci_write_config_byte(VT596_dev, SMBHSTCFG, temp | 1); printk("i2c-viapro.o: WARNING: SMBus interface has been FORCEFULLY " "ENABLED!\n"); } else { @@ -250,8 +242,7 @@ int vt596_setup(void) printk("i2c-viapro.o: Illegal Interrupt configuration (or code out " "of date)!\n"); - pci_read_config_byte_united(VT596_dev, VT596_bus, VT596_devfn, SMBREV, - &temp); + pci_read_config_byte(VT596_dev, SMBREV, &temp); printk("i2c-viapro.o: SMBREV = 0x%X\n",temp); printk("i2c-viapro.o: VT596_smba = 0x%X\n",vt596_smba); #endif /* DEBUG */ diff --git a/kernel/busses/i2c-voodoo3.c b/kernel/busses/i2c-voodoo3.c index c93fa602..e347a987 100644 --- a/kernel/busses/i2c-voodoo3.c +++ b/kernel/busses/i2c-voodoo3.c @@ -40,7 +40,6 @@ #include #include #include "version.h" -#include "compat.h" #include diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index 3fbcf8a6..93bd80a7 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -26,10 +26,17 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x18,0x1a,0x29,0x2b, diff --git a/kernel/chips/adm9240.c b/kernel/chips/adm9240.c index 069fc38a..e82ce3f3 100644 --- a/kernel/chips/adm9240.c +++ b/kernel/chips/adm9240.c @@ -61,9 +61,15 @@ #include "version.h" #include "i2c-isa.h" #include "sensors.h" -#include "compat.h" #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; diff --git a/kernel/chips/bt869.c b/kernel/chips/bt869.c index 1827bb34..a0537b0a 100644 --- a/kernel/chips/bt869.c +++ b/kernel/chips/bt869.c @@ -28,9 +28,16 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; diff --git a/kernel/chips/eeprom.c b/kernel/chips/eeprom.c index ffcee7ce..4eda3091 100644 --- a/kernel/chips/eeprom.c +++ b/kernel/chips/eeprom.c @@ -26,10 +26,17 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x50,0x57,SENSORS_I2C_END}; diff --git a/kernel/chips/gl518sm.c b/kernel/chips/gl518sm.c index 5d293a6b..f7324df1 100644 --- a/kernel/chips/gl518sm.c +++ b/kernel/chips/gl518sm.c @@ -27,7 +27,6 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" #include @@ -35,6 +34,14 @@ #include #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2c,0x2d,SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {SENSORS_I2C_END}; diff --git a/kernel/chips/gl520sm.c b/kernel/chips/gl520sm.c index 568fdc5c..d42a89cc 100644 --- a/kernel/chips/gl520sm.c +++ b/kernel/chips/gl520sm.c @@ -27,10 +27,16 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" - #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2c,0x2d,SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {SENSORS_I2C_END}; diff --git a/kernel/chips/icspll.c b/kernel/chips/icspll.c index 60c87bc4..c01fa68a 100644 --- a/kernel/chips/icspll.c +++ b/kernel/chips/icspll.c @@ -38,6 +38,14 @@ #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Many constants specified below */ #define ICSPLL_SIZE 7 diff --git a/kernel/chips/lm75.c b/kernel/chips/lm75.c index 80d17ec1..e517a3c4 100644 --- a/kernel/chips/lm75.c +++ b/kernel/chips/lm75.c @@ -25,10 +25,17 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" - #include + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x48,0x4f,SENSORS_I2C_END}; diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c index 56508e03..5afb81f8 100644 --- a/kernel/chips/lm78.c +++ b/kernel/chips/lm78.c @@ -31,10 +31,16 @@ #include "version.h" #include "i2c-isa.h" #include "sensors.h" -#include "compat.h" - #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x20,0x2f,SENSORS_I2C_END}; diff --git a/kernel/chips/lm80.c b/kernel/chips/lm80.c index f596b564..540ad065 100644 --- a/kernel/chips/lm80.c +++ b/kernel/chips/lm80.c @@ -32,10 +32,16 @@ #include "version.h" #include "i2c-isa.h" #include "sensors.h" -#include "compat.h" - #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x20,0x2f,SENSORS_I2C_END}; diff --git a/kernel/chips/ltc1710.c b/kernel/chips/ltc1710.c index df4ad36c..d0b26805 100644 --- a/kernel/chips/ltc1710.c +++ b/kernel/chips/ltc1710.c @@ -48,10 +48,17 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" - #include + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x58,0x5a,SENSORS_I2C_END}; diff --git a/kernel/chips/matorb.c b/kernel/chips/matorb.c index f7d4e7cf..30b7462b 100644 --- a/kernel/chips/matorb.c +++ b/kernel/chips/matorb.c @@ -29,10 +29,17 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" - #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2E,SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {SENSORS_I2C_END}; diff --git a/kernel/chips/maxilife.c b/kernel/chips/maxilife.c index 78309d8c..81c4b960 100644 --- a/kernel/chips/maxilife.c +++ b/kernel/chips/maxilife.c @@ -51,11 +51,18 @@ static const char *version_str = "1.00 25/2/99 Fons Rademakers"; #include "version.h" #include "sensors.h" #include "i2c-isa.h" -#include "compat.h" - #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + + #undef AUTODETECT /* try to autodetect MaxiLife version */ #define NOWRITE /* don't allow writing to MaxiLife registers */ diff --git a/kernel/chips/sis5595.c b/kernel/chips/sis5595.c index d39b6abc..fb6a5af1 100644 --- a/kernel/chips/sis5595.c +++ b/kernel/chips/sis5595.c @@ -34,10 +34,17 @@ #include "version.h" #include "i2c-isa.h" #include "sensors.h" -#include "compat.h" - #include + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan. Note that we can't determine the ISA address until we have initialized our module */ @@ -278,8 +285,7 @@ int sis5595_find_sis(int *address) if ( PCIBIOS_SUCCESSFUL != - pci_read_config_word_united(s_bridge, SIS_bus, SIS_devfn, - SIS5595_BASE_REG, &val)) + pci_read_config_word(s_bridge, SIS5595_BASE_REG, &val)) return -ENODEV; *address = (val & 0xfff8); diff --git a/kernel/chips/thmc50.c b/kernel/chips/thmc50.c index 9544c813..1326e38a 100644 --- a/kernel/chips/thmc50.c +++ b/kernel/chips/thmc50.c @@ -28,10 +28,16 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" -#include "compat.h" - #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x2D,0x2F,SENSORS_I2C_END}; diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 13dec806..e11e00a6 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -45,10 +45,16 @@ #include "version.h" #include "i2c-isa.h" #include "sensors.h" -#include "compat.h" - #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) +#define init_MUTEX(s) do { *(s) = MUTEX; } while(0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + /* RT Table support #defined so we can take it out if it gets bothersome */ #define W83781D_RT 1 diff --git a/kernel/include/compat.h b/kernel/include/compat.h deleted file mode 100644 index 3521d902..00000000 --- a/kernel/include/compat.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - compat.h - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef SENSORS_COMPAT_H -#define SENSORS_COMPAT_H - -/* This useful macro is not defined in the 2.0 kernels */ - -#include -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c)) -#endif - -#ifdef MODULE -#include -#ifndef MODULE_AUTHOR -#define MODULE_AUTHOR(noone) -#endif -#ifndef MODULE_DESCRIPTION -#define MODULE_DESCRIPTION(none) -#endif -#ifndef MODULE_PARM -#define MODULE_PARM(no,param) -#endif -#ifndef MODULE_PARM_DESC -#define MODULE_PARM_DESC(no,description) -#endif -#endif /* def MODULE */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) -#define THIS_MODULE NULL -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) -#define EXPORT_SYMBOL(noexport) -#define EXPORT_NO_SYMBOLS -#endif - -/* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels - get_user was redefined in 2.1 kernels to use two arguments, and returns - an error code */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4)) -#define copy_from_user memcpy_fromfs -#define copy_to_user memcpy_tofs -#define get_user_data(to,from) ((to) = get_user(from),0) -#else -#include -#define get_user_data(to,from) get_user(to,from) -#endif - -/* Add a scheduling fix for the new code in kernel 2.1.127 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,127)) -#define schedule_timeout(x) ( current->timeout = jiffies + (x), schedule() ) -#endif - -/* If the new PCI interface is not present, fall back on the old PCI BIOS - interface. We also define some things to unite both interfaces. Not - very nice, but it works like a charm. - device is the 2.1 struct pci_dev, bus is the 2.0 bus number, dev is the - 2.0 device/function code, com is the PCI command, and res is the result. */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,54)) -#define pci_present pcibios_present -#define pci_read_config_byte_united(device,bus,dev,com,res) \ - pcibios_read_config_byte(bus,dev,com,res) -#define pci_read_config_word_united(device,bus,dev,com,res) \ - pcibios_read_config_word(bus,dev,com,res) -#define pci_write_config_byte_united(device,bus,dev,com,res) \ - pcibios_write_config_byte(bus,dev,com,res) -#define pci_write_config_word_united(device,bus,dev,com,res) \ - pcibios_write_config_word(bus,dev,com,res) -#else -#define pci_read_config_byte_united(device,bus,dev,com,res) \ - pci_read_config_byte(device,com,res) -#define pci_read_config_word_united(device,bus,dev,com,res) \ - pci_read_config_word(device,com,res) -#define pci_write_config_byte_united(device,bus,dev,com,res) \ - pci_write_config_byte(device,com,res) -#define pci_write_config_word_united(device,bus,dev,com,res) \ - pci_write_config_word(device,com,res) -#endif - -/* I hope this is always correct, even for the PPC, but I really think so. - And yes, the kernel version is exactly correct */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)) -#include -#define ioremap vremap -#define iounmap vfree -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) -#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 -#define PCI_DEVICE_ID_AL_M7101 0x7101 -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,31)) -#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 -#define PCI_VENDOR_ID_APPLE 0x106b -#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e -#endif - -/* New chips that will get defined in the kernel eventually */ -#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 - -#endif /* SENSORS_COMPAT_H */ diff --git a/kernel/sensors.c b/kernel/sensors.c index c03cb13f..92c9bca9 100644 --- a/kernel/sensors.c +++ b/kernel/sensors.c @@ -26,12 +26,12 @@ #include #include #include +#include #include "version.h" #include #include "i2c-isa.h" #include "sensors.h" -#include "compat.h" #include @@ -41,6 +41,10 @@ extern int cleanup_module(void); static int sensors_cleanup(void); #endif /* MODULE */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) +#define THIS_MODULE NULL +#endif + static int sensors_create_name(char **name, const char *prefix, struct i2c_adapter * adapter, int addr); static void sensors_parse_reals(int *nrels, void *buffer, int bufsize, @@ -299,7 +303,7 @@ int sensors_sysctl_chips (ctl_table *table, int *name, int nlen, void *oldval, int i,oldlen,nrels,maxels; struct ctl_table *client_tbl; - if (oldval && oldlenp && ! get_user_data(oldlen,oldlenp) && oldlen) { + if (oldval && oldlenp && ! get_user(oldlen,oldlenp) && oldlen) { maxels = oldlen / sizeof(struct sensors_chips_data); nrels = 0; for (i = 0; (i < SENSORS_ENTRY_MAX) && (nrels < maxels); i++) @@ -391,7 +395,7 @@ int sensors_sysctl_real (ctl_table *table, int *name, int nlen, void *oldval, struct i2c_client *client = table -> extra2; /* Check if we need to output the old values */ - if (oldval && oldlenp && ! get_user_data(oldlen,oldlenp) && oldlen) { + if (oldval && oldlenp && ! get_user(oldlen,oldlenp) && oldlen) { callback(client,SENSORS_PROC_REAL_READ,table->ctl_name,&nrels,results); /* Note the rounding factor! */ @@ -444,7 +448,7 @@ void sensors_parse_reals(int *nrels, void *buffer, int bufsize, while (bufsize && (*nrels < maxels)) { /* Skip spaces at the start */ - while (bufsize && ! get_user_data(nextchar,(char *) buffer) && + while (bufsize && ! get_user(nextchar,(char *) buffer) && isspace((int) nextchar)) { bufsize --; ((char *) buffer)++; @@ -460,14 +464,14 @@ void sensors_parse_reals(int *nrels, void *buffer, int bufsize, mag = magnitude; /* Check for a minus */ - if (! get_user_data(nextchar,(char *) buffer) && (nextchar == '-')) { + if (! get_user(nextchar,(char *) buffer) && (nextchar == '-')) { min=1; bufsize--; ((char *) buffer)++; } /* Digits before a decimal dot */ - while (bufsize && !get_user_data(nextchar,(char *) buffer) && + while (bufsize && !get_user(nextchar,(char *) buffer) && isdigit((int) nextchar)) { res = res * 10 + nextchar - '0'; bufsize--; @@ -487,7 +491,7 @@ void sensors_parse_reals(int *nrels, void *buffer, int bufsize, /* Read digits while they are significant */ while(bufsize && (mag > 0) && - !get_user_data(nextchar,(char *) buffer) && + !get_user(nextchar,(char *) buffer) && isdigit((int) nextchar)) { res = res * 10 + nextchar - '0'; mag--; @@ -502,7 +506,7 @@ void sensors_parse_reals(int *nrels, void *buffer, int bufsize, } /* Skip everything until we hit whitespace */ - while(bufsize && !get_user_data(nextchar,(char *) buffer) && + while(bufsize && !get_user(nextchar,(char *) buffer) && isspace ((int) nextchar)) { bufsize --; ((char *) buffer) ++;