diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-09 20:35:57 +0100 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-09 20:35:57 +0100 |
commit | 52df6440a29123eed912183fe785bbe174ef14b9 (patch) | |
tree | 3a3b9f4110d21c2ec4f5711444dd9cec6fb3d32c /drivers/hwmon/fschmd.c | |
parent | a1fa4cdcc4abd4c02a81ab7052c16a342d29f060 (diff) |
hwmon: Clean up detect functions
As kind is now hard-coded to -1, there is room for code clean-ups.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Corentin Labbe <corentin.labbe@geomatys.fr>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Juerg Haefliger <juergh@gmail.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Acked-by: "Hans J. Koch" <hjk@linutronix.de>
Cc: Rudolf Marek <r.marek@assembler.cz>
Diffstat (limited to 'drivers/hwmon/fschmd.c')
-rw-r--r-- | drivers/hwmon/fschmd.c | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index da1b1f9488a..281829cd153 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c @@ -1000,43 +1000,38 @@ static void fschmd_dmi_decode(const struct dmi_header *header, void *dummy) } } -static int fschmd_detect(struct i2c_client *client, int kind, +static int fschmd_detect(struct i2c_client *client, int _kind, struct i2c_board_info *info) { + enum chips kind; struct i2c_adapter *adapter = client->adapter; + char id[4]; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; /* Detect & Identify the chip */ - if (kind <= 0) { - char id[4]; - - id[0] = i2c_smbus_read_byte_data(client, - FSCHMD_REG_IDENT_0); - id[1] = i2c_smbus_read_byte_data(client, - FSCHMD_REG_IDENT_1); - id[2] = i2c_smbus_read_byte_data(client, - FSCHMD_REG_IDENT_2); - id[3] = '\0'; - - if (!strcmp(id, "PEG")) - kind = fscpos; - else if (!strcmp(id, "HER")) - kind = fscher; - else if (!strcmp(id, "SCY")) - kind = fscscy; - else if (!strcmp(id, "HRC")) - kind = fschrc; - else if (!strcmp(id, "HMD")) - kind = fschmd; - else if (!strcmp(id, "HDS")) - kind = fschds; - else if (!strcmp(id, "SYL")) - kind = fscsyl; - else - return -ENODEV; - } + id[0] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_0); + id[1] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_1); + id[2] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_2); + id[3] = '\0'; + + if (!strcmp(id, "PEG")) + kind = fscpos; + else if (!strcmp(id, "HER")) + kind = fscher; + else if (!strcmp(id, "SCY")) + kind = fscscy; + else if (!strcmp(id, "HRC")) + kind = fschrc; + else if (!strcmp(id, "HMD")) + kind = fschmd; + else if (!strcmp(id, "HDS")) + kind = fschds; + else if (!strcmp(id, "SYL")) + kind = fscsyl; + else + return -ENODEV; strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE); |