diff --git a/i2c/MODIFICATIONS b/i2c/MODIFICATIONS index e9baf111..b9ed164d 100644 --- a/i2c/MODIFICATIONS +++ b/i2c/MODIFICATIONS @@ -11,6 +11,10 @@ The current version of Simon's code is called mod-19990118.tar.gz. Here come the changes: +! Fixed i2c_probe bug + +* Algo-bit now scans the bus before registering the adapter. + ! Renamed #define HW_B_MB to HW_B_VIA in i2c.h ! Added '#include ' to i2c.h, to make it compile with 2.2 diff --git a/i2c/algo-bit.c b/i2c/algo-bit.c index 6ea2b997..9ede4c92 100644 --- a/i2c/algo-bit.c +++ b/i2c/algo-bit.c @@ -571,7 +571,6 @@ int i2c_bit_add_bus(struct bit_adapter *adap) i2c_adap->timeout = 100; /* default values, should */ i2c_adap->retries = 3; /* be replaced by defines */ i2c_adaps[i] = i2c_adap; - i2c_add_adapter(i2c_adap); /* scan bus */ if (bit_scan) { @@ -587,6 +586,9 @@ int i2c_bit_add_bus(struct bit_adapter *adap) } printk("\n"); } + + i2c_add_adapter(i2c_adap); + return 0; } @@ -655,13 +657,3 @@ void cleanup_module(void) i2c_del_algorithm(&bit_algo); } #endif - - - - - - - - - - diff --git a/i2c/i2c-core.c b/i2c/i2c-core.c index 412cb3c5..271bc1c9 100644 --- a/i2c/i2c-core.c +++ b/i2c/i2c-core.c @@ -418,22 +418,21 @@ int i2c_probe(struct i2c_client *client, int low_addr, int hi_addr) { int i; struct i2c_msg msg; - struct i2c_msg *pmsg = &msg; msg.flags=client->flags & (I2C_M_TENMASK | I2C_M_TEN ); msg.buf = NULL; msg.len = 0; I2C_LOCK(client->adapter); for (i = low_addr; i <= hi_addr; i++) { - client->addr=i; + msg.addr=i; /* TODO: implement a control statement in the algo layer * that does address lookup only. */ if (1 == client->adapter-> - algo->master_xfer(client->adapter,pmsg,1)) + algo->master_xfer(client->adapter,&msg,1)) break; } I2C_UNLOCK(client->adapter); - return (i <= hi_addr) ? i : -1; + return (i <= hi_addr) ? (client->addr=i) : -1; } /* +++ frodo * return id number for a specific adapter