diff options
author | Jean Delvare <khali@linux-fr.org> | 2012-03-23 05:02:18 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2012-03-23 05:02:18 -0400 |
commit | dac27dce318401fee028b19cdd4c52fe163f53f1 (patch) | |
tree | 4c988d2a62eca150b7998c861c45b7964a0cc98c /drivers/hwmon | |
parent | f7001bb063ec06e7fff8782146a7bed49dfe6507 (diff) |
hwmon: (lm63) Reorganize the code
Reorder functions and driver declaration to no longer need to
forward-declare functions. Also rename new_client to just client
everywhere for readability.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/lm63.c | 393 |
1 files changed, 187 insertions, 206 deletions
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 15c05cc83e2c..b90bdc908e5e 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
@@ -148,46 +148,9 @@ static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END }; | |||
148 | #define UPDATE_INTERVAL(max, rate) \ | 148 | #define UPDATE_INTERVAL(max, rate) \ |
149 | ((1000 << (LM63_MAX_CONVRATE - (rate))) / (max)) | 149 | ((1000 << (LM63_MAX_CONVRATE - (rate))) / (max)) |
150 | 150 | ||
151 | /* | ||
152 | * Functions declaration | ||
153 | */ | ||
154 | |||
155 | static int lm63_probe(struct i2c_client *client, | ||
156 | const struct i2c_device_id *id); | ||
157 | static int lm63_remove(struct i2c_client *client); | ||
158 | |||
159 | static struct lm63_data *lm63_update_device(struct device *dev); | ||
160 | |||
161 | static int lm63_detect(struct i2c_client *client, struct i2c_board_info *info); | ||
162 | static void lm63_init_client(struct i2c_client *client); | ||
163 | |||
164 | enum chips { lm63, lm64, lm96163 }; | 151 | enum chips { lm63, lm64, lm96163 }; |
165 | 152 | ||
166 | /* | 153 | /* |
167 | * Driver data (common to all clients) | ||
168 | */ | ||
169 | |||
170 | static const struct i2c_device_id lm63_id[] = { | ||
171 | { "lm63", lm63 }, | ||
172 | { "lm64", lm64 }, | ||
173 | { "lm96163", lm96163 }, | ||
174 | { } | ||
175 | }; | ||
176 | MODULE_DEVICE_TABLE(i2c, lm63_id); | ||
177 | |||
178 | static struct i2c_driver lm63_driver = { | ||
179 | .class = I2C_CLASS_HWMON, | ||
180 | .driver = { | ||
181 | .name = "lm63", | ||
182 | }, | ||
183 | .probe = lm63_probe, | ||
184 | .remove = lm63_remove, | ||
185 | .id_table = lm63_id, | ||
186 | .detect = lm63_detect, | ||
187 | .address_list = normal_i2c, | ||
188 | }; | ||
189 | |||
190 | /* | ||
191 | * Client data (each client gets its own) | 154 | * Client data (each client gets its own) |
192 | */ | 155 | */ |
193 | 156 | ||
@@ -242,6 +205,99 @@ static inline int lut_temp_from_reg(struct lm63_data *data, int nr) | |||
242 | return data->temp8[nr] * (data->lut_temp_highres ? 500 : 1000); | 205 | return data->temp8[nr] * (data->lut_temp_highres ? 500 : 1000); |
243 | } | 206 | } |
244 | 207 | ||
208 | static struct lm63_data *lm63_update_device(struct device *dev) | ||
209 | { | ||
210 | struct i2c_client *client = to_i2c_client(dev); | ||
211 | struct lm63_data *data = i2c_get_clientdata(client); | ||
212 | unsigned long next_update; | ||
213 | int i; | ||
214 | |||
215 | mutex_lock(&data->update_lock); | ||
216 | |||
217 | next_update = data->last_updated | ||
218 | + msecs_to_jiffies(data->update_interval) + 1; | ||
219 | |||
220 | if (time_after(jiffies, next_update) || !data->valid) { | ||
221 | if (data->config & 0x04) { /* tachometer enabled */ | ||
222 | /* order matters for fan1_input */ | ||
223 | data->fan[0] = i2c_smbus_read_byte_data(client, | ||
224 | LM63_REG_TACH_COUNT_LSB) & 0xFC; | ||
225 | data->fan[0] |= i2c_smbus_read_byte_data(client, | ||
226 | LM63_REG_TACH_COUNT_MSB) << 8; | ||
227 | data->fan[1] = (i2c_smbus_read_byte_data(client, | ||
228 | LM63_REG_TACH_LIMIT_LSB) & 0xFC) | ||
229 | | (i2c_smbus_read_byte_data(client, | ||
230 | LM63_REG_TACH_LIMIT_MSB) << 8); | ||
231 | } | ||
232 | |||
233 | data->pwm1_freq = i2c_smbus_read_byte_data(client, | ||
234 | LM63_REG_PWM_FREQ); | ||
235 | if (data->pwm1_freq == 0) | ||
236 | data->pwm1_freq = 1; | ||
237 | data->pwm1[0] = i2c_smbus_read_byte_data(client, | ||
238 | LM63_REG_PWM_VALUE); | ||
239 | |||
240 | data->temp8[0] = i2c_smbus_read_byte_data(client, | ||
241 | LM63_REG_LOCAL_TEMP); | ||
242 | data->temp8[1] = i2c_smbus_read_byte_data(client, | ||
243 | LM63_REG_LOCAL_HIGH); | ||
244 | |||
245 | /* order matters for temp2_input */ | ||
246 | data->temp11[0] = i2c_smbus_read_byte_data(client, | ||
247 | LM63_REG_REMOTE_TEMP_MSB) << 8; | ||
248 | data->temp11[0] |= i2c_smbus_read_byte_data(client, | ||
249 | LM63_REG_REMOTE_TEMP_LSB); | ||
250 | data->temp11[1] = (i2c_smbus_read_byte_data(client, | ||
251 | LM63_REG_REMOTE_LOW_MSB) << 8) | ||
252 | | i2c_smbus_read_byte_data(client, | ||
253 | LM63_REG_REMOTE_LOW_LSB); | ||
254 | data->temp11[2] = (i2c_smbus_read_byte_data(client, | ||
255 | LM63_REG_REMOTE_HIGH_MSB) << 8) | ||
256 | | i2c_smbus_read_byte_data(client, | ||
257 | LM63_REG_REMOTE_HIGH_LSB); | ||
258 | data->temp11[3] = (i2c_smbus_read_byte_data(client, | ||
259 | LM63_REG_REMOTE_OFFSET_MSB) << 8) | ||
260 | | i2c_smbus_read_byte_data(client, | ||
261 | LM63_REG_REMOTE_OFFSET_LSB); | ||
262 | |||
263 | if (data->kind == lm96163) | ||
264 | data->temp11u = (i2c_smbus_read_byte_data(client, | ||
265 | LM96163_REG_REMOTE_TEMP_U_MSB) << 8) | ||
266 | | i2c_smbus_read_byte_data(client, | ||
267 | LM96163_REG_REMOTE_TEMP_U_LSB); | ||
268 | |||
269 | data->temp8[2] = i2c_smbus_read_byte_data(client, | ||
270 | LM63_REG_REMOTE_TCRIT); | ||
271 | data->temp2_crit_hyst = i2c_smbus_read_byte_data(client, | ||
272 | LM63_REG_REMOTE_TCRIT_HYST); | ||
273 | |||
274 | data->alarms = i2c_smbus_read_byte_data(client, | ||
275 | LM63_REG_ALERT_STATUS) & 0x7F; | ||
276 | |||
277 | data->last_updated = jiffies; | ||
278 | data->valid = 1; | ||
279 | } | ||
280 | |||
281 | if (time_after(jiffies, data->lut_last_updated + 5 * HZ) || | ||
282 | !data->lut_valid) { | ||
283 | for (i = 0; i < data->lut_size; i++) { | ||
284 | data->pwm1[1 + i] = i2c_smbus_read_byte_data(client, | ||
285 | LM63_REG_LUT_PWM(i)); | ||
286 | data->temp8[3 + i] = i2c_smbus_read_byte_data(client, | ||
287 | LM63_REG_LUT_TEMP(i)); | ||
288 | } | ||
289 | data->lut_temp_hyst = i2c_smbus_read_byte_data(client, | ||
290 | LM63_REG_LUT_TEMP_HYST); | ||
291 | |||
292 | data->lut_last_updated = jiffies; | ||
293 | data->lut_valid = 1; | ||
294 | } | ||
295 | |||
296 | mutex_unlock(&data->update_lock); | ||
297 | |||
298 | return data; | ||
299 | } | ||
300 | |||
245 | /* | 301 | /* |
246 | * Sysfs callback functions and files | 302 | * Sysfs callback functions and files |
247 | */ | 303 | */ |
@@ -817,28 +873,25 @@ static const struct attribute_group lm63_group_fan1 = { | |||
817 | */ | 873 | */ |
818 | 874 | ||
819 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 875 | /* Return 0 if detection is successful, -ENODEV otherwise */ |
820 | static int lm63_detect(struct i2c_client *new_client, | 876 | static int lm63_detect(struct i2c_client *client, |
821 | struct i2c_board_info *info) | 877 | struct i2c_board_info *info) |
822 | { | 878 | { |
823 | struct i2c_adapter *adapter = new_client->adapter; | 879 | struct i2c_adapter *adapter = client->adapter; |
824 | u8 man_id, chip_id, reg_config1, reg_config2; | 880 | u8 man_id, chip_id, reg_config1, reg_config2; |
825 | u8 reg_alert_status, reg_alert_mask; | 881 | u8 reg_alert_status, reg_alert_mask; |
826 | int address = new_client->addr; | 882 | int address = client->addr; |
827 | 883 | ||
828 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 884 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
829 | return -ENODEV; | 885 | return -ENODEV; |
830 | 886 | ||
831 | man_id = i2c_smbus_read_byte_data(new_client, LM63_REG_MAN_ID); | 887 | man_id = i2c_smbus_read_byte_data(client, LM63_REG_MAN_ID); |
832 | chip_id = i2c_smbus_read_byte_data(new_client, LM63_REG_CHIP_ID); | 888 | chip_id = i2c_smbus_read_byte_data(client, LM63_REG_CHIP_ID); |
833 | 889 | ||
834 | reg_config1 = i2c_smbus_read_byte_data(new_client, | 890 | reg_config1 = i2c_smbus_read_byte_data(client, LM63_REG_CONFIG1); |
835 | LM63_REG_CONFIG1); | 891 | reg_config2 = i2c_smbus_read_byte_data(client, LM63_REG_CONFIG2); |
836 | reg_config2 = i2c_smbus_read_byte_data(new_client, | 892 | reg_alert_status = i2c_smbus_read_byte_data(client, |
837 | LM63_REG_CONFIG2); | ||
838 | reg_alert_status = i2c_smbus_read_byte_data(new_client, | ||
839 | LM63_REG_ALERT_STATUS); | 893 | LM63_REG_ALERT_STATUS); |
840 | reg_alert_mask = i2c_smbus_read_byte_data(new_client, | 894 | reg_alert_mask = i2c_smbus_read_byte_data(client, LM63_REG_ALERT_MASK); |
841 | LM63_REG_ALERT_MASK); | ||
842 | 895 | ||
843 | if (man_id != 0x01 /* National Semiconductor */ | 896 | if (man_id != 0x01 /* National Semiconductor */ |
844 | || (reg_config1 & 0x18) != 0x00 | 897 | || (reg_config1 & 0x18) != 0x00 |
@@ -863,74 +916,6 @@ static int lm63_detect(struct i2c_client *new_client, | |||
863 | return 0; | 916 | return 0; |
864 | } | 917 | } |
865 | 918 | ||
866 | static int lm63_probe(struct i2c_client *new_client, | ||
867 | const struct i2c_device_id *id) | ||
868 | { | ||
869 | struct lm63_data *data; | ||
870 | int err; | ||
871 | |||
872 | data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL); | ||
873 | if (!data) { | ||
874 | err = -ENOMEM; | ||
875 | goto exit; | ||
876 | } | ||
877 | |||
878 | i2c_set_clientdata(new_client, data); | ||
879 | data->valid = 0; | ||
880 | mutex_init(&data->update_lock); | ||
881 | |||
882 | /* Set the device type */ | ||
883 | data->kind = id->driver_data; | ||
884 | if (data->kind == lm64) | ||
885 | data->temp2_offset = 16000; | ||
886 | |||
887 | /* Initialize chip */ | ||
888 | lm63_init_client(new_client); | ||
889 | |||
890 | /* Register sysfs hooks */ | ||
891 | err = sysfs_create_group(&new_client->dev.kobj, &lm63_group); | ||
892 | if (err) | ||
893 | goto exit_free; | ||
894 | if (data->config & 0x04) { /* tachometer enabled */ | ||
895 | err = sysfs_create_group(&new_client->dev.kobj, | ||
896 | &lm63_group_fan1); | ||
897 | if (err) | ||
898 | goto exit_remove_files; | ||
899 | } | ||
900 | if (data->kind == lm96163) { | ||
901 | err = device_create_file(&new_client->dev, | ||
902 | &dev_attr_temp2_type); | ||
903 | if (err) | ||
904 | goto exit_remove_files; | ||
905 | |||
906 | err = sysfs_create_group(&new_client->dev.kobj, | ||
907 | &lm63_group_extra_lut); | ||
908 | if (err) | ||
909 | goto exit_remove_files; | ||
910 | } | ||
911 | |||
912 | data->hwmon_dev = hwmon_device_register(&new_client->dev); | ||
913 | if (IS_ERR(data->hwmon_dev)) { | ||
914 | err = PTR_ERR(data->hwmon_dev); | ||
915 | goto exit_remove_files; | ||
916 | } | ||
917 | |||
918 | return 0; | ||
919 | |||
920 | exit_remove_files: | ||
921 | sysfs_remove_group(&new_client->dev.kobj, &lm63_group); | ||
922 | sysfs_remove_group(&new_client->dev.kobj, &lm63_group_fan1); | ||
923 | if (data->kind == lm96163) { | ||
924 | device_remove_file(&new_client->dev, &dev_attr_temp2_type); | ||
925 | sysfs_remove_group(&new_client->dev.kobj, | ||
926 | &lm63_group_extra_lut); | ||
927 | } | ||
928 | exit_free: | ||
929 | kfree(data); | ||
930 | exit: | ||
931 | return err; | ||
932 | } | ||
933 | |||
934 | /* | 919 | /* |
935 | * Ideally we shouldn't have to initialize anything, since the BIOS | 920 | * Ideally we shouldn't have to initialize anything, since the BIOS |
936 | * should have taken care of everything | 921 | * should have taken care of everything |
@@ -1010,114 +995,110 @@ static void lm63_init_client(struct i2c_client *client) | |||
1010 | (data->config_fan & 0x20) ? "manual" : "auto"); | 995 | (data->config_fan & 0x20) ? "manual" : "auto"); |
1011 | } | 996 | } |
1012 | 997 | ||
1013 | static int lm63_remove(struct i2c_client *client) | 998 | static int lm63_probe(struct i2c_client *client, |
999 | const struct i2c_device_id *id) | ||
1014 | { | 1000 | { |
1015 | struct lm63_data *data = i2c_get_clientdata(client); | 1001 | struct lm63_data *data; |
1002 | int err; | ||
1016 | 1003 | ||
1017 | hwmon_device_unregister(data->hwmon_dev); | 1004 | data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL); |
1005 | if (!data) { | ||
1006 | err = -ENOMEM; | ||
1007 | goto exit; | ||
1008 | } | ||
1009 | |||
1010 | i2c_set_clientdata(client, data); | ||
1011 | data->valid = 0; | ||
1012 | mutex_init(&data->update_lock); | ||
1013 | |||
1014 | /* Set the device type */ | ||
1015 | data->kind = id->driver_data; | ||
1016 | if (data->kind == lm64) | ||
1017 | data->temp2_offset = 16000; | ||
1018 | |||
1019 | /* Initialize chip */ | ||
1020 | lm63_init_client(client); | ||
1021 | |||
1022 | /* Register sysfs hooks */ | ||
1023 | err = sysfs_create_group(&client->dev.kobj, &lm63_group); | ||
1024 | if (err) | ||
1025 | goto exit_free; | ||
1026 | if (data->config & 0x04) { /* tachometer enabled */ | ||
1027 | err = sysfs_create_group(&client->dev.kobj, &lm63_group_fan1); | ||
1028 | if (err) | ||
1029 | goto exit_remove_files; | ||
1030 | } | ||
1031 | if (data->kind == lm96163) { | ||
1032 | err = device_create_file(&client->dev, &dev_attr_temp2_type); | ||
1033 | if (err) | ||
1034 | goto exit_remove_files; | ||
1035 | |||
1036 | err = sysfs_create_group(&client->dev.kobj, | ||
1037 | &lm63_group_extra_lut); | ||
1038 | if (err) | ||
1039 | goto exit_remove_files; | ||
1040 | } | ||
1041 | |||
1042 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
1043 | if (IS_ERR(data->hwmon_dev)) { | ||
1044 | err = PTR_ERR(data->hwmon_dev); | ||
1045 | goto exit_remove_files; | ||
1046 | } | ||
1047 | |||
1048 | return 0; | ||
1049 | |||
1050 | exit_remove_files: | ||
1018 | sysfs_remove_group(&client->dev.kobj, &lm63_group); | 1051 | sysfs_remove_group(&client->dev.kobj, &lm63_group); |
1019 | sysfs_remove_group(&client->dev.kobj, &lm63_group_fan1); | 1052 | sysfs_remove_group(&client->dev.kobj, &lm63_group_fan1); |
1020 | if (data->kind == lm96163) { | 1053 | if (data->kind == lm96163) { |
1021 | device_remove_file(&client->dev, &dev_attr_temp2_type); | 1054 | device_remove_file(&client->dev, &dev_attr_temp2_type); |
1022 | sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut); | 1055 | sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut); |
1023 | } | 1056 | } |
1024 | 1057 | exit_free: | |
1025 | kfree(data); | 1058 | kfree(data); |
1026 | return 0; | 1059 | exit: |
1060 | return err; | ||
1027 | } | 1061 | } |
1028 | 1062 | ||
1029 | static struct lm63_data *lm63_update_device(struct device *dev) | 1063 | static int lm63_remove(struct i2c_client *client) |
1030 | { | 1064 | { |
1031 | struct i2c_client *client = to_i2c_client(dev); | ||
1032 | struct lm63_data *data = i2c_get_clientdata(client); | 1065 | struct lm63_data *data = i2c_get_clientdata(client); |
1033 | unsigned long next_update; | ||
1034 | int i; | ||
1035 | |||
1036 | mutex_lock(&data->update_lock); | ||
1037 | |||
1038 | next_update = data->last_updated | ||
1039 | + msecs_to_jiffies(data->update_interval) + 1; | ||
1040 | |||
1041 | if (time_after(jiffies, next_update) || !data->valid) { | ||
1042 | if (data->config & 0x04) { /* tachometer enabled */ | ||
1043 | /* order matters for fan1_input */ | ||
1044 | data->fan[0] = i2c_smbus_read_byte_data(client, | ||
1045 | LM63_REG_TACH_COUNT_LSB) & 0xFC; | ||
1046 | data->fan[0] |= i2c_smbus_read_byte_data(client, | ||
1047 | LM63_REG_TACH_COUNT_MSB) << 8; | ||
1048 | data->fan[1] = (i2c_smbus_read_byte_data(client, | ||
1049 | LM63_REG_TACH_LIMIT_LSB) & 0xFC) | ||
1050 | | (i2c_smbus_read_byte_data(client, | ||
1051 | LM63_REG_TACH_LIMIT_MSB) << 8); | ||
1052 | } | ||
1053 | |||
1054 | data->pwm1_freq = i2c_smbus_read_byte_data(client, | ||
1055 | LM63_REG_PWM_FREQ); | ||
1056 | if (data->pwm1_freq == 0) | ||
1057 | data->pwm1_freq = 1; | ||
1058 | data->pwm1[0] = i2c_smbus_read_byte_data(client, | ||
1059 | LM63_REG_PWM_VALUE); | ||
1060 | |||
1061 | data->temp8[0] = i2c_smbus_read_byte_data(client, | ||
1062 | LM63_REG_LOCAL_TEMP); | ||
1063 | data->temp8[1] = i2c_smbus_read_byte_data(client, | ||
1064 | LM63_REG_LOCAL_HIGH); | ||
1065 | 1066 | ||
1066 | /* order matters for temp2_input */ | 1067 | hwmon_device_unregister(data->hwmon_dev); |
1067 | data->temp11[0] = i2c_smbus_read_byte_data(client, | 1068 | sysfs_remove_group(&client->dev.kobj, &lm63_group); |
1068 | LM63_REG_REMOTE_TEMP_MSB) << 8; | 1069 | sysfs_remove_group(&client->dev.kobj, &lm63_group_fan1); |
1069 | data->temp11[0] |= i2c_smbus_read_byte_data(client, | 1070 | if (data->kind == lm96163) { |
1070 | LM63_REG_REMOTE_TEMP_LSB); | 1071 | device_remove_file(&client->dev, &dev_attr_temp2_type); |
1071 | data->temp11[1] = (i2c_smbus_read_byte_data(client, | 1072 | sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut); |
1072 | LM63_REG_REMOTE_LOW_MSB) << 8) | ||
1073 | | i2c_smbus_read_byte_data(client, | ||
1074 | LM63_REG_REMOTE_LOW_LSB); | ||
1075 | data->temp11[2] = (i2c_smbus_read_byte_data(client, | ||
1076 | LM63_REG_REMOTE_HIGH_MSB) << 8) | ||
1077 | | i2c_smbus_read_byte_data(client, | ||
1078 | LM63_REG_REMOTE_HIGH_LSB); | ||
1079 | data->temp11[3] = (i2c_smbus_read_byte_data(client, | ||
1080 | LM63_REG_REMOTE_OFFSET_MSB) << 8) | ||
1081 | | i2c_smbus_read_byte_data(client, | ||
1082 | LM63_REG_REMOTE_OFFSET_LSB); | ||
1083 | |||
1084 | if (data->kind == lm96163) | ||
1085 | data->temp11u = (i2c_smbus_read_byte_data(client, | ||
1086 | LM96163_REG_REMOTE_TEMP_U_MSB) << 8) | ||
1087 | | i2c_smbus_read_byte_data(client, | ||
1088 | LM96163_REG_REMOTE_TEMP_U_LSB); | ||
1089 | |||
1090 | data->temp8[2] = i2c_smbus_read_byte_data(client, | ||
1091 | LM63_REG_REMOTE_TCRIT); | ||
1092 | data->temp2_crit_hyst = i2c_smbus_read_byte_data(client, | ||
1093 | LM63_REG_REMOTE_TCRIT_HYST); | ||
1094 | |||
1095 | data->alarms = i2c_smbus_read_byte_data(client, | ||
1096 | LM63_REG_ALERT_STATUS) & 0x7F; | ||
1097 | |||
1098 | data->last_updated = jiffies; | ||
1099 | data->valid = 1; | ||
1100 | } | 1073 | } |
1101 | 1074 | ||
1102 | if (time_after(jiffies, data->lut_last_updated + 5 * HZ) || | 1075 | kfree(data); |
1103 | !data->lut_valid) { | 1076 | return 0; |
1104 | for (i = 0; i < data->lut_size; i++) { | 1077 | } |
1105 | data->pwm1[1 + i] = i2c_smbus_read_byte_data(client, | ||
1106 | LM63_REG_LUT_PWM(i)); | ||
1107 | data->temp8[3 + i] = i2c_smbus_read_byte_data(client, | ||
1108 | LM63_REG_LUT_TEMP(i)); | ||
1109 | } | ||
1110 | data->lut_temp_hyst = i2c_smbus_read_byte_data(client, | ||
1111 | LM63_REG_LUT_TEMP_HYST); | ||
1112 | 1078 | ||
1113 | data->lut_last_updated = jiffies; | 1079 | /* |
1114 | data->lut_valid = 1; | 1080 | * Driver data (common to all clients) |
1115 | } | 1081 | */ |
1116 | 1082 | ||
1117 | mutex_unlock(&data->update_lock); | 1083 | static const struct i2c_device_id lm63_id[] = { |
1084 | { "lm63", lm63 }, | ||
1085 | { "lm64", lm64 }, | ||
1086 | { "lm96163", lm96163 }, | ||
1087 | { } | ||
1088 | }; | ||
1089 | MODULE_DEVICE_TABLE(i2c, lm63_id); | ||
1118 | 1090 | ||
1119 | return data; | 1091 | static struct i2c_driver lm63_driver = { |
1120 | } | 1092 | .class = I2C_CLASS_HWMON, |
1093 | .driver = { | ||
1094 | .name = "lm63", | ||
1095 | }, | ||
1096 | .probe = lm63_probe, | ||
1097 | .remove = lm63_remove, | ||
1098 | .id_table = lm63_id, | ||
1099 | .detect = lm63_detect, | ||
1100 | .address_list = normal_i2c, | ||
1101 | }; | ||
1121 | 1102 | ||
1122 | module_i2c_driver(lm63_driver); | 1103 | module_i2c_driver(lm63_driver); |
1123 | 1104 | ||