aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1031.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/adm1031.c')
-rw-r--r--drivers/hwmon/adm1031.c26
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;