diff options
Diffstat (limited to 'drivers/hwmon/adm1031.c')
-rw-r--r-- | drivers/hwmon/adm1031.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 56905955352c..1644b92e7cc4 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -64,8 +64,7 @@ | |||
64 | /* Addresses to scan */ | 64 | /* Addresses to scan */ |
65 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | 65 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; |
66 | 66 | ||
67 | /* Insmod parameters */ | 67 | enum chips { adm1030, adm1031 }; |
68 | I2C_CLIENT_INSMOD_2(adm1030, adm1031); | ||
69 | 68 | ||
70 | typedef u8 auto_chan_table_t[8][2]; | 69 | typedef u8 auto_chan_table_t[8][2]; |
71 | 70 | ||
@@ -102,7 +101,7 @@ struct adm1031_data { | |||
102 | 101 | ||
103 | static int adm1031_probe(struct i2c_client *client, | 102 | static int adm1031_probe(struct i2c_client *client, |
104 | const struct i2c_device_id *id); | 103 | const struct i2c_device_id *id); |
105 | static int adm1031_detect(struct i2c_client *client, int kind, | 104 | static int adm1031_detect(struct i2c_client *client, |
106 | struct i2c_board_info *info); | 105 | struct i2c_board_info *info); |
107 | static void adm1031_init_client(struct i2c_client *client); | 106 | static void adm1031_init_client(struct i2c_client *client); |
108 | static int adm1031_remove(struct i2c_client *client); | 107 | static int adm1031_remove(struct i2c_client *client); |
@@ -125,7 +124,7 @@ static struct i2c_driver adm1031_driver = { | |||
125 | .remove = adm1031_remove, | 124 | .remove = adm1031_remove, |
126 | .id_table = adm1031_id, | 125 | .id_table = adm1031_id, |
127 | .detect = adm1031_detect, | 126 | .detect = adm1031_detect, |
128 | .address_data = &addr_data, | 127 | .address_list = normal_i2c, |
129 | }; | 128 | }; |
130 | 129 | ||
131 | static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg) | 130 | static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg) |
@@ -813,35 +812,23 @@ static const struct attribute_group adm1031_group_opt = { | |||
813 | }; | 812 | }; |
814 | 813 | ||
815 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 814 | /* Return 0 if detection is successful, -ENODEV otherwise */ |
816 | static int adm1031_detect(struct i2c_client *client, int kind, | 815 | static int adm1031_detect(struct i2c_client *client, |
817 | struct i2c_board_info *info) | 816 | struct i2c_board_info *info) |
818 | { | 817 | { |
819 | struct i2c_adapter *adapter = client->adapter; | 818 | struct i2c_adapter *adapter = client->adapter; |
820 | const char *name = ""; | 819 | const char *name; |
820 | int id, co; | ||
821 | 821 | ||
822 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 822 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
823 | return -ENODEV; | 823 | return -ENODEV; |
824 | 824 | ||
825 | if (kind < 0) { | 825 | id = i2c_smbus_read_byte_data(client, 0x3d); |
826 | int id, co; | 826 | 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 | 827 | ||
830 | if (!((id == 0x31 || id == 0x30) && co == 0x41)) | 828 | if (!((id == 0x31 || id == 0x30) && co == 0x41)) |
831 | return -ENODEV; | 829 | return -ENODEV; |
832 | kind = (id == 0x30) ? adm1030 : adm1031; | 830 | name = (id == 0x30) ? "adm1030" : "adm1031"; |
833 | } | ||
834 | |||
835 | if (kind <= 0) | ||
836 | kind = adm1031; | ||
837 | 831 | ||
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); | 832 | strlcpy(info->type, name, I2C_NAME_SIZE); |
846 | 833 | ||
847 | return 0; | 834 | return 0; |