diff --git a/TODO b/TODO index 007727d7..a0bef033 100644 --- a/TODO +++ b/TODO @@ -3,8 +3,6 @@ Many, many things. Most notably: I2C CODE CHANGES ================ -* Add code and supporting files to compile modules into the main kernel -* Write a mkpatch script, as in the i2c tree * Check what happens if the ISA bus is selected by a force parameter; I think the _detect procedures are called?!? * Update all documentation diff --git a/doc/busses/i2c-via b/doc/busses/i2c-via index af08b08f..b7a0a77d 100644 --- a/doc/busses/i2c-via +++ b/doc/busses/i2c-via @@ -1,4 +1,4 @@ -Kernel driver `i2c-piix4.o' +Kernel driver `i2c-via.o' Status: Complete and well-tested diff --git a/kernel/busses/i2c-ali15x3.c b/kernel/busses/i2c-ali15x3.c index d7ee603e..1772c5a7 100644 --- a/kernel/busses/i2c-ali15x3.c +++ b/kernel/busses/i2c-ali15x3.c @@ -86,6 +86,7 @@ #include #else #define __init +#define __initdata #endif /* undefine this if separate ACPI software is accessing the @@ -149,7 +150,12 @@ #define ALI15X3_STS_ERR 0xE0 /* all the bad error bits */ -static int __init ali15x3_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init i2c_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, @@ -185,7 +191,7 @@ static struct i2c_adapter ali15x3_adapter = { NULL, }; -static int __init ali15x3_initialized; +static int __initdata ali15x3_initialized; #ifdef MAP_ACPI static unsigned short ali15x3_acpia = 0; #endif @@ -604,7 +610,7 @@ void ali15x3_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int __init ali15x3_init(void) +int __init i2c_ali15x3_init(void) { int res; printk("ali15x3.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -666,7 +672,7 @@ MODULE_DESCRIPTION("ALI15X3 SMBus driver"); int init_module(void) { - return ali15x3_init(); + return i2c_ali15x3_init(); } int cleanup_module(void) diff --git a/kernel/busses/i2c-hydra.c b/kernel/busses/i2c-hydra.c index 1760e2e5..3d71daf8 100644 --- a/kernel/busses/i2c-hydra.c +++ b/kernel/busses/i2c-hydra.c @@ -43,6 +43,7 @@ #include #else #define __init +#define __initdata #endif /* PCI device */ @@ -176,7 +177,12 @@ static int find_hydra(void) return 0; } -int __init init_i2c_hydra(void) +#ifdef MODULE +static +#else +extern +#endif + int __init i2c_init_i2c_hydra(void) { if (find_hydra() < 0) { printk("Error while reading PCI configuration\n"); @@ -203,7 +209,7 @@ MODULE_DESCRIPTION("i2c for Apple Hydra Mac I/O"); int init_module(void) { - return init_i2c_hydra(); + return i2c_init_i2c_hydra(); } void cleanup_module(void) diff --git a/kernel/busses/i2c-isa.c b/kernel/busses/i2c-isa.c index 407aadf6..35fb1903 100644 --- a/kernel/busses/i2c-isa.c +++ b/kernel/busses/i2c-isa.c @@ -33,6 +33,7 @@ #include #else #define __init +#define __initdata #endif #include "version.h" @@ -41,7 +42,12 @@ static void isa_inc_use (struct i2c_adapter *adapter); static void isa_dec_use (struct i2c_adapter *adapter); -static int __init isa_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init i2c_isa_init(void); static int __init isa_cleanup(void); #ifdef MODULE @@ -72,7 +78,7 @@ static struct i2c_adapter isa_adapter = { }; /* Used in isa_init/cleanup */ -static int __init isa_initialized; +static int __initdata isa_initialized; void isa_inc_use (struct i2c_adapter *adapter) { @@ -88,7 +94,7 @@ void isa_dec_use (struct i2c_adapter *adapter) #endif } -int __init isa_init(void) +int __init i2c_isa_init(void) { int res; printk("i2c-isa.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -147,7 +153,7 @@ MODULE_DESCRIPTION("ISA bus access through i2c"); int init_module(void) { - return isa_init(); + return i2c_isa_init(); } int cleanup_module(void) diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c index b7b479de..fab14b20 100644 --- a/kernel/busses/i2c-piix4.c +++ b/kernel/busses/i2c-piix4.c @@ -40,6 +40,7 @@ #include #else #define __init +#define __initdata #endif /* PIIX4 SMBus address offsets */ @@ -90,7 +91,12 @@ MODULE_PARM(force_addr,"i"); MODULE_PARM_DESC(force_addr,"Forcibly enable the PIIX4 at the given address. " "EXTREMELY DANGEROUS!"); -static int __init piix4_init(void); +#ifdef MODULE +static +#else +extern +#endif + 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, @@ -126,7 +132,7 @@ static struct i2c_adapter piix4_adapter = { NULL, }; -static int __init piix4_initialized; +static int __initdata piix4_initialized; static unsigned short piix4_smba = 0; @@ -440,7 +446,7 @@ void piix4_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int __init piix4_init(void) +int __init i2c_piix4_init(void) { int res; printk("piix4.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -496,7 +502,7 @@ MODULE_DESCRIPTION("PIIX4 SMBus driver"); int init_module(void) { - return piix4_init(); + return i2c_piix4_init(); } int cleanup_module(void) diff --git a/kernel/busses/i2c-via.c b/kernel/busses/i2c-via.c index e6e99a77..5c9820ca 100644 --- a/kernel/busses/i2c-via.c +++ b/kernel/busses/i2c-via.c @@ -37,6 +37,7 @@ #include #else #define __init +#define __initdata #endif #include @@ -210,7 +211,12 @@ static int find_via(void) } #endif -static int __init init_i2c_via(void) +#ifdef MODULE +static +#else +extern +#endif + int __init i2c_init_i2c_via(void) { if (find_via() < 0) { printk("Error while reading PCI configuration\n"); @@ -246,7 +252,7 @@ MODULE_DESCRIPTION("i2c for Via vt82c586b southbridge"); int init_module(void) { - return init_i2c_via(); + return i2c_init_i2c_via(); } void cleanup_module(void) diff --git a/kernel/busses/i2c-via2.c b/kernel/busses/i2c-via2.c index 6139705d..4499db51 100644 --- a/kernel/busses/i2c-via2.c +++ b/kernel/busses/i2c-via2.c @@ -40,6 +40,7 @@ #include #else #define __init +#define __initdata #endif @@ -107,7 +108,12 @@ MODULE_PARM(force_addr,"i"); MODULE_PARM_DESC(force_addr,"Forcibly enable the VT82C596 SMBus at the given address. " "EXTREMELY DANGEROUS!"); -static int __init vt596_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init i2c_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, @@ -143,7 +149,7 @@ static struct i2c_adapter vt596_adapter = { NULL, }; -static int __init vt596_initialized; +static int __initdata vt596_initialized; static unsigned short vt596_smba = 0; @@ -477,7 +483,7 @@ void vt596_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int __init vt596_init(void) +int __init i2c_vt596_init(void) { int res; printk("via2.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -534,7 +540,7 @@ MODULE_DESCRIPTION("vt82c596 SMBus driver"); int init_module(void) { - return vt596_init(); + return i2c_vt596_init(); } int cleanup_module(void) diff --git a/kernel/busses/i2c-viapro.c b/kernel/busses/i2c-viapro.c index 6139705d..4499db51 100644 --- a/kernel/busses/i2c-viapro.c +++ b/kernel/busses/i2c-viapro.c @@ -40,6 +40,7 @@ #include #else #define __init +#define __initdata #endif @@ -107,7 +108,12 @@ MODULE_PARM(force_addr,"i"); MODULE_PARM_DESC(force_addr,"Forcibly enable the VT82C596 SMBus at the given address. " "EXTREMELY DANGEROUS!"); -static int __init vt596_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init i2c_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, @@ -143,7 +149,7 @@ static struct i2c_adapter vt596_adapter = { NULL, }; -static int __init vt596_initialized; +static int __initdata vt596_initialized; static unsigned short vt596_smba = 0; @@ -477,7 +483,7 @@ void vt596_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int __init vt596_init(void) +int __init i2c_vt596_init(void) { int res; printk("via2.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -534,7 +540,7 @@ MODULE_DESCRIPTION("vt82c596 SMBus driver"); int init_module(void) { - return vt596_init(); + return i2c_vt596_init(); } int cleanup_module(void) diff --git a/kernel/busses/i2c-voodoo3.c b/kernel/busses/i2c-voodoo3.c index 75201b46..443c6f07 100644 --- a/kernel/busses/i2c-voodoo3.c +++ b/kernel/busses/i2c-voodoo3.c @@ -48,6 +48,7 @@ #include #else #define __init +#define __initdata #endif /* 3DFX defines */ @@ -58,7 +59,12 @@ #define PCI_DEVICE_ID_3DFX_VOODOO3 0x05 #endif -static int __init voodoo3_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init i2c_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, @@ -105,7 +111,7 @@ static struct i2c_adapter voodoo3_adapter = { NULL, }; -static int __init voodoo3_initialized; +static int __initdata voodoo3_initialized; static unsigned short voodoo3_smba = 0; static unsigned int state=0xcf980020; static unsigned char *mem; @@ -525,7 +531,7 @@ void voodoo3_dec(struct i2c_adapter *adapter) MOD_DEC_USE_COUNT; } -int __init voodoo3_init(void) +int __init i2c_voodoo3_init(void) { int res; printk("i2c-voodoo3.o version %s (%s)\n",LM_VERSION,LM_DATE); @@ -583,7 +589,7 @@ MODULE_DESCRIPTION("Voodoo3 I2C/SMBus driver"); int init_module(void) { - return voodoo3_init(); + return i2c_voodoo3_init(); } int cleanup_module(void) diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index 27ae6e76..cd1f2832 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -31,6 +31,7 @@ #include #else #define __init +#define __initdata #endif /* Addresses to scan */ @@ -107,7 +108,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init adm1021_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_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); @@ -171,7 +177,7 @@ static ctl_table adm1021_max_dir_table_template[] = { /* Used by init/cleanup */ -static int __init adm1021_initialized = 0; +static int __initdata adm1021_initialized = 0; /* I choose here for semi-static allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -495,7 +501,7 @@ void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name, } } -int __init adm1021_init(void) +int __init sensors_adm1021_init(void) { int res; @@ -534,7 +540,7 @@ MODULE_DESCRIPTION("adm1021 driver"); int init_module(void) { - return adm1021_init(); + return sensors_adm1021_init(); } int cleanup_module(void) diff --git a/kernel/chips/adm9240.c b/kernel/chips/adm9240.c index a819b3b8..884fd086 100644 --- a/kernel/chips/adm9240.c +++ b/kernel/chips/adm9240.c @@ -63,6 +63,7 @@ #include #else #define __init +#define __initdata #endif @@ -238,7 +239,12 @@ struct adm9240_data { }; -static int __init adm9240_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_adm9240_init(void); static int __init adm9240_cleanup(void); static int adm9240_attach_adapter(struct i2c_adapter *adapter); @@ -288,7 +294,7 @@ static struct i2c_driver adm9240_driver = { }; /* Used by adm9240_init/cleanup */ -static int __init adm9240_initialized = 0; +static int __initdata adm9240_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected ADM9240. This is just a template; @@ -753,7 +759,7 @@ void adm9240_vid(struct i2c_client *client, int operation, int ctl_name, } } -int __init adm9240_init(void) +int __init sensors_adm9240_init(void) { int res; @@ -792,7 +798,7 @@ MODULE_DESCRIPTION("ADM9240 driver"); int init_module(void) { - return adm9240_init(); + return sensors_adm9240_init(); } int cleanup_module(void) diff --git a/kernel/chips/bt869.c b/kernel/chips/bt869.c index 32e2b6cf..01d30f51 100644 --- a/kernel/chips/bt869.c +++ b/kernel/chips/bt869.c @@ -32,6 +32,7 @@ #include #else #define __init +#define __initdata #endif @@ -82,7 +83,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init bt869_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_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); @@ -143,7 +149,7 @@ static ctl_table bt869_dir_table_template[] = { }; /* Used by init/cleanup */ -static int __init bt869_initialized = 0; +static int __initdata 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 @@ -524,7 +530,7 @@ void bt869_depth(struct i2c_client *client, int operation, int ctl_name, } } -int __init bt869_init(void) +int __init sensors_bt869_init(void) { int res; @@ -563,7 +569,7 @@ MODULE_DESCRIPTION("bt869 driver"); int init_module(void) { - return bt869_init(); + return sensors_bt869_init(); } int cleanup_module(void) diff --git a/kernel/chips/eeprom.c b/kernel/chips/eeprom.c index 24dbe32b..25812ee7 100644 --- a/kernel/chips/eeprom.c +++ b/kernel/chips/eeprom.c @@ -31,6 +31,7 @@ #include #else #define __init +#define __initdata #endif @@ -81,7 +82,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init eeprom_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_eeprom_init(void); static int __init eeprom_cleanup(void); static int eeprom_attach_adapter(struct i2c_adapter *adapter); @@ -140,7 +146,7 @@ static ctl_table eeprom_dir_table_template[] = { }; /* Used by init/cleanup */ -static int __init eeprom_initialized = 0; +static int __initdata 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 @@ -390,7 +396,7 @@ void eeprom_contents(struct i2c_client *client, int operation, int ctl_name, } } -int __init eeprom_init(void) +int __init sensors_eeprom_init(void) { int res; @@ -429,7 +435,7 @@ MODULE_DESCRIPTION("EEPROM driver"); int init_module(void) { - return eeprom_init(); + return sensors_eeprom_init(); } int cleanup_module(void) diff --git a/kernel/chips/gl518sm.c b/kernel/chips/gl518sm.c index fd51afea..ecfc27c7 100644 --- a/kernel/chips/gl518sm.c +++ b/kernel/chips/gl518sm.c @@ -32,6 +32,7 @@ #include #else #define __init +#define __initdata #endif /* Addresses to scan */ @@ -174,7 +175,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init gl518_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_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); @@ -254,7 +260,7 @@ static ctl_table gl518_dir_table_template[] = { }; /* Used by init/cleanup */ -static int __init gl518_initialized = 0; +static int __initdata 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 @@ -903,7 +909,7 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name, } } -int __init gl518_init(void) +int __init sensors_gl518_init(void) { int res; @@ -942,7 +948,7 @@ MODULE_DESCRIPTION("GL518SM driver"); int init_module(void) { - return gl518_init(); + return sensors_gl518_init(); } int cleanup_module(void) diff --git a/kernel/chips/gl520sm.c b/kernel/chips/gl520sm.c index 2c340fa8..c97bcb52 100644 --- a/kernel/chips/gl520sm.c +++ b/kernel/chips/gl520sm.c @@ -32,6 +32,7 @@ #include #else #define __init +#define __initdata #endif @@ -178,7 +179,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init gl520_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_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); @@ -264,7 +270,7 @@ static ctl_table gl520_dir_table_template[] = { }; /* Used by init/cleanup */ -static int __init gl520_initialized = 0; +static int __initdata 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 @@ -791,7 +797,7 @@ void gl520_config(struct i2c_client *client, int operation, int ctl_name, } } -int __init gl520_init(void) +int __init sensors_gl520_init(void) { int res; @@ -830,7 +836,7 @@ MODULE_DESCRIPTION("GL520SM driver"); int init_module(void) { - return gl520_init(); + return sensors_gl520_init(); } int cleanup_module(void) diff --git a/kernel/chips/icspll.c b/kernel/chips/icspll.c index 10f769ed..c71b33b7 100644 --- a/kernel/chips/icspll.c +++ b/kernel/chips/icspll.c @@ -38,6 +38,7 @@ #include #else #define __init +#define __initdata #endif @@ -63,7 +64,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init icspll_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_icspll_init(void); static int __init icspll_cleanup(void); static int icspll_attach_adapter(struct i2c_adapter *adapter); @@ -110,7 +116,7 @@ static ctl_table icspll_dir_table_template[] = { static u8 tempdata[MAXBLOCK_SIZE]; /* Used by init/cleanup */ -static int __init icspll_initialized = 0; +static int __initdata icspll_initialized = 0; /* I choose here for semi-static allocation. Complete dynamic allocation could also be used; the code needed for this would probably @@ -319,7 +325,7 @@ void icspll_contents(struct i2c_client *client, int operation, int ctl_name, } } -int __init icspll_init(void) +int __init sensors_icspll_init(void) { int res; @@ -358,7 +364,7 @@ MODULE_DESCRIPTION("ICSPLL driver"); int init_module(void) { - return icspll_init(); + return sensors_icspll_init(); } int cleanup_module(void) diff --git a/kernel/chips/lm75.c b/kernel/chips/lm75.c index d319ba2b..f32de3e6 100644 --- a/kernel/chips/lm75.c +++ b/kernel/chips/lm75.c @@ -30,6 +30,7 @@ #include #else #define __init +#define __initdata #endif @@ -77,7 +78,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init lm75_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_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); @@ -119,7 +125,7 @@ static ctl_table lm75_dir_table_template[] = { }; /* Used by init/cleanup */ -static int __init lm75_initialized = 0; +static int __initdata 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 @@ -378,7 +384,7 @@ void lm75_temp(struct i2c_client *client, int operation, int ctl_name, } } -int __init lm75_init(void) +int __init sensors_lm75_init(void) { int res; @@ -417,7 +423,7 @@ MODULE_DESCRIPTION("LM75 driver"); int init_module(void) { - return lm75_init(); + return sensors_lm75_init(); } int cleanup_module(void) diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c index 9ea3e176..3371ec17 100644 --- a/kernel/chips/lm78.c +++ b/kernel/chips/lm78.c @@ -36,6 +36,7 @@ #include #else #define __init +#define __initdata #endif @@ -202,7 +203,12 @@ struct lm78_data { }; -static int __init lm78_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_lm78_init(void); static int __init lm78_cleanup(void); static int lm78_attach_adapter(struct i2c_adapter *adapter); @@ -250,7 +256,7 @@ static struct i2c_driver lm78_driver = { }; /* Used by lm78_init/cleanup */ -static int __init lm78_initialized = 0; +static int __initdata lm78_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected LM78. This is just a template; @@ -787,7 +793,7 @@ void lm78_fan_div(struct i2c_client *client, int operation, int ctl_name, } } -int __init lm78_init(void) +int __init sensors_lm78_init(void) { int res; @@ -826,7 +832,7 @@ MODULE_DESCRIPTION("LM78, LM78-J and LM79 driver"); int init_module(void) { - return lm78_init(); + return sensors_lm78_init(); } int cleanup_module(void) diff --git a/kernel/chips/lm80.c b/kernel/chips/lm80.c index 591fcdc3..fe1f98f1 100644 --- a/kernel/chips/lm80.c +++ b/kernel/chips/lm80.c @@ -37,6 +37,7 @@ #include #else #define __init +#define __initdata #endif @@ -197,7 +198,7 @@ struct lm80_data { }; -static int __init lm80_init(void); +static int __init sensors_lm80_init(void); static int __init lm80_cleanup(void); static int lm80_attach_adapter(struct i2c_adapter *adapter); @@ -243,7 +244,7 @@ static struct i2c_driver lm80_driver = { }; /* Used by lm80_init/cleanup */ -static int __init lm80_initialized = 0; +static int __initdata lm80_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected LM80. This is just a template; @@ -671,7 +672,7 @@ void lm80_fan_div(struct i2c_client *client, int operation, int ctl_name, } } -int __init lm80_init(void) +int __init sensors_lm80_init(void) { int res; @@ -710,7 +711,7 @@ MODULE_DESCRIPTION("LM80 driver"); int init_module(void) { - return lm80_init(); + return sensors_lm80_init(); } int cleanup_module(void) diff --git a/kernel/chips/ltc1710.c b/kernel/chips/ltc1710.c index 32af96e5..a8ca1c3a 100644 --- a/kernel/chips/ltc1710.c +++ b/kernel/chips/ltc1710.c @@ -53,6 +53,7 @@ #include #else #define __init +#define __initdata #endif @@ -88,7 +89,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init ltc1710_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_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); @@ -130,7 +136,7 @@ static ctl_table ltc1710_dir_table_template[] = { }; /* Used by init/cleanup */ -static int __init ltc1710_initialized = 0; +static int __initdata 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 @@ -354,7 +360,7 @@ void ltc1710_switch2(struct i2c_client *client, int operation, int ctl_name, } } -int __init ltc1710_init(void) +int __init sensors_ltc1710_init(void) { int res; @@ -393,7 +399,7 @@ MODULE_DESCRIPTION("LTC1710 driver"); int init_module(void) { - return ltc1710_init(); + return sensors_ltc1710_init(); } int cleanup_module(void) diff --git a/kernel/chips/matorb.c b/kernel/chips/matorb.c index 86e741e2..7473de16 100644 --- a/kernel/chips/matorb.c +++ b/kernel/chips/matorb.c @@ -34,6 +34,7 @@ #include #else #define __init +#define __initdata #endif @@ -64,7 +65,12 @@ extern int init_module(void); extern int cleanup_module(void); #endif /* MODULE */ -static int __init matorb_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_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); @@ -104,7 +110,7 @@ static ctl_table matorb_dir_table_template[] = { }; /* Used by init/cleanup */ -static int __init matorb_initialized = 0; +static int __initdata 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 @@ -324,7 +330,7 @@ int i; } } -int __init matorb_init(void) +int __init sensors_matorb_init(void) { int res; @@ -363,7 +369,7 @@ MODULE_DESCRIPTION("MATORB driver"); int init_module(void) { - return matorb_init(); + return sensors_matorb_init(); } int cleanup_module(void) diff --git a/kernel/chips/maxilife.c b/kernel/chips/maxilife.c index ae25a74f..c4a1039f 100644 --- a/kernel/chips/maxilife.c +++ b/kernel/chips/maxilife.c @@ -55,6 +55,7 @@ static const char *version_str = "1.00 25/2/99 Fons Rademakers"; #include #else #define __init +#define __initdata #endif @@ -158,7 +159,12 @@ struct maxi_data { }; -static int __init maxi_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_maxi_init(void); static int __init maxi_cleanup(void); static int maxi_attach_adapter(struct i2c_adapter *adapter); @@ -212,7 +218,7 @@ static struct i2c_driver maxi_driver = { }; /* Used by maxi_init/cleanup */ -static int __init maxi_initialized = 0; +static int __initdata maxi_initialized = 0; /* Default firmware version. Use module option "maxi_version" to set desired version. Auto detect is not yet working */ @@ -716,7 +722,7 @@ void maxi_alarms(struct i2c_client *client, int operation, int ctl_name, } } -int __init maxi_init(void) +int __init sensors_maxi_init(void) { int res; @@ -758,7 +764,7 @@ MODULE_PARM_DESC(maxi_version, "MaxiLife firmware version"); int init_module(void) { - return maxi_init(); + return sensors_maxi_init(); } int cleanup_module(void) diff --git a/kernel/chips/sis5595.c b/kernel/chips/sis5595.c index 9c37e224..a816d122 100644 --- a/kernel/chips/sis5595.c +++ b/kernel/chips/sis5595.c @@ -42,6 +42,7 @@ #include #else #define __init +#define __initdata #endif @@ -182,7 +183,12 @@ struct sis5595_data { }; -static int __init sis5595_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_sis5595_init(void); static int __init sis5595_cleanup(void); static int sis5595_attach_adapter(struct i2c_adapter *adapter); @@ -231,7 +237,7 @@ static struct i2c_driver sis5595_driver = { }; /* Used by sis5595_init/cleanup */ -static int __init sis5595_initialized = 0; +static int __initdata sis5595_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected SIS5595. This is just a template; @@ -712,7 +718,7 @@ void sis5595_fan_div(struct i2c_client *client, int operation, int ctl_name, } } -int __init sis5595_init(void) +int __init sensors_sis5595_init(void) { int res,addr; @@ -757,7 +763,7 @@ MODULE_DESCRIPTION("SiS 5595 Sensor device"); int init_module(void) { - return sis5595_init(); + return sensors_sis5595_init(); } int cleanup_module(void) diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 177c31a5..ca2945e3 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -48,6 +48,7 @@ #include #else #define __init +#define __initdata #endif /* RT Table support #defined so we can take it out if it gets bothersome */ @@ -354,7 +355,12 @@ struct w83781d_data { }; -static int __init w83781d_init(void); +#ifdef MODULE +static +#else +extern +#endif + int __init sensors_w83781d_init(void); static int __init w83781d_cleanup(void); static int w83781d_attach_adapter(struct i2c_adapter *adapter); @@ -415,7 +421,7 @@ static struct i2c_driver w83781d_driver = { }; /* Used by w83781d_init/cleanup */ -static int __init w83781d_initialized = 0; +static int __initdata w83781d_initialized = 0; /* The /proc/sys entries */ /* These files are created for each detected W83781D. This is just a template; @@ -1485,7 +1491,7 @@ void w83781d_rt(struct i2c_client *client, int operation, int ctl_name, } #endif -int __init w83781d_init(void) +int __init sensors_w83781d_init(void) { int res; @@ -1525,7 +1531,7 @@ MODULE_DESCRIPTION("W83781D driver"); int init_module(void) { - return w83781d_init(); + return sensors_w83781d_init(); } int cleanup_module(void) diff --git a/kernel/sensors.c b/kernel/sensors.c index e2e6e02f..72a5a4bf 100644 --- a/kernel/sensors.c +++ b/kernel/sensors.c @@ -791,5 +791,74 @@ int cleanup_module(void) return sensors_cleanup(); } +#else /* ndef MODULE */ + +#ifdef CONFIG_SENSORS_ADM1021 + extern int sensors_adm1021_init(void); +#endif +#ifdef CONFIG_SENSORS_ADM9024 + extern int sensors_adm9024_init(void); +#endif +#ifdef CONFIG_SENSORS_GL518SM + extern int sensors_gl518sm_init(void); +#endif +#ifdef CONFIG_SENSORS_LM75 + extern int sensors_lm75_init(void); +#endif +#ifdef CONFIG_SENSORS_LM78 + extern int sensors_lm78_init(void); +#endif +#ifdef CONFIG_SENSORS_LM80 + extern int sensors_lm80_init(void); +#endif +#ifdef CONFIG_SENSORS_SIS5595 + extern int sensors_sis5595_init(void); +#endif +#ifdef CONFIG_SENSORS_W83781D + extern int sensors_w83781d_init(void); +#endif +#ifdef CONFIG_SENSORS_EEPROM + extern int sensors_eeprom_init(void); +#endif +#ifdef CONFIG_SENSORS_LTC1710 + extern int sensors_ltc1710_init(void); +#endif + +int __init sensors_init_all(void) +{ + sensors_init(); +#ifdef CONFIG_SENSORS_ADM1021 + sensors_adm1021_init(); +#endif +#ifdef CONFIG_SENSORS_ADM9024 + sensors_adm9024_init(); +#endif +#ifdef CONFIG_SENSORS_GL518SM + sensors_gl518sm_init(); +#endif +#ifdef CONFIG_SENSORS_LM75 + sensors_lm75_init(); +#endif +#ifdef CONFIG_SENSORS_LM78 + sensors_lm78_init(); +#endif +#ifdef CONFIG_SENSORS_LM80 + sensors_lm80_init(); +#endif +#ifdef CONFIG_SENSORS_SIS5595 + sensors_sis5595_init(); +#endif +#ifdef CONFIG_SENSORS_W83781D + sensors_w83781d_init(); +#endif +#ifdef CONFIG_SENSORS_EEPROM + sensors_eeprom_init(); +#endif +#ifdef CONFIG_SENSORS_LTC1710 + sensors_ltc1710_init(); +#endif + return 0; +} + #endif /* MODULE */ diff --git a/mkpatch/Config.in b/mkpatch/Config.in index c5eba054..e583dcbe 100644 --- a/mkpatch/Config.in +++ b/mkpatch/Config.in @@ -1,25 +1,28 @@ # # Character device configuration # -mainmenu_option next_comment -comment 'Hardware sensors support' -dep_tristate 'Hardware sensors support' CONFIG_SENSORS $CONFIG_I2C - -if [ "$CONFIG_SENSORS" != "n" ]; then - dep_tristate ' Analog Devices ADM1021 and compatibles' CONFIG_SENSORS_ADM1021 $CONFIG_SENSORS - dep_tristate ' Analog Devices ADM9240 and compatibles' CONFIG_SENSORS_ADM9240 $CONFIG_SENSORS - dep_tristate ' Genesys Logic GL518SM' CONFIG_SENSORS_GL518SM $CONFIG_SENSORS - dep_tristate ' National Semiconductors LM75' CONFIG_SENSORS_LM75 $CONFIG_SENSORS - dep_tristate ' National Semiconductors LM78' CONFIG_SENSORS_LM78 $CONFIG_SENSORS - dep_tristate ' National Semiconductors LM80' CONFIG_SENSORS_LM80 $CONFIG_SENSORS - dep_tristate ' Silicon Integrated Systems Corp. SiS5595' CONFIG_SENSORS_SIS5595 $CONFIG_SENSORS - dep_tristate ' Western Digital W83781D, W83782D and W83783S' CONFIG_SENSORS_W83781D $CONFIG_SENSORS - dep_bool ' Other I2C devices' CONFIG_SENSORS_OTHER CONFIG_SENSORS - if [ "$CONFIG_SENSORS_OTHER" = "y" ] ; then - dep_tristate ' EEprom (DIMM) reader ' CONFIG_SENSORS_EEPROM $CONFIG_SENSORS_OTHER - dep_tristate ' Linear Technologies LTC1710 ' CONFIG_SENSORS_LTC1710 $CONFIG_SENSORS_OTHER +if [ "$CONFIG_I2C" != "n" ] ; then + mainmenu_option next_comment + comment 'Hardware sensors support' + + dep_tristate 'Hardware sensors support' CONFIG_SENSORS $CONFIG_I2C + + if [ "$CONFIG_SENSORS" != "n" ]; then + dep_tristate ' Analog Devices ADM1021 and compatibles' CONFIG_SENSORS_ADM1021 $CONFIG_SENSORS + dep_tristate ' Analog Devices ADM9240 and compatibles' CONFIG_SENSORS_ADM9240 $CONFIG_SENSORS + dep_tristate ' Genesys Logic GL518SM' CONFIG_SENSORS_GL518SM $CONFIG_SENSORS + dep_tristate ' National Semiconductors LM75' CONFIG_SENSORS_LM75 $CONFIG_SENSORS + dep_tristate ' National Semiconductors LM78' CONFIG_SENSORS_LM78 $CONFIG_SENSORS + dep_tristate ' National Semiconductors LM80' CONFIG_SENSORS_LM80 $CONFIG_SENSORS + dep_tristate ' Silicon Integrated Systems Corp. SiS5595' CONFIG_SENSORS_SIS5595 $CONFIG_SENSORS + dep_tristate ' Western Digital W83781D, W83782D and W83783S' CONFIG_SENSORS_W83781D $CONFIG_SENSORS + bool ' Other I2C devices' CONFIG_SENSORS_OTHER + if [ "$CONFIG_SENSORS_OTHER" = "y" ] ; then + dep_tristate ' EEprom (DIMM) reader ' CONFIG_SENSORS_EEPROM $CONFIG_SENSORS + dep_tristate ' Linear Technologies LTC1710 ' CONFIG_SENSORS_LTC1710 $CONFIG_SENSORS + fi fi + endmenu fi -endmenu diff --git a/mkpatch/FILES b/mkpatch/FILES index 03d9c7d0..ead00509 100644 --- a/mkpatch/FILES +++ b/mkpatch/FILES @@ -13,5 +13,8 @@ kernel/chips/lm80.c drivers/sensors/lm80.c kernel/chips/ltc1710.c drivers/sensors/ltc1710.c kernel/chips/sis5595.c drivers/sensors/sis5595.c kernel/chips/w83781d.c drivers/sensors/w83781d.c +kernel/chips/eeprom.c drivers/sensors/eeprom.c kernel/include/i2c-isa.h include/linux/i2c-isa.h kernel/include/sensors.h include/linux/sensors.h +mkpatch/Makefile drivers/sensors/Makefile +mkpatch/Config.in drivers/sensors/Config.in diff --git a/mkpatch/mkpatch.pl b/mkpatch/mkpatch.pl index b711b4e6..c696858a 100755 --- a/mkpatch/mkpatch.pl +++ b/mkpatch/mkpatch.pl @@ -141,7 +141,7 @@ sub gen_drivers_char_Config_in while() { if (m@source drivers/i2c/Config.in@) { print OUTPUT; - print OUTPUT 'source drivers/sensors/Config.in'; + print OUTPUT "source drivers/sensors/Config.in\n"; $_ = ; } if (m@sensors@) { @@ -224,15 +224,17 @@ sub gen_drivers_i2c_Config_in if (m@CONFIG_I2C_MAINBOARD@) { $_ = while not m@^ fi$@; $_ = ; + $_ = if m@^$@; } - if (m@CONFIG_I2C_CHARDEV@) { + if (m@^fi@) { print OUTPUT << 'EOF' - dep_bool 'I2C mainboard interfaces' CONFIG_I2C_SMBUS $CONFIG_I2C + bool 'I2C mainboard interfaces' CONFIG_I2C_MAINBOARD if [ "$CONFIG_I2C_MAINBOARD" = "y" ]; then dep_tristate ' Acer Labs ALI 1533 and 1543C' CONFIG_I2C_ALI5X3 $CONFIG_I2C_MAINBOARD dep_tristate ' Apple Hydra Mac I/O' CONFIG_I2C_HYDRA $CONFIG_I2C_MAINBOARD dep_tristate ' Intel 82371AB PIIX4(E)' CONFIG_I2C_PIIX4 $CONFIG_I2C_MAINBOARD dep_tristate ' VIA Technologies, Inc. VT82C586B' CONFIG_I2C_VIA $CONFIG_I2C_MAINBOARD + dep_tristate ' Pseudo ISA adapter (for hardware sensors modules)' CONFIG_I2C_ISA $CONFIG_I2C_MAINBOARD fi EOF @@ -257,8 +259,8 @@ sub gen_drivers_i2c_Makefile open OUTPUT,">$package_root/mkpatch/.temp" or die "Can't open $package_root/$package_file"; while() { - while (m@CONFIG_I2C_ALI5X4@ or m@CONFIG_I2C_HYDRA@ or m@CONFIG_I2C_PIIX$@ or - m@CONFIG_I2C_VIA@) { + while (m@CONFIG_I2C_ALI5X3@ or m@CONFIG_I2C_HYDRA@ or m@CONFIG_I2C_PIIX4@ or + m@CONFIG_I2C_VIA@ or m@CONFIG_I2C_ISA@) { $_ = while not m@^endif@; $_ = ; $_ = if m@^$@; @@ -266,7 +268,7 @@ sub gen_drivers_i2c_Makefile if (m@Rules.make@) { print OUTPUT << 'EOF' ifeq ($(CONFIG_I2C_ALI5X3),y) - L_OBJS += i2c-ali5x3.c + L_OBJS += i2c-ali5x3.o else ifeq ($(CONFIG_I2C_ALI5X3),m) M_OBJS += i2c-ali5x3.o @@ -274,7 +276,7 @@ else endif ifeq ($(CONFIG_I2C_HYDRA),y) - L_OBJS += i2c-hydra.c + L_OBJS += i2c-hydra.o else ifeq ($(CONFIG_I2C_HYDRA),m) M_OBJS += i2c-hydra.o @@ -282,7 +284,7 @@ else endif ifeq ($(CONFIG_I2C_PIIX4),y) - L_OBJS += i2c-piix4.c + L_OBJS += i2c-piix4.o else ifeq ($(CONFIG_I2C_PIIX4),m) M_OBJS += i2c-piix4.o @@ -290,13 +292,21 @@ else endif ifeq ($(CONFIG_I2C_VIA),y) - L_OBJS += i2c-via.c + L_OBJS += i2c-via.o else ifeq ($(CONFIG_I2C_VIA),m) M_OBJS += i2c-via.o endif endif +ifeq ($(CONFIG_I2C_ISA),y) + L_OBJS += i2c-isa.o +else + ifeq ($(CONFIG_I2C_ISA),m) + M_OBJS += i2c-isa.o + endif +endif + EOF } print OUTPUT; @@ -306,12 +316,75 @@ EOF print_diff $package_root,$kernel_root,$kernel_file,$package_file; } +sub gen_drivers_i2c_i2c_core_c +{ + my ($package_root,$kernel_root) = @_; + my $kernel_file = "drivers/i2c/i2c-core.c"; + my $package_file = "mkpatch/.temp"; + my $right_place = 0; + + open INPUT,"$kernel_root/$kernel_file" + or die "Can't open `$kernel_root/$kernel_file'"; + open OUTPUT,">$package_root/mkpatch/.temp" + or die "Can't open $package_root/$package_file"; + while() { + while (m@CONFIG_I2C_ALI5X3@ or m@CONFIG_I2C_HYDRA@ or m@CONFIG_I2C_PIIX4@ or + m@CONFIG_I2C_VIA@ or m@CONFIG_I2C_ISA@) { + $_ = while not m@#endif@; + $_ = ; + } + if (m@^int __init i2c_init_all@) { + $right_place = 1; + print OUTPUT << 'EOF'; +#ifdef CONFIG_I2C_ALI5X3 + extern int i2c_ali5x3_init(void); +#endif +#ifdef CONFIG_I2C_HYDRA + extern int i2c_hydra_init(void); +#endif +#ifdef CONFIG_I2C_PIIX4 + extern int i2c_piix4_init(void); +#endif +#ifdef CONFIG_I2C_VIA + extern int i2c_via_init(void); +#endif +#ifdef CONFIG_I2C_ISA + extern int i2c_isa_init(void); +#endif +EOF + } + if ($right_place and m@return 0;@) { + print OUTPUT << 'EOF'; +#ifdef CONFIG_I2C_ALI5X3 + i2c_ali5x3_init(); +#endif +#ifdef CONFIG_I2C_HYDRA + i2c_hydra_init(); +#endif +#ifdef CONFIG_I2C_PIIX4 + i2c_piix4_init(); +#endif +#ifdef CONFIG_I2C_VIA + i2c_via_init(); +#endif +#ifdef CONFIG_I2C_ISA + i2c_isa_init(); +#endif +EOF + } + print OUTPUT; + } + close INPUT; + close OUTPUT; + print_diff $package_root,$kernel_root,$kernel_file,$package_file; +} sub main { my ($package_root,$kernel_root,%files,%includes,$package_file,$kernel_file); my ($diff_command,$dummy,$data0,$data1,$sedscript,$version_string); + my $temp_file=".temp"; # --> Read the command-lineo $package_root = $ARGV[0]; @@ -348,26 +421,16 @@ sub main # --> Start generating foreach $package_file (sort keys %files) { - $kernel_file = $files{$package_file}; - $diff_command = "diff -u2 "; - if ( -f "$kernel_root/$kernel_file") { - $diff_command .= "$kernel_root/$kernel_file"; - } else { - $diff_command .= "/dev/null"; - } - $diff_command .= " $package_root/$package_file"; - open INPUT, "$diff_command|"; - $dummy = ; - $dummy = ; - print "--- linux-old/$kernel_file\t".`date`; - print "+++ linux/$kernel_file\t".`date`; - + open INPUT,"$package_root/$package_file" + or die "Can't open `$package_root/$package_file'"; + open OUTPUT,">$package_root/mkpatch/$temp_file" + or die "Can't open `$package_root/$temp_file'"; while () { eval $sedscript; if (m@#\s*include\s*"version.h"@) { - print $version_string; + print OUTPUT $version_string; } elsif (m@#\s*include\s*"compat.h"@) { - print << 'EOF'; + print OUTPUT << 'EOF'; /* --> COMPATIBILITY SECTION FOR OLD (2.0, 2.1) KERNELS */ @@ -383,7 +446,7 @@ sub main EOF if (`grep KERNEL_VERSION "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; #include #ifndef KERNEL_VERSION #define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c)) @@ -391,8 +454,8 @@ EOF EOF } - if (`grep 'copy_from_user\|copy_to_user\|get_user_data' "$package_root/$package_file"`) { - print << 'EOF'; + if (`grep 'copy_from_user\\|copy_to_user\\|get_user_data' "$package_root/$package_file"`) { + print OUTPUT << 'EOF'; /* 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 */ @@ -408,7 +471,7 @@ EOF EOF } if (`grep 'schedule_timeout' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; /* 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() ) @@ -417,7 +480,7 @@ EOF EOF } if (`grep 'pci_' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; /* 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. @@ -447,7 +510,7 @@ EOF EOF } if (`grep 'ioremap\|iounmap' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; /* 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)) @@ -459,7 +522,7 @@ EOF EOF } if (`grep 'init_MUTEX' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)) #define init_MUTEX(s) do { *(s) = MUTEX; } while(0) #endif @@ -467,7 +530,7 @@ EOF } if (`grep 'PCI_DEVICE_ID_VIA_82C586_3' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,34)) #define PCI_DEVICE_ID_VIA_82C586_3 0x3040 #endif @@ -475,42 +538,62 @@ EOF } if (`grep 'PCI_DEVICE_ID_AL_M7101' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,34)) #define PCI_DEVICE_ID_AL_M7101 0x7101 #endif EOF } if (`grep 'PCI_DEVICE_ID_INTEL_82371AB_3' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,31)) #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 #endif EOF } if (`grep 'PCI_VENDOR_ID_APPLE' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,31)) #define PCI_VENDOR_ID_APPLE 0x106b #endif EOF } if (`grep 'PCI_DEVICE_ID_APPLE_HYDRA' "$package_root/$package_file"`) { - print << 'EOF'; + print OUTPUT << 'EOF'; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,31)) #define PCI_DEVICE_ID_APPLE_HYDRA 0x000e #endif EOF } - print << 'EOF'; + print OUTPUT << 'EOF'; /* --> END OF COMPATIBILITY SECTION */ EOF } else { - print; + print OUTPUT; } } close INPUT; + close OUTPUT; + + $kernel_file = $files{$package_file}; + $diff_command = "diff -u2 "; + if ( -f "$kernel_root/$kernel_file") { + $diff_command .= "$kernel_root/$kernel_file"; + } else { + $diff_command .= "/dev/null"; + } + $diff_command .= " $package_root/mkpatch/$temp_file"; + open INPUT, "$diff_command|"; + $dummy = ; + $dummy = ; + print "--- linux-old/$kernel_file\t".`date`; + print "+++ linux/$kernel_file\t".`date`; + + while () { + print; + } + close INPUT; } gen_Makefile $package_root, $kernel_root; @@ -519,6 +602,7 @@ EOF gen_drivers_char_mem_c $package_root, $kernel_root; gen_drivers_i2c_Config_in $package_root, $kernel_root; gen_drivers_i2c_Makefile $package_root, $kernel_root; + gen_drivers_i2c_i2c_core_c $package_root, $kernel_root; } main;