aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-sensor-detect.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-07-31 21:33:23 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 09:14:18 -0700
commitef8dec5d8b3e96e359f377f35cd8caff42fe6d58 (patch)
treeca83d278af5da3dfc9ef01f1d5bf479e67229d25 /drivers/i2c/i2c-sensor-detect.c
parent9fc6adfa9adf2be84119a3c2592287f33bd1dff2 (diff)
[PATCH] hwmon: hwmon vs i2c, second round (02/11)
The way i2c-sensor handles forced addresses could be optimized. It defines a structure (i2c_force_data) to associate a module parameter with a given kind value, but in fact this kind value is always the index of the structure in each array it is used in. So this additional value can be omitted, and still be deduced in the code handling these arrays. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/i2c-sensor-detect.c')
-rw-r--r--drivers/i2c/i2c-sensor-detect.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/i2c/i2c-sensor-detect.c b/drivers/i2c/i2c-sensor-detect.c
index 5aede3ca9cb..c952926c148 100644
--- a/drivers/i2c/i2c-sensor-detect.c
+++ b/drivers/i2c/i2c-sensor-detect.c
@@ -32,7 +32,6 @@ int i2c_detect(struct i2c_adapter *adapter,
int (*found_proc) (struct i2c_adapter *, int, int))
{
int addr, i, found, j, err;
- struct i2c_force_data *this_force;
int adapter_id = i2c_adapter_id(adapter);
unsigned short *normal_i2c;
unsigned short *probe;
@@ -58,13 +57,13 @@ int i2c_detect(struct i2c_adapter *adapter,
/* If it is in one of the force entries, we don't do any
detection at all */
found = 0;
- for (i = 0; !found && (this_force = address_data->forces + i, this_force->force); i++) {
- for (j = 0; !found && (this_force->force[j] != I2C_CLIENT_END); j += 2) {
- if ( ((adapter_id == this_force->force[j]) ||
- (this_force->force[j] == ANY_I2C_BUS)) &&
- (addr == this_force->force[j + 1]) ) {
+ for (i = 0; address_data->forces[i]; i++) {
+ for (j = 0; !found && (address_data->forces[i][j] != I2C_CLIENT_END); j += 2) {
+ if ( ((adapter_id == address_data->forces[i][j]) ||
+ (address_data->forces[i][j] == ANY_I2C_BUS)) &&
+ (addr == address_data->forces[i][j + 1]) ) {
dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr);
- if ((err = found_proc(adapter, addr, this_force->kind)))
+ if ((err = found_proc(adapter, addr, i)))
return err;
found = 1;
}