diff options
Diffstat (limited to 'drivers/hwmon/lm78.c')
-rw-r--r-- | drivers/hwmon/lm78.c | 65 |
1 files changed, 23 insertions, 42 deletions
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index f7e70163e01..cadcbd90ff3 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -41,8 +41,7 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; static unsigned short isa_address = 0x290; -/* Insmod parameters */ -I2C_CLIENT_INSMOD_2(lm78, lm79); +enum chips { lm78, lm79 }; /* Many LM78 constants specified below */ @@ -142,7 +141,7 @@ struct lm78_data { }; -static int lm78_i2c_detect(struct i2c_client *client, int kind, +static int lm78_i2c_detect(struct i2c_client *client, struct i2c_board_info *info); static int lm78_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id); @@ -173,7 +172,7 @@ static struct i2c_driver lm78_driver = { .remove = lm78_i2c_remove, .id_table = lm78_i2c_id, .detect = lm78_i2c_detect, - .address_data = &addr_data, + .address_list = normal_i2c, }; static struct platform_driver lm78_isa_driver = { @@ -558,7 +557,7 @@ static int lm78_alias_detect(struct i2c_client *client, u8 chipid) return 1; } -static int lm78_i2c_detect(struct i2c_client *client, int kind, +static int lm78_i2c_detect(struct i2c_client *client, struct i2c_board_info *info) { int i; @@ -576,52 +575,34 @@ static int lm78_i2c_detect(struct i2c_client *client, int kind, if (isa) mutex_lock(&isa->update_lock); - if (kind < 0) { - if ((i2c_smbus_read_byte_data(client, LM78_REG_CONFIG) & 0x80) - || i2c_smbus_read_byte_data(client, LM78_REG_I2C_ADDR) - != address) - goto err_nodev; + if ((i2c_smbus_read_byte_data(client, LM78_REG_CONFIG) & 0x80) + || i2c_smbus_read_byte_data(client, LM78_REG_I2C_ADDR) != address) + goto err_nodev; - /* Explicitly prevent the misdetection of Winbond chips */ - i = i2c_smbus_read_byte_data(client, 0x4f); - if (i == 0xa3 || i == 0x5c) - goto err_nodev; - } + /* Explicitly prevent the misdetection of Winbond chips */ + i = i2c_smbus_read_byte_data(client, 0x4f); + if (i == 0xa3 || i == 0x5c) + goto err_nodev; /* Determine the chip type. */ - if (kind <= 0) { - i = i2c_smbus_read_byte_data(client, LM78_REG_CHIPID); - if (i == 0x00 || i == 0x20 /* LM78 */ - || i == 0x40) /* LM78-J */ - kind = lm78; - else if ((i & 0xfe) == 0xc0) - kind = lm79; - else { - if (kind == 0) - dev_warn(&adapter->dev, "Ignoring 'force' " - "parameter for unknown chip at " - "adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto err_nodev; - } + i = i2c_smbus_read_byte_data(client, LM78_REG_CHIPID); + if (i == 0x00 || i == 0x20 /* LM78 */ + || i == 0x40) /* LM78-J */ + client_name = "lm78"; + else if ((i & 0xfe) == 0xc0) + client_name = "lm79"; + else + goto err_nodev; - if (lm78_alias_detect(client, i)) { - dev_dbg(&adapter->dev, "Device at 0x%02x appears to " - "be the same as ISA device\n", address); - goto err_nodev; - } + if (lm78_alias_detect(client, i)) { + dev_dbg(&adapter->dev, "Device at 0x%02x appears to " + "be the same as ISA device\n", address); + goto err_nodev; } if (isa) mutex_unlock(&isa->update_lock); - switch (kind) { - case lm79: - client_name = "lm79"; - break; - default: - client_name = "lm78"; - } strlcpy(info->type, client_name, I2C_NAME_SIZE); return 0; |