diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-09 14:35:57 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-09 14:35:57 -0500 |
commit | 52df6440a29123eed912183fe785bbe174ef14b9 (patch) | |
tree | 3a3b9f4110d21c2ec4f5711444dd9cec6fb3d32c /drivers/hwmon/adm1031.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/adm1031.c')
-rw-r--r-- | drivers/hwmon/adm1031.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 56905955352c..0e722175aae0 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -817,31 +817,19 @@ static int adm1031_detect(struct i2c_client *client, int kind, | |||
817 | struct i2c_board_info *info) | 817 | struct i2c_board_info *info) |
818 | { | 818 | { |
819 | struct i2c_adapter *adapter = client->adapter; | 819 | struct i2c_adapter *adapter = client->adapter; |
820 | const char *name = ""; | 820 | const char *name; |
821 | int id, co; | ||
821 | 822 | ||
822 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 823 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
823 | return -ENODEV; | 824 | return -ENODEV; |
824 | 825 | ||
825 | if (kind < 0) { | 826 | id = i2c_smbus_read_byte_data(client, 0x3d); |
826 | int id, co; | 827 | co = i2c_smbus_read_byte_data(client, 0x3e); |
827 | id = i2c_smbus_read_byte_data(client, 0x3d); | ||
828 | co = i2c_smbus_read_byte_data(client, 0x3e); | ||
829 | 828 | ||
830 | if (!((id == 0x31 || id == 0x30) && co == 0x41)) | 829 | if (!((id == 0x31 || id == 0x30) && co == 0x41)) |
831 | return -ENODEV; | 830 | return -ENODEV; |
832 | kind = (id == 0x30) ? adm1030 : adm1031; | 831 | name = (id == 0x30) ? "adm1030" : "adm1031"; |
833 | } | ||
834 | |||
835 | if (kind <= 0) | ||
836 | kind = adm1031; | ||
837 | 832 | ||
838 | /* Given the detected chip type, set the chip name and the | ||
839 | * auto fan control helper table. */ | ||
840 | if (kind == adm1030) { | ||
841 | name = "adm1030"; | ||
842 | } else if (kind == adm1031) { | ||
843 | name = "adm1031"; | ||
844 | } | ||
845 | strlcpy(info->type, name, I2C_NAME_SIZE); | 833 | strlcpy(info->type, name, I2C_NAME_SIZE); |
846 | 834 | ||
847 | return 0; | 835 | return 0; |