From fcbe78a6698eb44205b4fc50999235c0a3eaa530 Mon Sep 17 00:00:00 2001 From: Frodo Looijaard Date: Fri, 23 Jul 1999 11:43:58 +0000 Subject: [PATCH] First step to make it possible to integrate lm_sensors modules into the kernel. * is now included for all modules * Initialization-time only functions and variables are marked with __init * EXPORT_SYMBOL or EXPORT_NO_SYMBOLS declarations added git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@513 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 3 ++- kernel/busses/i2c-ali15x3.c | 18 +++++++++++++----- kernel/busses/i2c-hydra.c | 9 ++++++++- kernel/busses/i2c-isa.c | 18 +++++++++++++----- kernel/busses/i2c-piix4.c | 17 ++++++++++++----- kernel/busses/i2c-via.c | 10 +++++++++- kernel/busses/i2c-via2.c | 20 +++++++++++++++----- kernel/busses/i2c-viapro.c | 20 +++++++++++++++----- kernel/busses/i2c-voodoo3.c | 33 ++++++++++++++------------------- kernel/chips/adm1021.c | 17 ++++++++++++----- kernel/chips/adm9240.c | 16 +++++++++++----- kernel/chips/bt869.c | 17 ++++++++++++----- kernel/chips/eeprom.c | 18 +++++++++++++----- kernel/chips/gl518sm.c | 17 ++++++++++++----- kernel/chips/gl520sm.c | 18 +++++++++++++----- kernel/chips/icspll.c | 17 ++++++++++++----- kernel/chips/lm75.c | 18 +++++++++++++----- kernel/chips/lm78.c | 18 +++++++++++++----- kernel/chips/lm80.c | 18 +++++++++++++----- kernel/chips/ltc1710.c | 18 +++++++++++++----- kernel/chips/matorb.c | 18 +++++++++++++----- kernel/chips/maxilife.c | 18 +++++++++++++----- kernel/chips/sis5595.c | 18 +++++++++++++----- kernel/chips/w83781d.c | 20 ++++++++++++-------- kernel/sensors.c | 28 ++++++++++++++++++++-------- 25 files changed, 309 insertions(+), 133 deletions(-) diff --git a/Makefile b/Makefile index bfaaa48f..39983e66 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,8 @@ CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ -Wcast-align -Wwrite-strings -Wnested-externs -Winline endif -MODCFLAGS := $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer +MODCFLAGS := $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer +MODCFLAGS := $(MODCFLAGS) -DEXPORT_SYMTAB PROGCFLAGS := $(CFLAGS) ARCFLAGS := $(CFLAGS) LIBCFLAGS := $(CFLAGS) -fpic diff --git a/kernel/busses/i2c-ali15x3.c b/kernel/busses/i2c-ali15x3.c index 5170c7e0..d7ee603e 100644 --- a/kernel/busses/i2c-ali15x3.c +++ b/kernel/busses/i2c-ali15x3.c @@ -82,6 +82,12 @@ #include #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + /* undefine this if separate ACPI software is accessing the registers at the offset defined at 0x10. */ @@ -143,8 +149,8 @@ #define ALI15X3_STS_ERR 0xE0 /* all the bad error bits */ -static int ali15x3_init(void); -static int ali15x3_cleanup(void); +static int __init ali15x3_init(void); +static int __init ali15x3_cleanup(void); static int ali15x3_setup(void); static s32 ali15x3_access(struct i2c_adapter *adap, u8 addr, char read_write, u8 command, int size, union i2c_smbus_data * data); @@ -179,7 +185,7 @@ static struct i2c_adapter ali15x3_adapter = { NULL, }; -static int ali15x3_initialized; +static int __init ali15x3_initialized; #ifdef MAP_ACPI static unsigned short ali15x3_acpia = 0; #endif @@ -598,7 +604,7 @@ void ali15x3_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int ali15x3_init(void) +int __init ali15x3_init(void) { int res; printk("ali15x3.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -630,7 +636,7 @@ int ali15x3_init(void) return 0; } -int ali15x3_cleanup(void) +int __init ali15x3_cleanup(void) { int res; if (ali15x3_initialized >= 2) @@ -651,6 +657,8 @@ int ali15x3_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Frodo Looijaard , Philip Edelbrock , and Mark D. Studebaker "); diff --git a/kernel/busses/i2c-hydra.c b/kernel/busses/i2c-hydra.c index f8d5928e..1760e2e5 100644 --- a/kernel/busses/i2c-hydra.c +++ b/kernel/busses/i2c-hydra.c @@ -39,6 +39,11 @@ #include #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif /* PCI device */ #define VENDOR PCI_VENDOR_ID_APPLE @@ -171,7 +176,7 @@ static int find_hydra(void) return 0; } -int init_i2c_hydra(void) +int __init init_i2c_hydra(void) { if (find_hydra() < 0) { printk("Error while reading PCI configuration\n"); @@ -190,6 +195,8 @@ int init_i2c_hydra(void) } } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Geert Uytterhoeven "); MODULE_DESCRIPTION("i2c for Apple Hydra Mac I/O"); diff --git a/kernel/busses/i2c-isa.c b/kernel/busses/i2c-isa.c index f0d00947..407aadf6 100644 --- a/kernel/busses/i2c-isa.c +++ b/kernel/busses/i2c-isa.c @@ -29,14 +29,20 @@ #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + #include "version.h" #include "i2c-isa.h" static void isa_inc_use (struct i2c_adapter *adapter); static void isa_dec_use (struct i2c_adapter *adapter); -static int isa_init(void); -static int isa_cleanup(void); +static int __init isa_init(void); +static int __init isa_cleanup(void); #ifdef MODULE extern int init_module(void); @@ -66,7 +72,7 @@ static struct i2c_adapter isa_adapter = { }; /* Used in isa_init/cleanup */ -static int isa_initialized; +static int __init isa_initialized; void isa_inc_use (struct i2c_adapter *adapter) { @@ -82,7 +88,7 @@ void isa_dec_use (struct i2c_adapter *adapter) #endif } -int isa_init(void) +int __init isa_init(void) { int res; printk("i2c-isa.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -110,7 +116,7 @@ int isa_init(void) return 0; } -int isa_cleanup(void) +int __init isa_cleanup(void) { int res; if (isa_initialized >= 2) @@ -132,6 +138,8 @@ int isa_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Frodo Looijaard "); diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c index ba1533d0..b7b479de 100644 --- a/kernel/busses/i2c-piix4.c +++ b/kernel/busses/i2c-piix4.c @@ -36,6 +36,11 @@ #include #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif /* PIIX4 SMBus address offsets */ #define SMBHSTSTS (0 + piix4_smba) @@ -85,8 +90,8 @@ MODULE_PARM(force_addr,"i"); MODULE_PARM_DESC(force_addr,"Forcibly enable the PIIX4 at the given address. " "EXTREMELY DANGEROUS!"); -static int piix4_init(void); -static int piix4_cleanup(void); +static int __init piix4_init(void); +static int __init piix4_cleanup(void); static int piix4_setup(void); static s32 piix4_access(struct i2c_adapter *adap, u8 addr, char read_write, u8 command, int size, union i2c_smbus_data * data); @@ -121,7 +126,7 @@ static struct i2c_adapter piix4_adapter = { NULL, }; -static int piix4_initialized; +static int __init piix4_initialized; static unsigned short piix4_smba = 0; @@ -435,7 +440,7 @@ void piix4_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int piix4_init(void) +int __init piix4_init(void) { int res; printk("piix4.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -464,7 +469,7 @@ int piix4_init(void) return 0; } -int piix4_cleanup(void) +int __init piix4_cleanup(void) { int res; if (piix4_initialized >= 2) @@ -482,6 +487,8 @@ int piix4_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Frodo Looijaard and Philip Edelbrock "); diff --git a/kernel/busses/i2c-via.c b/kernel/busses/i2c-via.c index 8182369b..e6e99a77 100644 --- a/kernel/busses/i2c-via.c +++ b/kernel/busses/i2c-via.c @@ -33,6 +33,12 @@ #include #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + #include #include #include "compat.h" @@ -204,7 +210,7 @@ static int find_via(void) } #endif -static int init_i2c_via(void) +static int __init init_i2c_via(void) { if (find_via() < 0) { printk("Error while reading PCI configuration\n"); @@ -232,6 +238,8 @@ static int init_i2c_via(void) } } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Kyösti Mälkki "); MODULE_DESCRIPTION("i2c for Via vt82c586b southbridge"); diff --git a/kernel/busses/i2c-via2.c b/kernel/busses/i2c-via2.c index 67572d32..6139705d 100644 --- a/kernel/busses/i2c-via2.c +++ b/kernel/busses/i2c-via2.c @@ -36,6 +36,13 @@ #include #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + #ifndef PCI_DEVICE_ID_VIA_82C596_3 #define PCI_DEVICE_ID_VIA_82C596_3 0x3050 #endif @@ -100,8 +107,8 @@ MODULE_PARM(force_addr,"i"); MODULE_PARM_DESC(force_addr,"Forcibly enable the VT82C596 SMBus at the given address. " "EXTREMELY DANGEROUS!"); -static int vt596_init(void); -static int vt596_cleanup(void); +static int __init vt596_init(void); +static int __init vt596_cleanup(void); static int vt596_setup(void); static s32 vt596_access(struct i2c_adapter *adap, u8 addr, char read_write, u8 command, int size, union i2c_smbus_data * data); @@ -136,7 +143,7 @@ static struct i2c_adapter vt596_adapter = { NULL, }; -static int vt596_initialized; +static int __init vt596_initialized; static unsigned short vt596_smba = 0; @@ -470,7 +477,7 @@ void vt596_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int vt596_init(void) +int __init vt596_init(void) { int res; printk("via2.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -499,7 +506,7 @@ int vt596_init(void) return 0; } -int vt596_cleanup(void) +int __init vt596_cleanup(void) { int res; if (vt596_initialized >= 2) @@ -517,11 +524,14 @@ int vt596_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Frodo Looijaard and Philip Edelbrock "); MODULE_DESCRIPTION("vt82c596 SMBus driver"); + int init_module(void) { return vt596_init(); diff --git a/kernel/busses/i2c-viapro.c b/kernel/busses/i2c-viapro.c index 67572d32..6139705d 100644 --- a/kernel/busses/i2c-viapro.c +++ b/kernel/busses/i2c-viapro.c @@ -36,6 +36,13 @@ #include #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + #ifndef PCI_DEVICE_ID_VIA_82C596_3 #define PCI_DEVICE_ID_VIA_82C596_3 0x3050 #endif @@ -100,8 +107,8 @@ MODULE_PARM(force_addr,"i"); MODULE_PARM_DESC(force_addr,"Forcibly enable the VT82C596 SMBus at the given address. " "EXTREMELY DANGEROUS!"); -static int vt596_init(void); -static int vt596_cleanup(void); +static int __init vt596_init(void); +static int __init vt596_cleanup(void); static int vt596_setup(void); static s32 vt596_access(struct i2c_adapter *adap, u8 addr, char read_write, u8 command, int size, union i2c_smbus_data * data); @@ -136,7 +143,7 @@ static struct i2c_adapter vt596_adapter = { NULL, }; -static int vt596_initialized; +static int __init vt596_initialized; static unsigned short vt596_smba = 0; @@ -470,7 +477,7 @@ void vt596_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int vt596_init(void) +int __init vt596_init(void) { int res; printk("via2.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -499,7 +506,7 @@ int vt596_init(void) return 0; } -int vt596_cleanup(void) +int __init vt596_cleanup(void) { int res; if (vt596_initialized >= 2) @@ -517,11 +524,14 @@ int vt596_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Frodo Looijaard and Philip Edelbrock "); MODULE_DESCRIPTION("vt82c596 SMBus driver"); + int init_module(void) { return vt596_init(); diff --git a/kernel/busses/i2c-voodoo3.c b/kernel/busses/i2c-voodoo3.c index 55a70695..75201b46 100644 --- a/kernel/busses/i2c-voodoo3.c +++ b/kernel/busses/i2c-voodoo3.c @@ -44,6 +44,12 @@ #include #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + /* 3DFX defines */ #ifndef PCI_VENDOR_ID_3DFX #define PCI_VENDOR_ID_3DFX 0x121a @@ -52,8 +58,8 @@ #define PCI_DEVICE_ID_3DFX_VOODOO3 0x05 #endif -static int voodoo3_init(void); -static int voodoo3_cleanup(void); +static int __init voodoo3_init(void); +static int __init voodoo3_cleanup(void); static int voodoo3_setup(void); static s32 voodoo3_access(struct i2c_adapter *adap, u8 addr, char read_write, u8 command, int size, union i2c_smbus_data * data); @@ -73,20 +79,6 @@ static void config_v3(struct pci_dev *dev, int num); static void voodoo3_inc(struct i2c_adapter *adapter); static void voodoo3_dec(struct i2c_adapter *adapter); - - - - - - - - - - - - - - #ifdef MODULE extern int init_module(void); extern int cleanup_module(void); @@ -113,7 +105,7 @@ static struct i2c_adapter voodoo3_adapter = { NULL, }; -static int voodoo3_initialized; +static int __init voodoo3_initialized; static unsigned short voodoo3_smba = 0; static unsigned int state=0xcf980020; static unsigned char *mem; @@ -533,7 +525,7 @@ void voodoo3_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int voodoo3_init(void) +int __init voodoo3_init(void) { int res; printk("i2c-voodoo3.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -562,7 +554,7 @@ int voodoo3_init(void) return 0; } -int voodoo3_cleanup(void) +int __init voodoo3_cleanup(void) { int res; @@ -581,11 +573,14 @@ int voodoo3_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; + #ifdef MODULE MODULE_AUTHOR("Frodo Looijaard and Philip Edelbrock and Ralph Metzler "); MODULE_DESCRIPTION("Voodoo3 I2C/SMBus driver"); + int init_module(void) { return voodoo3_init(); diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index 3e9b69b3..27ae6e76 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -27,6 +27,12 @@ #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x18,0x1a,0x29,0x2b, @@ -101,8 +107,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int adm1021_init(void); -static int adm1021_cleanup(void); +static int __init adm1021_init(void); +static int __init adm1021_cleanup(void); static int adm1021_attach_adapter(struct i2c_adapter *adapter); static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind); static void adm1021_init_client(struct i2c_client *client); @@ -165,7 +171,7 @@ static ctl_table adm1021_max_dir_table_template[] = { /* Used by init/cleanup */ -static int adm1021_initialized = 0; +static int __init adm1021_initialized = 0; /* I choose here for semi-static allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -489,7 +495,7 @@ void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name, } } -int adm1021_init(void) +int __init adm1021_init(void) { int res; @@ -504,7 +510,7 @@ int adm1021_init(void) return 0; } -int adm1021_cleanup(void) +int __init adm1021_cleanup(void) { int res; @@ -519,6 +525,7 @@ int adm1021_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/adm9240.c b/kernel/chips/adm9240.c index 96a8a1a4..a819b3b8 100644 --- a/kernel/chips/adm9240.c +++ b/kernel/chips/adm9240.c @@ -59,6 +59,11 @@ #include "i2c-isa.h" #include "sensors.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif /* Addresses to scan */ @@ -233,8 +238,8 @@ struct adm9240_data { }; -static int adm9240_init(void); -static int adm9240_cleanup(void); +static int __init adm9240_init(void); +static int __init adm9240_cleanup(void); static int adm9240_attach_adapter(struct i2c_adapter *adapter); static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind); @@ -283,7 +288,7 @@ static struct i2c_driver adm9240_driver = { }; /* Used by adm9240_init/cleanup */ -static int adm9240_initialized = 0; +static int __init adm9240_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected ADM9240. This is just a template; @@ -748,7 +753,7 @@ void adm9240_vid(struct i2c_client *client, int operation, int ctl_name, } } -int adm9240_init(void) +int __init adm9240_init(void) { int res; @@ -764,7 +769,7 @@ int adm9240_init(void) return 0; } -int adm9240_cleanup(void) +int __init adm9240_cleanup(void) { int res; @@ -778,6 +783,7 @@ int adm9240_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/bt869.c b/kernel/chips/bt869.c index bfa4690b..32e2b6cf 100644 --- a/kernel/chips/bt869.c +++ b/kernel/chips/bt869.c @@ -28,6 +28,12 @@ #include "i2c-isa.h" #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; @@ -76,8 +82,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int bt869_init(void); -static int bt869_cleanup(void); +static int __init bt869_init(void); +static int __init bt869_cleanup(void); static int bt869_attach_adapter(struct i2c_adapter *adapter); static int bt869_detect(struct i2c_adapter *adapter, int address, int kind); static void bt869_init_client(struct i2c_client *client); @@ -137,7 +143,7 @@ static ctl_table bt869_dir_table_template[] = { }; /* Used by init/cleanup */ -static int bt869_initialized = 0; +static int __init bt869_initialized = 0; /* I choose here for semi-static bt869 allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -518,7 +524,7 @@ void bt869_depth(struct i2c_client *client, int operation, int ctl_name, } } -int bt869_init(void) +int __init bt869_init(void) { int res; @@ -533,7 +539,7 @@ int bt869_init(void) return 0; } -int bt869_cleanup(void) +int __init bt869_cleanup(void) { int res; @@ -548,6 +554,7 @@ int bt869_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/eeprom.c b/kernel/chips/eeprom.c index b01c65a3..24dbe32b 100644 --- a/kernel/chips/eeprom.c +++ b/kernel/chips/eeprom.c @@ -27,6 +27,13 @@ #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x50,0x57,SENSORS_I2C_END}; @@ -74,8 +81,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int eeprom_init(void); -static int eeprom_cleanup(void); +static int __init eeprom_init(void); +static int __init eeprom_cleanup(void); static int eeprom_attach_adapter(struct i2c_adapter *adapter); static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind); @@ -133,7 +140,7 @@ static ctl_table eeprom_dir_table_template[] = { }; /* Used by init/cleanup */ -static int eeprom_initialized = 0; +static int __init eeprom_initialized = 0; /* I choose here for semi-static LM78 allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -383,7 +390,7 @@ void eeprom_contents(struct i2c_client *client, int operation, int ctl_name, } } -int eeprom_init(void) +int __init eeprom_init(void) { int res; @@ -398,7 +405,7 @@ int eeprom_init(void) return 0; } -int eeprom_cleanup(void) +int __init eeprom_cleanup(void) { int res; @@ -413,6 +420,7 @@ int eeprom_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/gl518sm.c b/kernel/chips/gl518sm.c index ac27f715..fd51afea 100644 --- a/kernel/chips/gl518sm.c +++ b/kernel/chips/gl518sm.c @@ -28,6 +28,12 @@ #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2c,0x2d,SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {SENSORS_I2C_END}; @@ -168,8 +174,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int gl518_init(void); -static int gl518_cleanup(void); +static int __init gl518_init(void); +static int __init gl518_cleanup(void); static int gl518_attach_adapter(struct i2c_adapter *adapter); static int gl518_detect(struct i2c_adapter *adapter, int address, int kind); static void gl518_init_client(struct i2c_client *client); @@ -248,7 +254,7 @@ static ctl_table gl518_dir_table_template[] = { }; /* Used by init/cleanup */ -static int gl518_initialized = 0; +static int __init gl518_initialized = 0; /* I choose here for semi-static GL518SM allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -897,7 +903,7 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name, } } -int gl518_init(void) +int __init gl518_init(void) { int res; @@ -912,7 +918,7 @@ int gl518_init(void) return 0; } -int gl518_cleanup(void) +int __init gl518_cleanup(void) { int res; @@ -927,6 +933,7 @@ int gl518_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/gl520sm.c b/kernel/chips/gl520sm.c index 7f54e052..2c340fa8 100644 --- a/kernel/chips/gl520sm.c +++ b/kernel/chips/gl520sm.c @@ -28,6 +28,13 @@ #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2c,0x2d,SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {SENSORS_I2C_END}; @@ -171,8 +178,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int gl520_init(void); -static int gl520_cleanup(void); +static int __init gl520_init(void); +static int __init gl520_cleanup(void); static int gl520_attach_adapter(struct i2c_adapter *adapter); static int gl520_detect(struct i2c_adapter *adapter, int address, int kind); static void gl520_init_client(struct i2c_client *client); @@ -257,7 +264,7 @@ static ctl_table gl520_dir_table_template[] = { }; /* Used by init/cleanup */ -static int gl520_initialized = 0; +static int __init gl520_initialized = 0; /* I choose here for semi-static GL520SM allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -784,7 +791,7 @@ void gl520_config(struct i2c_client *client, int operation, int ctl_name, } } -int gl520_init(void) +int __init gl520_init(void) { int res; @@ -799,7 +806,7 @@ int gl520_init(void) return 0; } -int gl520_cleanup(void) +int __init gl520_cleanup(void) { int res; @@ -814,6 +821,7 @@ int gl520_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/icspll.c b/kernel/chips/icspll.c index 4299d30b..10f769ed 100644 --- a/kernel/chips/icspll.c +++ b/kernel/chips/icspll.c @@ -34,6 +34,12 @@ #include "sensors.h" #include "i2c-isa.h" #include "version.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + /* Many constants specified below */ @@ -57,8 +63,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int icspll_init(void); -static int icspll_cleanup(void); +static int __init icspll_init(void); +static int __init icspll_cleanup(void); static int icspll_attach_adapter(struct i2c_adapter *adapter); static int icspll_detach_client(struct i2c_client *client); @@ -104,7 +110,7 @@ static ctl_table icspll_dir_table_template[] = { static u8 tempdata[MAXBLOCK_SIZE]; /* Used by init/cleanup */ -static int icspll_initialized = 0; +static int __init icspll_initialized = 0; /* I choose here for semi-static allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -313,7 +319,7 @@ void icspll_contents(struct i2c_client *client, int operation, int ctl_name, } } -int icspll_init(void) +int __init icspll_init(void) { int res; @@ -328,7 +334,7 @@ int icspll_init(void) return 0; } -int icspll_cleanup(void) +int __init icspll_cleanup(void) { int res; @@ -343,6 +349,7 @@ int icspll_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/lm75.c b/kernel/chips/lm75.c index 46748f74..d319ba2b 100644 --- a/kernel/chips/lm75.c +++ b/kernel/chips/lm75.c @@ -26,6 +26,13 @@ #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x48,0x4f,SENSORS_I2C_END}; @@ -70,8 +77,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int lm75_init(void); -static int lm75_cleanup(void); +static int __init lm75_init(void); +static int __init lm75_cleanup(void); static int lm75_attach_adapter(struct i2c_adapter *adapter); static int lm75_detect(struct i2c_adapter *adapter, int address, int kind); static void lm75_init_client(struct i2c_client *client); @@ -112,7 +119,7 @@ static ctl_table lm75_dir_table_template[] = { }; /* Used by init/cleanup */ -static int lm75_initialized = 0; +static int __init lm75_initialized = 0; /* I choose here for semi-static LM75 allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -371,7 +378,7 @@ void lm75_temp(struct i2c_client *client, int operation, int ctl_name, } } -int lm75_init(void) +int __init lm75_init(void) { int res; @@ -386,7 +393,7 @@ int lm75_init(void) return 0; } -int lm75_cleanup(void) +int __init lm75_cleanup(void) { int res; @@ -401,6 +408,7 @@ int lm75_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c index f24cefdd..9ea3e176 100644 --- a/kernel/chips/lm78.c +++ b/kernel/chips/lm78.c @@ -32,6 +32,13 @@ #include "sensors.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x20,0x2f,SENSORS_I2C_END}; @@ -195,8 +202,8 @@ struct lm78_data { }; -static int lm78_init(void); -static int lm78_cleanup(void); +static int __init lm78_init(void); +static int __init lm78_cleanup(void); static int lm78_attach_adapter(struct i2c_adapter *adapter); static int lm78_detect(struct i2c_adapter *adapter, int address, int kind); @@ -243,7 +250,7 @@ static struct i2c_driver lm78_driver = { }; /* Used by lm78_init/cleanup */ -static int lm78_initialized = 0; +static int __init lm78_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected LM78. This is just a template; @@ -780,7 +787,7 @@ void lm78_fan_div(struct i2c_client *client, int operation, int ctl_name, } } -int lm78_init(void) +int __init lm78_init(void) { int res; @@ -796,7 +803,7 @@ int lm78_init(void) return 0; } -int lm78_cleanup(void) +int __init lm78_cleanup(void) { int res; @@ -810,6 +817,7 @@ int lm78_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/lm80.c b/kernel/chips/lm80.c index 458e2d57..591fcdc3 100644 --- a/kernel/chips/lm80.c +++ b/kernel/chips/lm80.c @@ -33,6 +33,13 @@ #include "sensors.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x20,0x2f,SENSORS_I2C_END}; @@ -190,8 +197,8 @@ struct lm80_data { }; -static int lm80_init(void); -static int lm80_cleanup(void); +static int __init lm80_init(void); +static int __init lm80_cleanup(void); static int lm80_attach_adapter(struct i2c_adapter *adapter); static int lm80_detect(struct i2c_adapter *adapter, int address, int kind); @@ -236,7 +243,7 @@ static struct i2c_driver lm80_driver = { }; /* Used by lm80_init/cleanup */ -static int lm80_initialized = 0; +static int __init lm80_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected LM80. This is just a template; @@ -664,7 +671,7 @@ void lm80_fan_div(struct i2c_client *client, int operation, int ctl_name, } } -int lm80_init(void) +int __init lm80_init(void) { int res; @@ -680,7 +687,7 @@ int lm80_init(void) return 0; } -int lm80_cleanup(void) +int __init lm80_cleanup(void) { int res; @@ -694,6 +701,7 @@ int lm80_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/ltc1710.c b/kernel/chips/ltc1710.c index fcc2f507..32af96e5 100644 --- a/kernel/chips/ltc1710.c +++ b/kernel/chips/ltc1710.c @@ -49,6 +49,13 @@ #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan */ static unsigned short normal_i2c[] = {SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {0x58,0x5a,SENSORS_I2C_END}; @@ -81,8 +88,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int ltc1710_init(void); -static int ltc1710_cleanup(void); +static int __init ltc1710_init(void); +static int __init ltc1710_cleanup(void); static int ltc1710_attach_adapter(struct i2c_adapter *adapter); static int ltc1710_detect(struct i2c_adapter *adapter, int address, int kind); static int ltc1710_detach_client(struct i2c_client *client); @@ -123,7 +130,7 @@ static ctl_table ltc1710_dir_table_template[] = { }; /* Used by init/cleanup */ -static int ltc1710_initialized = 0; +static int __init ltc1710_initialized = 0; /* I choose here for semi-static LTC1710 allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -347,7 +354,7 @@ void ltc1710_switch2(struct i2c_client *client, int operation, int ctl_name, } } -int ltc1710_init(void) +int __init ltc1710_init(void) { int res; @@ -362,7 +369,7 @@ int ltc1710_init(void) return 0; } -int ltc1710_cleanup(void) +int __init ltc1710_cleanup(void) { int res; @@ -377,6 +384,7 @@ int ltc1710_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/matorb.c b/kernel/chips/matorb.c index c4b5bf9e..86e741e2 100644 --- a/kernel/chips/matorb.c +++ b/kernel/chips/matorb.c @@ -30,6 +30,13 @@ #include "version.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2E,SENSORS_I2C_END}; static unsigned short normal_i2c_range[] = {SENSORS_I2C_END}; @@ -57,8 +64,8 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int matorb_init(void); -static int matorb_cleanup(void); +static int __init matorb_init(void); +static int __init matorb_cleanup(void); static int matorb_attach_adapter(struct i2c_adapter *adapter); static int matorb_detect(struct i2c_adapter *adapter, int address, int kind); static void matorb_init_client(struct i2c_client *client); @@ -97,7 +104,7 @@ static ctl_table matorb_dir_table_template[] = { }; /* Used by init/cleanup */ -static int matorb_initialized = 0; +static int __init matorb_initialized = 0; /* I choose here for semi-static MATORB allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -317,7 +324,7 @@ int i; } } -int matorb_init(void) +int __init matorb_init(void) { int res; @@ -332,7 +339,7 @@ int matorb_init(void) return 0; } -int matorb_cleanup(void) +int __init matorb_cleanup(void) { int res; @@ -347,6 +354,7 @@ int matorb_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/maxilife.c b/kernel/chips/maxilife.c index 1881ed30..ae25a74f 100644 --- a/kernel/chips/maxilife.c +++ b/kernel/chips/maxilife.c @@ -51,6 +51,13 @@ static const char *version_str = "1.00 25/2/99 Fons Rademakers"; #include "sensors.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + #undef AUTODETECT /* try to autodetect MaxiLife version */ #define NOWRITE /* don't allow writing to MaxiLife registers */ @@ -151,8 +158,8 @@ struct maxi_data { }; -static int maxi_init(void); -static int maxi_cleanup(void); +static int __init maxi_init(void); +static int __init maxi_cleanup(void); static int maxi_attach_adapter(struct i2c_adapter *adapter); static int maxi_detect_smbus(struct i2c_adapter *adapter); @@ -205,7 +212,7 @@ static struct i2c_driver maxi_driver = { }; /* Used by maxi_init/cleanup */ -static int maxi_initialized = 0; +static int __init maxi_initialized = 0; /* Default firmware version. Use module option "maxi_version" to set desired version. Auto detect is not yet working */ @@ -709,7 +716,7 @@ void maxi_alarms(struct i2c_client *client, int operation, int ctl_name, } } -int maxi_init(void) +int __init maxi_init(void) { int res; @@ -726,7 +733,7 @@ int maxi_init(void) return 0; } -int maxi_cleanup(void) +int __init maxi_cleanup(void) { int res; @@ -740,6 +747,7 @@ int maxi_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/sis5595.c b/kernel/chips/sis5595.c index 1bbe36bb..9c37e224 100644 --- a/kernel/chips/sis5595.c +++ b/kernel/chips/sis5595.c @@ -38,6 +38,13 @@ #include "sensors.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + + /* Addresses to scan. Note that we can't determine the ISA address until we have initialized our module */ @@ -175,8 +182,8 @@ struct sis5595_data { }; -static int sis5595_init(void); -static int sis5595_cleanup(void); +static int __init sis5595_init(void); +static int __init sis5595_cleanup(void); static int sis5595_attach_adapter(struct i2c_adapter *adapter); static int sis5595_detect(struct i2c_adapter *adapter, int address, int kind); @@ -224,7 +231,7 @@ static struct i2c_driver sis5595_driver = { }; /* Used by sis5595_init/cleanup */ -static int sis5595_initialized = 0; +static int __init sis5595_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected SIS5595. This is just a template; @@ -705,7 +712,7 @@ void sis5595_fan_div(struct i2c_client *client, int operation, int ctl_name, } } -int sis5595_init(void) +int __init sis5595_init(void) { int res,addr; @@ -727,7 +734,7 @@ int sis5595_init(void) return 0; } -int sis5595_cleanup(void) +int __init sis5595_cleanup(void) { int res; @@ -741,6 +748,7 @@ int sis5595_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 506fba2f..177c31a5 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -44,6 +44,12 @@ #include "sensors.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif + /* RT Table support #defined so we can take it out if it gets bothersome */ #define W83781D_RT 1 @@ -348,8 +354,8 @@ struct w83781d_data { }; -static int w83781d_init(void); -static int w83781d_cleanup(void); +static int __init w83781d_init(void); +static int __init w83781d_cleanup(void); static int w83781d_attach_adapter(struct i2c_adapter *adapter); static int w83781d_detect(struct i2c_adapter *adapter, int address, int kind); @@ -409,7 +415,7 @@ static struct i2c_driver w83781d_driver = { }; /* Used by w83781d_init/cleanup */ -static int w83781d_initialized = 0; +static int __init w83781d_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected W83781D. This is just a template; @@ -1479,7 +1485,7 @@ void w83781d_rt(struct i2c_client *client, int operation, int ctl_name, } #endif -int w83781d_init(void) +int __init w83781d_init(void) { int res; @@ -1495,7 +1501,7 @@ int w83781d_init(void) return 0; } -int w83781d_cleanup(void) +int __init w83781d_cleanup(void) { int res; @@ -1509,6 +1515,7 @@ int w83781d_cleanup(void) return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE @@ -1528,6 +1535,3 @@ int cleanup_module(void) #endif /* MODULE */ - - - diff --git a/kernel/sensors.c b/kernel/sensors.c index 75ae2d56..e2e6e02f 100644 --- a/kernel/sensors.c +++ b/kernel/sensors.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include @@ -30,10 +31,16 @@ #include "sensors.h" #include "compat.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) +#include +#else +#define __init +#endif #ifdef MODULE extern int init_module(void); extern int cleanup_module(void); +static int sensors_cleanup(void); #endif /* MODULE */ static int sensors_create_name(char **name, const char *prefix, @@ -48,8 +55,7 @@ static int sensors_sysctl_chips (ctl_table *table, int *name, int nlen, void *oldval, size_t *oldlenp, void *newval, size_t newlen, void **context); -static int sensors_init(void); -static int sensors_cleanup(void); +static int __init sensors_init(void); #define SENSORS_ENTRY_MAX 20 static struct ctl_table_header *sensors_entries[SENSORS_ENTRY_MAX]; @@ -742,7 +748,7 @@ int sensors_detect(struct i2c_adapter *adapter, return 0; } -int sensors_init(void) +int __init sensors_init(void) { printk("sensors.o version %s (%s)\n",LM_VERSION,LM_DATE); sensors_initialized = 0; @@ -755,6 +761,17 @@ int sensors_init(void) return 0; } +EXPORT_SYMBOL(sensors_deregister_entry); +EXPORT_SYMBOL(sensors_detect); +EXPORT_SYMBOL(sensors_proc_real); +EXPORT_SYMBOL(sensors_register_entry); +EXPORT_SYMBOL(sensors_sysctl_real); + +#ifdef MODULE + +MODULE_AUTHOR("Frodo Looijaard "); +MODULE_DESCRIPTION("LM78 driver"); + int sensors_cleanup(void) { if (sensors_initialized >= 1) { @@ -764,11 +781,6 @@ int sensors_cleanup(void) return 0; } -#ifdef MODULE - -MODULE_AUTHOR("Frodo Looijaard "); -MODULE_DESCRIPTION("LM78 driver"); - int init_module(void) { return sensors_init();