diff --git a/kernel/busses/i2c-ali15x3.c b/kernel/busses/i2c-ali15x3.c index 48610637..db951486 100644 --- a/kernel/busses/i2c-ali15x3.c +++ b/kernel/busses/i2c-ali15x3.c @@ -158,8 +158,9 @@ extern 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, - u8 command, int size, union i2c_smbus_data * data); +static s32 ali15x3_access(struct i2c_adapter *adap, u8 addr, + unsigned short flags,char read_write, + u8 command, int size, union i2c_smbus_data * data); static void ali15x3_do_pause( unsigned int amount ); static int ali15x3_transaction(void); static void ali15x3_inc(struct i2c_adapter *adapter); @@ -493,8 +494,9 @@ int ali15x3_transaction(void) } /* Return -1 on error. See smbus.h for more information */ -s32 ali15x3_access(struct i2c_adapter *adap, u8 addr, char read_write, - u8 command, int size, union i2c_smbus_data * data) +s32 ali15x3_access(struct i2c_adapter *adap, u8 addr, unsigned short flags, + char read_write, u8 command, int size, + union i2c_smbus_data * data) { int i,len; int temp; diff --git a/kernel/busses/i2c-i801.c b/kernel/busses/i2c-i801.c index 6edd5603..9256e96d 100644 --- a/kernel/busses/i2c-i801.c +++ b/kernel/busses/i2c-i801.c @@ -87,8 +87,9 @@ MODULE_PARM_DESC(force_addr,"Forcibly enable the I801 at the given address. " static int __init i801_cleanup(void); static int i801_setup(void); -static s32 i801_access(struct i2c_adapter *adap, u8 addr, char read_write, - u8 command, int size, union i2c_smbus_data * data); +static s32 i801_access(struct i2c_adapter *adap, u8 addr, + unsigned short flags, char read_write, + u8 command, int size, union i2c_smbus_data * data); static void i801_do_pause( unsigned int amount ); static int i801_transaction(void); static int i801_block_transaction(union i2c_smbus_data *data, char read_write); @@ -484,8 +485,9 @@ int i801_block_transaction(union i2c_smbus_data *data, char read_write) } /* Return -1 on error. See smbus.h for more information */ -s32 i801_access(struct i2c_adapter *adap, u8 addr, char read_write, - u8 command, int size, union i2c_smbus_data * data) +s32 i801_access(struct i2c_adapter *adap, u8 addr, unsigned short flags, + char read_write, u8 command, int size, + union i2c_smbus_data * data) { switch(size) { diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c index ce719026..c5fe2e3b 100644 --- a/kernel/busses/i2c-piix4.c +++ b/kernel/busses/i2c-piix4.c @@ -99,7 +99,8 @@ extern int __init i2c_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, +static s32 piix4_access(struct i2c_adapter *adap, u8 addr, + unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data); static void piix4_do_pause( unsigned int amount ); static int piix4_transaction(void); @@ -352,7 +353,8 @@ int piix4_transaction(void) } /* Return -1 on error. See smbus.h for more information */ -s32 piix4_access(struct i2c_adapter *adap, u8 addr, char read_write, +s32 piix4_access(struct i2c_adapter *adap, u8 addr, + unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data) { int i,len; diff --git a/kernel/busses/i2c-viapro.c b/kernel/busses/i2c-viapro.c index 79b5a011..7fee1f1f 100644 --- a/kernel/busses/i2c-viapro.c +++ b/kernel/busses/i2c-viapro.c @@ -116,7 +116,8 @@ extern 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, +static s32 vt596_access(struct i2c_adapter *adap, u8 addr, + unsigned short flags,char read_write, u8 command, int size, union i2c_smbus_data * data); static void vt596_do_pause( unsigned int amount ); static int vt596_transaction(void); @@ -389,7 +390,8 @@ int vt596_transaction(void) } /* Return -1 on error. See smbus.h for more information */ -s32 vt596_access(struct i2c_adapter *adap, u8 addr, char read_write, +s32 vt596_access(struct i2c_adapter *adap, u8 addr, unsigned short flags, + char read_write, u8 command, int size, union i2c_smbus_data * data) { int i,len; diff --git a/kernel/busses/i2c-voodoo3.c b/kernel/busses/i2c-voodoo3.c index af7b4948..b25b7793 100644 --- a/kernel/busses/i2c-voodoo3.c +++ b/kernel/busses/i2c-voodoo3.c @@ -67,8 +67,9 @@ extern 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, - u8 command, int size, union i2c_smbus_data * data); +static s32 voodoo3_access(struct i2c_adapter *adap, u8 addr, + unsigned short flags, char read_write, + u8 command, int size, union i2c_smbus_data * data); static void Voodoo3_I2CStart(void); static void Voodoo3_I2CStop(void); static int Voodoo3_I2CAck(int ackit); @@ -469,8 +470,9 @@ static int voodoo3_setup(void) /* Return -1 on error. See smbus.h for more information */ -s32 voodoo3_access(struct i2c_adapter *adap, u8 addr, char read_write, - u8 command, int size, union i2c_smbus_data * data) +s32 voodoo3_access(struct i2c_adapter *adap, u8 addr, + unsigned short flags, char read_write, + u8 command, int size, union i2c_smbus_data * data) { int temp=0; diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index faae37ac..e47ac74f 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -116,7 +116,8 @@ extern 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); +static int adm1021_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static void adm1021_init_client(struct i2c_client *client); static int adm1021_detach_client(struct i2c_client *client); static int adm1021_command(struct i2c_client *client, unsigned int cmd, @@ -189,7 +190,8 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter) return sensors_detect(adapter,&addr_data,adm1021_detect); } -static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) +static int adm1021_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i; struct i2c_client *new_client; @@ -229,6 +231,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &adm1021_driver; + new_client->flags = 0; /* Now, we do the remaining detection. */ @@ -368,12 +371,12 @@ void adm1021_dec_use (struct i2c_client *client) /* All registers are byte-sized */ int adm1021_read_value(struct i2c_client *client, u8 reg) { - return i2c_smbus_read_byte_data(client->adapter,client->addr,reg); + return i2c_smbus_read_byte_data(client,reg); } int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value) { - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); } void adm1021_update_client(struct i2c_client *client) diff --git a/kernel/chips/adm9240.c b/kernel/chips/adm9240.c index 0189716f..7ba5be5b 100644 --- a/kernel/chips/adm9240.c +++ b/kernel/chips/adm9240.c @@ -255,7 +255,8 @@ extern 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); +static int adm9240_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static int adm9240_detach_client(struct i2c_client *client); static int adm9240_command(struct i2c_client *client, unsigned int cmd, void *arg); @@ -343,7 +344,8 @@ int adm9240_attach_adapter(struct i2c_adapter *adapter) return sensors_detect(adapter,&addr_data,adm9240_detect); } -static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind) +static int adm9240_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i; struct i2c_client *new_client; @@ -383,6 +385,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &adm9240_driver; + new_client->flags = 0; /* Now, we do the remaining detection. */ @@ -501,12 +504,12 @@ void adm9240_dec_use (struct i2c_client *client) int adm9240_read_value(struct i2c_client *client, u8 reg) { - return 0xFF & i2c_smbus_read_byte_data(client->adapter,client->addr, reg); + return 0xFF & i2c_smbus_read_byte_data(client, reg); } int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value) { - return i2c_smbus_write_byte_data(client->adapter, client->addr, reg,value); + return i2c_smbus_write_byte_data(client, reg,value); } /* Called when we have found a new ADM9240. It should set limits, etc. */ diff --git a/kernel/chips/bt869.c b/kernel/chips/bt869.c index afd72b6d..9887a538 100644 --- a/kernel/chips/bt869.c +++ b/kernel/chips/bt869.c @@ -91,7 +91,8 @@ extern 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); +static int bt869_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static void bt869_init_client(struct i2c_client *client); static int bt869_detach_client(struct i2c_client *client); static int bt869_command(struct i2c_client *client, unsigned int cmd, @@ -159,7 +160,8 @@ int bt869_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by sensors_detect */ -int bt869_detect(struct i2c_adapter *adapter, int address, int kind) +int bt869_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i,cur; struct i2c_client *new_client; @@ -200,11 +202,11 @@ printk("bt869.o: probing address %d .\n",address); new_client->data = data; new_client->adapter = adapter; new_client->driver = &bt869_driver; + new_client->flags = 0; /* Now, we do the remaining detection. It is lousy. */ - i2c_smbus_write_byte_data(new_client->adapter, - new_client->addr,0xC4,0); /* set status bank 0 */ - cur = i2c_smbus_read_byte(adapter,address); + i2c_smbus_write_byte_data(new_client,0xC4,0); /* set status bank 0 */ + cur = i2c_smbus_read_byte(new_client); printk("bt869.o: address 0x%X testing-->0x%X\n",address,cur); if ((cur & 0xE0) != 0x20) goto ERROR1; @@ -300,7 +302,7 @@ void bt869_dec_use (struct i2c_client *client) the usual practice. */ int bt869_read_value(struct i2c_client *client, u8 reg) { - return i2c_smbus_read_byte(client->adapter,client->addr); + return i2c_smbus_read_byte(client); } /* All registers are byte-sized. @@ -308,7 +310,7 @@ int bt869_read_value(struct i2c_client *client, u8 reg) the usual practice. */ int bt869_write_value(struct i2c_client *client, u8 reg, u16 value) { - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); } void bt869_init_client(struct i2c_client *client) diff --git a/kernel/chips/eeprom.c b/kernel/chips/eeprom.c index be1bd1ef..5e05623d 100644 --- a/kernel/chips/eeprom.c +++ b/kernel/chips/eeprom.c @@ -91,7 +91,8 @@ extern 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); +static int eeprom_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static int eeprom_detach_client(struct i2c_client *client); static int eeprom_command(struct i2c_client *client, unsigned int cmd, void *arg); @@ -156,7 +157,8 @@ int eeprom_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by sensors_detect */ -int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) +int eeprom_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i,cs; struct i2c_client *new_client; @@ -195,15 +197,16 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &eeprom_driver; + new_client->flags = 0; /* Now, we do the remaining detection. It is not there, unless you force the checksum to work out. */ if (checksum) { cs = 0; for (i = 0; i <= 0x3e; i++) - cs += i2c_smbus_read_byte_data(adapter,address,i); + cs += i2c_smbus_read_byte_data(new_client,i); cs &= 0xff; - if (i2c_smbus_read_byte_data(adapter,address,EEPROM_REG_CHECKSUM) != cs) + if (i2c_smbus_read_byte_data(new_client,EEPROM_REG_CHECKSUM) != cs) goto ERROR1; } @@ -296,9 +299,9 @@ void eeprom_dec_use (struct i2c_client *client) int eeprom_write_value(struct i2c_client *client, u8 reg, u16 value) { if (reg == EEPROM_REG_CONF) - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); else - return i2c_smbus_write_word_data(client->adapter,client->addr,reg,value); */ + return i2c_smbus_write_word_data(client,reg,value); */ return 0; } @@ -318,13 +321,13 @@ void eeprom_update_client(struct i2c_client *client) printk("Starting eeprom update\n"); #endif - if (i2c_smbus_write_byte(client->adapter,client->addr,0)) { + if (i2c_smbus_write_byte(client,0)) { #ifdef DEBUG printk("eeprom read start has failed!\n"); #endif } for (i=0;idata[i] = (u8)i2c_smbus_read_byte(client->adapter,client->addr); + data->data[i] = (u8)i2c_smbus_read_byte(client); } data->last_updated = jiffies; diff --git a/kernel/chips/gl518sm.c b/kernel/chips/gl518sm.c index 76740db7..e9665f93 100644 --- a/kernel/chips/gl518sm.c +++ b/kernel/chips/gl518sm.c @@ -191,7 +191,8 @@ extern 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); +static int gl518_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static void gl518_init_client(struct i2c_client *client); static int gl518_detach_client(struct i2c_client *client); static int gl518_command(struct i2c_client *client, unsigned int cmd, @@ -285,7 +286,8 @@ int gl518_attach_adapter(struct i2c_adapter *adapter) return sensors_detect(adapter,&addr_data,gl518_detect); } -static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) +static int gl518_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i; struct i2c_client *new_client; @@ -326,6 +328,7 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &gl518_driver; + new_client->flags = 0; /* Now, we do the remaining detection. */ @@ -529,9 +532,9 @@ u16 swap_bytes(u16 val) int gl518_read_value(struct i2c_client *client, u8 reg) { if ((reg >= 0x07) && (reg <= 0x0c)) - return swap_bytes(i2c_smbus_read_word_data(client->adapter,client->addr,reg)); + return swap_bytes(i2c_smbus_read_word_data(client,reg)); else - return i2c_smbus_read_byte_data(client->adapter,client->addr,reg); + return i2c_smbus_read_byte_data(client,reg); } /* Registers 0x07 to 0x0c are word-sized, others are byte-sized @@ -540,10 +543,9 @@ int gl518_read_value(struct i2c_client *client, u8 reg) int gl518_write_value(struct i2c_client *client, u8 reg, u16 value) { if ((reg >= 0x07) && (reg <= 0x0c)) - return i2c_smbus_write_word_data(client->adapter,client->addr,reg, - swap_bytes(value)); + return i2c_smbus_write_word_data(client,reg, swap_bytes(value)); else - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); } void gl518_update_client(struct i2c_client *client) diff --git a/kernel/chips/gl520sm.c b/kernel/chips/gl520sm.c index 2e790369..6145bc4b 100644 --- a/kernel/chips/gl520sm.c +++ b/kernel/chips/gl520sm.c @@ -192,7 +192,8 @@ extern 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); +static int gl520_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static void gl520_init_client(struct i2c_client *client); static int gl520_detach_client(struct i2c_client *client); static int gl520_command(struct i2c_client *client, unsigned int cmd, @@ -287,7 +288,8 @@ int gl520_attach_adapter(struct i2c_adapter *adapter) return sensors_detect(adapter,&addr_data,gl520_detect); } -static int gl520_detect(struct i2c_adapter *adapter, int address, int kind) +static int gl520_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i; struct i2c_client *new_client; @@ -328,6 +330,7 @@ static int gl520_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &gl520_driver; + new_client->flags = 0; /* Determine the chip type. */ @@ -488,9 +491,9 @@ u16 swap_bytes(u16 val) int gl520_read_value(struct i2c_client *client, u8 reg) { if ((reg >= 0x07) && (reg <= 0x0c)) - return swap_bytes(i2c_smbus_read_word_data(client->adapter,client->addr,reg)); + return swap_bytes(i2c_smbus_read_word_data(client,reg)); else - return i2c_smbus_read_byte_data(client->adapter,client->addr,reg); + return i2c_smbus_read_byte_data(client,reg); } /* Registers 0x07 to 0x0c are word-sized, others are byte-sized @@ -499,10 +502,9 @@ int gl520_read_value(struct i2c_client *client, u8 reg) int gl520_write_value(struct i2c_client *client, u8 reg, u16 value) { if ((reg >= 0x07) && (reg <= 0x0c)) - return i2c_smbus_write_word_data(client->adapter,client->addr,reg, - swap_bytes(value)); + return i2c_smbus_write_word_data(client,reg, swap_bytes(value)); else - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); } void gl520_update_client(struct i2c_client *client) diff --git a/kernel/chips/icspll.c b/kernel/chips/icspll.c index 2cb438d6..d9548741 100644 --- a/kernel/chips/icspll.c +++ b/kernel/chips/icspll.c @@ -167,6 +167,7 @@ int icspll_attach_adapter(struct i2c_adapter *adapter) new_client->addr = address; new_client->adapter = adapter; new_client->driver = &icspll_driver; + new_client->flags = 0; strcpy(new_client->name,"ICSPLL chip"); data->valid = 0; init_MUTEX(&data->update_lock); diff --git a/kernel/chips/lm75.c b/kernel/chips/lm75.c index cce11c88..b8e0635e 100644 --- a/kernel/chips/lm75.c +++ b/kernel/chips/lm75.c @@ -86,7 +86,8 @@ extern 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); +static int lm75_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static void lm75_init_client(struct i2c_client *client); static int lm75_detach_client(struct i2c_client *client); static int lm75_command(struct i2c_client *client, unsigned int cmd, @@ -135,7 +136,8 @@ int lm75_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by sensors_detect */ -int lm75_detect(struct i2c_adapter *adapter, int address, int kind) +int lm75_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i,cur,conf,hyst,os; struct i2c_client *new_client; @@ -174,16 +176,17 @@ int lm75_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &lm75_driver; + new_client->flags = 0; /* Now, we do the remaining detection. It is lousy. */ - cur = i2c_smbus_read_word_data(adapter,address,0); - conf = i2c_smbus_read_byte_data(adapter,address,1); - hyst = i2c_smbus_read_word_data(adapter,address,2); - os = i2c_smbus_read_word_data(adapter,address,3); + cur = i2c_smbus_read_word_data(new_client,0); + conf = i2c_smbus_read_byte_data(new_client,1); + hyst = i2c_smbus_read_word_data(new_client,2); + os = i2c_smbus_read_word_data(new_client,3); for (i = 0; i <= 0x1f; i++) - if ((i2c_smbus_read_byte_data(adapter,address,i*8+1) != conf) || - (i2c_smbus_read_word_data(adapter,address,i*8+2) != hyst) || - (i2c_smbus_read_word_data(adapter,address,i*8+3) != os)) + if ((i2c_smbus_read_byte_data(new_client,i*8+1) != conf) || + (i2c_smbus_read_word_data(new_client,i*8+2) != hyst) || + (i2c_smbus_read_word_data(new_client,i*8+3) != os)) goto ERROR1; /* Determine the chip type - only one kind supported! */ @@ -284,9 +287,9 @@ u16 swap_bytes(u16 val) int lm75_read_value(struct i2c_client *client, u8 reg) { if (reg == LM75_REG_CONF) - return i2c_smbus_read_byte_data(client->adapter,client->addr,reg); + return i2c_smbus_read_byte_data(client,reg); else - return swap_bytes(i2c_smbus_read_word_data(client->adapter,client->addr,reg)); + return swap_bytes(i2c_smbus_read_word_data(client,reg)); } /* All registers are word-sized, except for the configuration register. @@ -295,9 +298,9 @@ int lm75_read_value(struct i2c_client *client, u8 reg) int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) { if (reg == LM75_REG_CONF) - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); else - return i2c_smbus_write_word_data(client->adapter,client->addr,reg, + return i2c_smbus_write_word_data(client,reg, swap_bytes(value)); } diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c index 6a4544ee..4b4b3e9b 100644 --- a/kernel/chips/lm78.c +++ b/kernel/chips/lm78.c @@ -212,7 +212,8 @@ extern 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); +static int lm78_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static int lm78_detach_client(struct i2c_client *client); static int lm78_command(struct i2c_client *client, unsigned int cmd, void *arg); @@ -303,7 +304,8 @@ int lm78_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by sensors_detect */ -int lm78_detect(struct i2c_adapter *adapter, int address, int kind) +int lm78_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i; struct i2c_client *new_client; @@ -368,6 +370,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &lm78_driver; + new_client->flags = 0; /* Now, we do the remaining detection. */ @@ -514,7 +517,7 @@ int lm78_read_value(struct i2c_client *client, u8 reg) up( & (((struct lm78_data *) (client->data)) -> lock)); return res; } else - return i2c_smbus_read_byte_data(client->adapter,client->addr, reg); + return i2c_smbus_read_byte_data(client, reg); } /* The SMBus locks itself, but ISA access muse be locked explicitely! @@ -533,7 +536,7 @@ int lm78_write_value(struct i2c_client *client, u8 reg, u8 value) up(&(((struct lm78_data *) (client->data)) -> lock)); return 0; } else - return i2c_smbus_write_byte_data(client->adapter, client->addr, reg,value); + return i2c_smbus_write_byte_data(client, reg,value); } /* Called when we have found a new LM78. It should set limits, etc. */ diff --git a/kernel/chips/lm80.c b/kernel/chips/lm80.c index 4d911a5a..1c855fd0 100644 --- a/kernel/chips/lm80.c +++ b/kernel/chips/lm80.c @@ -203,7 +203,8 @@ static int __init sensors_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); +static int lm80_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static int lm80_detach_client(struct i2c_client *client); static int lm80_command(struct i2c_client *client, unsigned int cmd, void *arg); @@ -282,7 +283,8 @@ int lm80_attach_adapter(struct i2c_adapter *adapter) return sensors_detect(adapter,&addr_data,lm80_detect); } -int lm80_detect(struct i2c_adapter *adapter, int address, int kind) +int lm80_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i,cur; struct i2c_client *new_client; @@ -320,15 +322,16 @@ int lm80_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &lm80_driver; + new_client->flags = 0; /* Now, we do the remaining detection. It is lousy. */ if (lm80_read_value(new_client,LM80_REG_ALARM2) & 0xc0) goto ERROR1; for (i = 0x2a; i <= 0x3d; i++) { - cur = i2c_smbus_read_byte_data(adapter,address,i); - if ((i2c_smbus_read_byte_data(adapter,address,i+0x40) != cur) || - (i2c_smbus_read_byte_data(adapter,address,i+0x80) != cur) || - (i2c_smbus_read_byte_data(adapter,address,i+0xc0) != cur)) + cur = i2c_smbus_read_byte_data(new_client,i); + if ((i2c_smbus_read_byte_data(new_client,i+0x40) != cur) || + (i2c_smbus_read_byte_data(new_client,i+0x80) != cur) || + (i2c_smbus_read_byte_data(new_client,i+0xc0) != cur)) goto ERROR1; } @@ -418,12 +421,12 @@ void lm80_dec_use (struct i2c_client *client) int lm80_read_value(struct i2c_client *client, u8 reg) { - return i2c_smbus_read_byte_data(client->adapter,client->addr, reg); + return i2c_smbus_read_byte_data(client, reg); } int lm80_write_value(struct i2c_client *client, u8 reg, u8 value) { - return i2c_smbus_write_byte_data(client->adapter, client->addr, reg,value); + return i2c_smbus_write_byte_data(client, reg,value); } /* Called when we have found a new LM80. It should set limits, etc. */ diff --git a/kernel/chips/ltc1710.c b/kernel/chips/ltc1710.c index 18fa8dde..1b7f46a3 100644 --- a/kernel/chips/ltc1710.c +++ b/kernel/chips/ltc1710.c @@ -97,7 +97,8 @@ extern 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); +static int ltc1710_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static int ltc1710_detach_client(struct i2c_client *client); static int ltc1710_command(struct i2c_client *client, unsigned int cmd, void *arg); @@ -149,7 +150,8 @@ int ltc1710_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by sensors_detect */ -int ltc1710_detect(struct i2c_adapter *adapter, int address, int kind) +int ltc1710_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i; struct i2c_client *new_client; @@ -187,6 +189,7 @@ int ltc1710_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = <c1710_driver; + new_client->flags = 0; /* Now, we would do the remaining detection. But the LTC1710 is plainly impossible to detect! Stupid chip. */ @@ -292,7 +295,7 @@ void ltc1710_update_client(struct i2c_client *client) printk("Starting ltc1710 update\n"); #endif - /* data->status = i2c_smbus_read_byte(client->adapter,client->addr); + /* data->status = i2c_smbus_read_byte(client); Unfortunately, reads always fail! */ data->last_updated = jiffies; data->valid = 1; @@ -315,7 +318,7 @@ void ltc1710_switch1(struct i2c_client *client, int operation, int ctl_name, } else if (operation == SENSORS_PROC_REAL_WRITE) { if (*nrels_mag >= 1) { data->status = (data->status & 2) | results[0]; - i2c_smbus_write_byte(client->adapter,client->addr,data->status); + i2c_smbus_write_byte(client,data->status); } } } @@ -333,7 +336,7 @@ void ltc1710_switch2(struct i2c_client *client, int operation, int ctl_name, } else if (operation == SENSORS_PROC_REAL_WRITE) { if (*nrels_mag >= 1) { data->status = (data->status & 1) | (results[0] << 1); - i2c_smbus_write_byte(client->adapter,client->addr,data->status); + i2c_smbus_write_byte(client,data->status); } } } diff --git a/kernel/chips/matorb.c b/kernel/chips/matorb.c index 2ffc73a6..4a52a22c 100644 --- a/kernel/chips/matorb.c +++ b/kernel/chips/matorb.c @@ -73,7 +73,8 @@ extern 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); +static int matorb_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static void matorb_init_client(struct i2c_client *client); static int matorb_detach_client(struct i2c_client *client); static int matorb_command(struct i2c_client *client, unsigned int cmd, @@ -120,7 +121,8 @@ int matorb_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by sensors_detect */ -int matorb_detect(struct i2c_adapter *adapter, int address, int kind) +int matorb_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i,cur; struct i2c_client *new_client; @@ -161,9 +163,10 @@ int matorb_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &matorb_driver; + new_client->flags = 0; /* Now, we do the remaining detection. It is lousy. */ - cur = i2c_smbus_write_byte_data(adapter,address,0x0FE, 0x58); /* clear screen */ + cur = i2c_smbus_write_byte_data(new_client,0x0FE, 0x58); /* clear screen */ printk("matorb.o: debug detect 0x%X\n",cur); @@ -255,9 +258,9 @@ int matorb_read_value(struct i2c_client *client, u8 reg) int matorb_write_value(struct i2c_client *client, u8 reg, u16 value) { if (reg==0) { - return i2c_smbus_write_byte(client->adapter,client->addr,value); + return i2c_smbus_write_byte(client,value); } else { - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); } } diff --git a/kernel/chips/maxilife.c b/kernel/chips/maxilife.c index a5786088..fc0f90e0 100644 --- a/kernel/chips/maxilife.c +++ b/kernel/chips/maxilife.c @@ -301,8 +301,22 @@ int maxi_detect_smbus(struct i2c_adapter *adapter) /* Later on, we will keep a list of registered addresses for each adapter, and check whether they are used here */ - if (i2c_smbus_read_byte_data(adapter, address, MAXI_REG_LED_STATE) < 0) + /* Allocate space for a new client structure. To counter memory + fragmentation somewhat, we only do one kmalloc. */ + if (! (new_client = kmalloc(sizeof(struct i2c_client) + + sizeof(struct maxi_data), + GFP_KERNEL))) { + err = -ENOMEM; continue; + } + + /* Fill the new client structure with data */ + new_client->data = (struct maxi_data *) (new_client + 1); + new_client->addr = address; + new_client->flags = 0; + + if (i2c_smbus_read_byte_data(new_client, MAXI_REG_LED_STATE) < 0) + goto ERROR2; #ifdef AUTODETECT /* The right way to get the platform info is to read the firmware @@ -311,10 +325,10 @@ int maxi_detect_smbus(struct i2c_adapter *adapter) "CG 00.04" -> Cristal [XU] / Geronimo [XAs] "CO 00.03" -> Cognac [XU] "AS 00.01" -> Ashaki [XA] */ - biosctl = i2c_smbus_read_byte_data(adapter, address, MAXI_REG_BIOS_CTRL); - i2c_smbus_write_byte_data(adapter, address, MAXI_REG_BIOS_CTRL, biosctl|4); + biosctl = i2c_smbus_read_byte_data(new_client, MAXI_REG_BIOS_CTRL); + i2c_smbus_write_byte_data(new_client, MAXI_REG_BIOS_CTRL, biosctl|4); err = eeprom_read_byte_data(adapter, 0x54, 0x45); - i2c_smbus_write_byte_data(adapter, address, MAXI_REG_BIOS_CTRL, biosctl); + i2c_smbus_write_byte_data(new_client, MAXI_REG_BIOS_CTRL, biosctl); #endif if (maxi_version == cristal) { @@ -339,21 +353,9 @@ int maxi_detect_smbus(struct i2c_adapter *adapter) printk("maxilife: Error: specified wrong maxi_version (%d)\n", maxi_version); #endif - continue; + goto ERROR2; } - /* Allocate space for a new client structure. To counter memory - fragmentation somewhat, we only do one kmalloc. */ - if (! (new_client = kmalloc(sizeof(struct i2c_client) + - sizeof(struct maxi_data), - GFP_KERNEL))) { - err = -ENOMEM; - continue; - } - - /* Fill the new client structure with data */ - new_client->data = (struct maxi_data *) (new_client + 1); - new_client->addr = address; strcpy(new_client->name, client_name); ((struct maxi_data *) (new_client->data))->type = type; if ((err = maxi_new_client(adapter, new_client))) @@ -449,14 +451,14 @@ void maxi_dec_use (struct i2c_client *client) /* Read byte from specified register. */ int maxi_read_value(struct i2c_client *client, u8 reg) { - return i2c_smbus_read_byte_data(client->adapter, client->addr, reg); + return i2c_smbus_read_byte_data(client, reg); } #ifndef NOWRITE /* Write byte to specified register. */ int maxi_write_value(struct i2c_client *client, u8 reg, u8 value) { - return i2c_smbus_write_byte_data(client->adapter, client->addr, reg, value); + return i2c_smbus_write_byte_data(client, reg, value); } #endif diff --git a/kernel/chips/sis5595.c b/kernel/chips/sis5595.c index a96ce7be..65a3318b 100644 --- a/kernel/chips/sis5595.c +++ b/kernel/chips/sis5595.c @@ -192,7 +192,8 @@ extern 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); +static int sis5595_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static int sis5595_detach_client(struct i2c_client *client); static int sis5595_command(struct i2c_client *client, unsigned int cmd, void *arg); @@ -303,7 +304,8 @@ int sis5595_find_sis(int *address) return 0; } -int sis5595_detect(struct i2c_adapter *adapter, int address, int kind) +int sis5595_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i; struct i2c_client *new_client; @@ -366,6 +368,7 @@ int sis5595_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &sis5595_driver; + new_client->flags = 0; /* Now, we do the remaining detection. */ diff --git a/kernel/chips/thmc50.c b/kernel/chips/thmc50.c index e9ee0cf7..b680e813 100644 --- a/kernel/chips/thmc50.c +++ b/kernel/chips/thmc50.c @@ -108,7 +108,8 @@ extern int __init sensors_thmc50_init(void); static int __init thmc50_cleanup(void); static int thmc50_attach_adapter(struct i2c_adapter *adapter); -static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind); +static int thmc50_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static void thmc50_init_client(struct i2c_client *client); static int thmc50_detach_client(struct i2c_client *client); static int thmc50_command(struct i2c_client *client, unsigned int cmd, @@ -177,7 +178,8 @@ int thmc50_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by sensors_detect */ -int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) +int thmc50_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int company,i; struct i2c_client *new_client; @@ -219,9 +221,10 @@ int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &thmc50_driver; + new_client->flags = 0; /* Now, we do the remaining detection. */ - company = i2c_smbus_read_byte_data(adapter,address,THMC50_REG_COMPANY_ID); + company = i2c_smbus_read_byte_data(new_client,THMC50_REG_COMPANY_ID); if (company != 0x49) { #ifdef DEBUG @@ -324,7 +327,7 @@ u16 swap_bytes(u16 val) the usual practice. */ int thmc50_read_value(struct i2c_client *client, u8 reg) { - return i2c_smbus_read_byte_data(client->adapter,client->addr,reg); + return i2c_smbus_read_byte_data(client,reg); } /* All registers are word-sized, except for the configuration register. @@ -332,7 +335,7 @@ int thmc50_read_value(struct i2c_client *client, u8 reg) the usual practice. */ int thmc50_write_value(struct i2c_client *client, u8 reg, u16 value) { - return i2c_smbus_write_byte_data(client->adapter,client->addr,reg,value); + return i2c_smbus_write_byte_data(client,reg,value); } void thmc50_init_client(struct i2c_client *client) diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 9502cc7f..70f518df 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -365,7 +365,8 @@ extern 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); +static int w83781d_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind); static int w83781d_detach_client(struct i2c_client *client); static int w83781d_command(struct i2c_client *client, unsigned int cmd, void *arg); @@ -635,7 +636,8 @@ int w83781d_attach_adapter(struct i2c_adapter *adapter) return sensors_detect(adapter,&addr_data,w83781d_detect); } -int w83781d_detect(struct i2c_adapter *adapter, int address, int kind) +int w83781d_detect(struct i2c_adapter *adapter, int address, + unsigned short flags, int kind) { int i,val1,val2; struct i2c_client *new_client; @@ -699,6 +701,7 @@ int w83781d_detect(struct i2c_adapter *adapter, int address, int kind) new_client->data = data; new_client->adapter = adapter; new_client->driver = &w83781d_driver; + new_client->flags = 0; /* Now, we do the remaining detection. */ @@ -880,14 +883,12 @@ int w83781d_read_value(struct i2c_client *client, u16 reg) } } else { if (reg & 0xff00) - i2c_smbus_write_byte_data(client->adapter,client->addr,W83781D_REG_BANK, - reg >> 8); - res = i2c_smbus_read_byte_data(client->adapter,client->addr, reg); + i2c_smbus_write_byte_data(client,W83781D_REG_BANK, reg >> 8); + res = i2c_smbus_read_byte_data(client, reg); if (word_sized) - res = (res << 8) + i2c_smbus_read_byte_data(client->adapter,client->addr, - reg); + res = (res << 8) + i2c_smbus_read_byte_data(client, reg); if (reg & 0xff00) - i2c_smbus_write_byte_data(client->adapter,client->addr,W83781D_REG_BANK,0); + i2c_smbus_write_byte_data(client,W83781D_REG_BANK,0); } up( & (((struct w83781d_data *) (client->data)) -> lock)); return res; @@ -925,15 +926,14 @@ int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value) } } else { if (reg & 0xff00) - i2c_smbus_write_byte_data(client->adapter,client->addr,W83781D_REG_BANK, - reg >> 8); + i2c_smbus_write_byte_data(client,W83781D_REG_BANK, reg >> 8); if (word_sized) { - i2c_smbus_write_byte_data(client->adapter,client->addr, reg, value >> 8); - i2c_smbus_write_byte_data(client->adapter,client->addr, reg+1, value &0xff); + i2c_smbus_write_byte_data(client, reg, value >> 8); + i2c_smbus_write_byte_data(client, reg+1, value &0xff); } else - i2c_smbus_write_byte_data(client->adapter,client->addr, reg, value &0xff); + i2c_smbus_write_byte_data(client, reg, value &0xff); if (reg & 0xff00) - i2c_smbus_write_byte_data(client->adapter,client->addr,W83781D_REG_BANK,0); + i2c_smbus_write_byte_data(client,W83781D_REG_BANK,0); } up( & (((struct w83781d_data *) (client->data)) -> lock)); return 0; diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h index 32e188f5..8e4314c0 100644 --- a/kernel/include/sensors.h +++ b/kernel/include/sensors.h @@ -281,7 +281,8 @@ struct sensors_address_data { SENSORS_INSMOD typedef int sensors_found_addr_proc (struct i2c_adapter *adapter, - int addr, int kind); + int addr, unsigned short flags, + int kind); /* Detect function. It itterates over all possible addresses itself. For SMBus addresses, it will only call found_proc if some client is connected diff --git a/kernel/sensors.c b/kernel/sensors.c index 06030d62..2e65a32d 100644 --- a/kernel/sensors.c +++ b/kernel/sensors.c @@ -584,7 +584,7 @@ void sensors_write_reals(int nrels,void *buffer,int *bufsize,long *results, } -/* Very inefficient for ISA detects! */ +/* Very inefficient for ISA detects, and won't work for 10-bit addresses! */ int sensors_detect(struct i2c_adapter *adapter, struct sensors_address_data *address_data, sensors_found_addr_proc *found_proc) @@ -618,7 +618,7 @@ int sensors_detect(struct i2c_adapter *adapter, printk("sensors.o: found force parameter for adapter %d, addr %04x\n", adapter_id,addr); #endif - if ((err = found_proc(adapter,addr,this_force->kind))) + if ((err = found_proc(adapter,addr,0,this_force->kind))) return err; found = 1; } @@ -745,8 +745,9 @@ int sensors_detect(struct i2c_adapter *adapter, /* OK, so we really should examine this address. First check whether there is some client here at all! */ - if (is_isa || (i2c_smbus_write_quick(adapter,addr,0) >= 0)) - if ((err = found_proc(adapter,addr,-1))) + if (is_isa || + (i2c_smbus_xfer(adapter,addr,0,0,0,I2C_SMBUS_QUICK,NULL) >= 0)) + if ((err = found_proc(adapter,addr,0,-1))) return err; } return 0;