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
This commit is contained in:
Frodo Looijaard committed 2000-01-24 20:07:29 +00:00
1 parent 9480bb5988
commit 888d32f50b
28 files changed
+187 -250

No files matched your search

+8 -17
View File
@@ -70,7 +70,6 @@
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include "compat.h"
#include <linux/init.h>
@@ -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 */
+3 -7
View File
@@ -36,7 +36,6 @@
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include "compat.h"
#include <linux/init.h>
@@ -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 */
-1
View File
@@ -34,7 +34,6 @@
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "compat.h"
#include <linux/init.h>
+15 -15
View File
@@ -35,9 +35,16 @@
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/i2c.h>
#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 */
-1
View File
@@ -30,7 +30,6 @@
#include <linux/i2c.h>
#include "compat.h"
#include <linux/init.h>
+7 -15
View File
@@ -31,7 +31,6 @@
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include "compat.h"
#include <linux/init.h>
@@ -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 */
+1 -3
View File
@@ -36,7 +36,6 @@
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include "compat.h"
#include <linux/init.h>
@@ -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
-1
View File
@@ -31,7 +31,6 @@
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include "compat.h"
#include <linux/init.h>
+8 -17
View File
@@ -31,7 +31,6 @@
#include <linux/ioport.h>
#include <linux/i2c.h>
#include "version.h"
#include "compat.h"
#include <linux/init.h>
@@ -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 */
-1
View File
@@ -40,7 +40,6 @@
#include <linux/delay.h>
#include <linux/i2c.h>
#include "version.h"
#include "compat.h"
#include <linux/init.h>
+8 -1
View File
@@ -26,10 +26,17 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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,
+7 -1
View File
@@ -61,9 +61,15 @@
#include "version.h"
#include "i2c-isa.h"
#include "sensors.h"
#include "compat.h"
#include <linux/init.h>
#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};
+8 -1
View File
@@ -28,9 +28,16 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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};
+8 -1
View File
@@ -26,10 +26,17 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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};
+8 -1
View File
@@ -27,7 +27,6 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
@@ -35,6 +34,14 @@
#include <linux/smp_lock.h>
#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};
+8 -2
View File
@@ -27,10 +27,16 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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};
+8
View File
@@ -38,6 +38,14 @@
#include <linux/init.h>
#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
+9 -2
View File
@@ -25,10 +25,17 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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};
+8 -2
View File
@@ -31,10 +31,16 @@
#include "version.h"
#include "i2c-isa.h"
#include "sensors.h"
#include "compat.h"
#include <linux/init.h>
#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};
+8 -2
View File
@@ -32,10 +32,16 @@
#include "version.h"
#include "i2c-isa.h"
#include "sensors.h"
#include "compat.h"
#include <linux/init.h>
#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};
+9 -2
View File
@@ -48,10 +48,17 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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};
+9 -2
View File
@@ -29,10 +29,17 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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};
+9 -2
View File
@@ -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 <linux/init.h>
#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 */
+10 -4
View File
@@ -34,10 +34,17 @@
#include "version.h"
#include "i2c-isa.h"
#include "sensors.h"
#include "compat.h"
#include <linux/init.h>
#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);
+8 -2
View File
@@ -28,10 +28,16 @@
#include "sensors.h"
#include "i2c-isa.h"
#include "version.h"
#include "compat.h"
#include <linux/init.h>
#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};
+8 -2
View File
@@ -45,10 +45,16 @@
#include "version.h"
#include "i2c-isa.h"
#include "sensors.h"
#include "compat.h"
#include <linux/init.h>
#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
-137
View File
@@ -1,137 +0,0 @@
/*
compat.h - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
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 <linux/version.h>
#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
#endif
#ifdef MODULE
#include <linux/module.h>
#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 <asm/uaccess.h>
#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 <linux/mm.h>
#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 <linux/init.h>
#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 */
+12 -8
View File
@@ -26,12 +26,12 @@
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <asm/uaccess.h>
#include "version.h"
#include <linux/i2c.h>
#include "i2c-isa.h"
#include "sensors.h"
#include "compat.h"
#include <linux/init.h>
@@ -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) ++;