diff options
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 da1b1f9488af..281829cd1533 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) | |||
1000 | } | 1000 | } |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | static int fschmd_detect(struct i2c_client *client, int kind, | 1003 | static int fschmd_detect(struct i2c_client *client, int _kind, |
1004 | struct i2c_board_info *info) | 1004 | struct i2c_board_info *info) |
1005 | { | 1005 | { |
1006 | enum chips kind; | ||
1006 | struct i2c_adapter *adapter = client->adapter; | 1007 | struct i2c_adapter *adapter = client->adapter; |
1008 | char id[4]; | ||
1007 | 1009 | ||
1008 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1010 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1009 | return -ENODEV; | 1011 | return -ENODEV; |
1010 | 1012 | ||
1011 | /* Detect & Identify the chip */ | 1013 | /* Detect & Identify the chip */ |
1012 | if (kind <= 0) { | 1014 | id[0] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_0); |
1013 | char id[4]; | 1015 | id[1] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_1); |
1014 | 1016 | id[2] = i2c_smbus_read_byte_data(client, FSCHMD_REG_IDENT_2); | |
1015 | id[0] = i2c_smbus_read_byte_data(client, | 1017 | id[3] = '\0'; |
1016 | FSCHMD_REG_IDENT_0); | 1018 | |
1017 | id[1] = i2c_smbus_read_byte_data(client, | 1019 | if (!strcmp(id, "PEG")) |
1018 | FSCHMD_REG_IDENT_1); | 1020 | kind = fscpos; |
1019 | id[2] = i2c_smbus_read_byte_data(client, | 1021 | else if (!strcmp(id, "HER")) |
1020 | FSCHMD_REG_IDENT_2); | 1022 | kind = fscher; |
1021 | id[3] = '\0'; | 1023 | else if (!strcmp(id, "SCY")) |
1022 | 1024 | kind = fscscy; | |
1023 | if (!strcmp(id, "PEG")) | 1025 | else if (!strcmp(id, "HRC")) |
1024 | kind = fscpos; | 1026 | kind = fschrc; |
1025 | else if (!strcmp(id, "HER")) | 1027 | else if (!strcmp(id, "HMD")) |
1026 | kind = fscher; | 1028 | kind = fschmd; |
1027 | else if (!strcmp(id, "SCY")) | 1029 | else if (!strcmp(id, "HDS")) |
1028 | kind = fscscy; | 1030 | kind = fschds; |
1029 | else if (!strcmp(id, "HRC")) | 1031 | else if (!strcmp(id, "SYL")) |
1030 | kind = fschrc; | 1032 | kind = fscsyl; |
1031 | else if (!strcmp(id, "HMD")) | 1033 | else |
1032 | kind = fschmd; | 1034 | return -ENODEV; |
1033 | else if (!strcmp(id, "HDS")) | ||
1034 | kind = fschds; | ||
1035 | else if (!strcmp(id, "SYL")) | ||
1036 | kind = fscsyl; | ||
1037 | else | ||
1038 | return -ENODEV; | ||
1039 | } | ||
1040 | 1035 | ||
1041 | strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE); | 1036 | strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE); |
1042 | 1037 | ||