diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-01-14 16:30:47 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 21:27:03 -0400 |
commit | 525ad3731949fd9049254eabde57012d7cc06dbc (patch) | |
tree | a844740acca1463475459e3b8d41f7bcc3df9260 /drivers/hwmon/fschmd.c | |
parent | f24d548bf2c4da3fd2cc4d0ffec108216b705850 (diff) |
hwmon: (fschmd) Fix checkpatch issues
Fixed:
ERROR: that open brace { should be on the previous line
ERROR: trailing statements should be on next line
WARNING: line over 80 characters
WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: simple_strtoul is obsolete, use kstrtoul instead
Modify multi-line comments to follow Documentation/CodingStyle.
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/fschmd.c')
-rw-r--r-- | drivers/hwmon/fschmd.c | 218 |
1 files changed, 142 insertions, 76 deletions
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index 73ba942609c2..8305d29459bd 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* fschmd.c | 1 | /* |
2 | * fschmd.c | ||
2 | * | 3 | * |
3 | * Copyright (C) 2007 - 2009 Hans de Goede <hdegoede@redhat.com> | 4 | * Copyright (C) 2007 - 2009 Hans de Goede <hdegoede@redhat.com> |
4 | * | 5 | * |
@@ -76,12 +77,12 @@ enum chips { fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl }; | |||
76 | #define FSCHMD_CONTROL_ALERT_LED 0x01 | 77 | #define FSCHMD_CONTROL_ALERT_LED 0x01 |
77 | 78 | ||
78 | /* watchdog */ | 79 | /* watchdog */ |
79 | static const u8 FSCHMD_REG_WDOG_CONTROL[7] = | 80 | static const u8 FSCHMD_REG_WDOG_CONTROL[7] = { |
80 | { 0x21, 0x21, 0x21, 0x21, 0x21, 0x28, 0x28 }; | 81 | 0x21, 0x21, 0x21, 0x21, 0x21, 0x28, 0x28 }; |
81 | static const u8 FSCHMD_REG_WDOG_STATE[7] = | 82 | static const u8 FSCHMD_REG_WDOG_STATE[7] = { |
82 | { 0x23, 0x23, 0x23, 0x23, 0x23, 0x29, 0x29 }; | 83 | 0x23, 0x23, 0x23, 0x23, 0x23, 0x29, 0x29 }; |
83 | static const u8 FSCHMD_REG_WDOG_PRESET[7] = | 84 | static const u8 FSCHMD_REG_WDOG_PRESET[7] = { |
84 | { 0x28, 0x28, 0x28, 0x28, 0x28, 0x2a, 0x2a }; | 85 | 0x28, 0x28, 0x28, 0x28, 0x28, 0x2a, 0x2a }; |
85 | 86 | ||
86 | #define FSCHMD_WDOG_CONTROL_TRIGGER 0x10 | 87 | #define FSCHMD_WDOG_CONTROL_TRIGGER 0x10 |
87 | #define FSCHMD_WDOG_CONTROL_STARTED 0x10 /* the same as trigger */ | 88 | #define FSCHMD_WDOG_CONTROL_STARTED 0x10 /* the same as trigger */ |
@@ -103,10 +104,12 @@ static const u8 FSCHMD_REG_VOLT[7][6] = { | |||
103 | 104 | ||
104 | static const int FSCHMD_NO_VOLT_SENSORS[7] = { 3, 3, 3, 3, 3, 3, 6 }; | 105 | static const int FSCHMD_NO_VOLT_SENSORS[7] = { 3, 3, 3, 3, 3, 3, 6 }; |
105 | 106 | ||
106 | /* minimum pwm at which the fan is driven (pwm can by increased depending on | 107 | /* |
107 | the temp. Notice that for the scy some fans share there minimum speed. | 108 | * minimum pwm at which the fan is driven (pwm can by increased depending on |
108 | Also notice that with the scy the sensor order is different than with the | 109 | * the temp. Notice that for the scy some fans share there minimum speed. |
109 | other chips, this order was in the 2.4 driver and kept for consistency. */ | 110 | * Also notice that with the scy the sensor order is different than with the |
111 | * other chips, this order was in the 2.4 driver and kept for consistency. | ||
112 | */ | ||
110 | static const u8 FSCHMD_REG_FAN_MIN[7][7] = { | 113 | static const u8 FSCHMD_REG_FAN_MIN[7][7] = { |
111 | { 0x55, 0x65 }, /* pos */ | 114 | { 0x55, 0x65 }, /* pos */ |
112 | { 0x55, 0x65, 0xb5 }, /* her */ | 115 | { 0x55, 0x65, 0xb5 }, /* her */ |
@@ -182,11 +185,13 @@ static const u8 FSCHMD_REG_TEMP_STATE[7][11] = { | |||
182 | 0xb9, 0xc9, 0xd9, 0xe9, 0xf9 }, | 185 | 0xb9, 0xc9, 0xd9, 0xe9, 0xf9 }, |
183 | }; | 186 | }; |
184 | 187 | ||
185 | /* temperature high limit registers, FSC does not document these. Proven to be | 188 | /* |
186 | there with field testing on the fscher and fschrc, already supported / used | 189 | * temperature high limit registers, FSC does not document these. Proven to be |
187 | in the fscscy 2.4 driver. FSC has confirmed that the fschmd has registers | 190 | * there with field testing on the fscher and fschrc, already supported / used |
188 | at these addresses, but doesn't want to confirm they are the same as with | 191 | * in the fscscy 2.4 driver. FSC has confirmed that the fschmd has registers |
189 | the fscher?? */ | 192 | * at these addresses, but doesn't want to confirm they are the same as with |
193 | * the fscher?? | ||
194 | */ | ||
190 | static const u8 FSCHMD_REG_TEMP_LIMIT[7][11] = { | 195 | static const u8 FSCHMD_REG_TEMP_LIMIT[7][11] = { |
191 | { 0, 0, 0 }, /* pos */ | 196 | { 0, 0, 0 }, /* pos */ |
192 | { 0x76, 0x86, 0x96 }, /* her */ | 197 | { 0x76, 0x86, 0x96 }, /* her */ |
@@ -198,13 +203,15 @@ static const u8 FSCHMD_REG_TEMP_LIMIT[7][11] = { | |||
198 | 0xba, 0xca, 0xda, 0xea, 0xfa }, | 203 | 0xba, 0xca, 0xda, 0xea, 0xfa }, |
199 | }; | 204 | }; |
200 | 205 | ||
201 | /* These were found through experimenting with an fscher, currently they are | 206 | /* |
202 | not used, but we keep them around for future reference. | 207 | * These were found through experimenting with an fscher, currently they are |
203 | On the fscsyl AUTOP1 lives at 0x#c (so 0x5c for fan1, 0x6c for fan2, etc), | 208 | * not used, but we keep them around for future reference. |
204 | AUTOP2 lives at 0x#e, and 0x#1 is a bitmask defining which temps influence | 209 | * On the fscsyl AUTOP1 lives at 0x#c (so 0x5c for fan1, 0x6c for fan2, etc), |
205 | the fan speed. | 210 | * AUTOP2 lives at 0x#e, and 0x#1 is a bitmask defining which temps influence |
206 | static const u8 FSCHER_REG_TEMP_AUTOP1[] = { 0x73, 0x83, 0x93 }; | 211 | * the fan speed. |
207 | static const u8 FSCHER_REG_TEMP_AUTOP2[] = { 0x75, 0x85, 0x95 }; */ | 212 | * static const u8 FSCHER_REG_TEMP_AUTOP1[] = { 0x73, 0x83, 0x93 }; |
213 | * static const u8 FSCHER_REG_TEMP_AUTOP2[] = { 0x75, 0x85, 0x95 }; | ||
214 | */ | ||
208 | 215 | ||
209 | static const int FSCHMD_NO_TEMP_SENSORS[7] = { 3, 3, 4, 3, 5, 5, 11 }; | 216 | static const int FSCHMD_NO_TEMP_SENSORS[7] = { 3, 3, 4, 3, 5, 5, 11 }; |
210 | 217 | ||
@@ -290,24 +297,30 @@ struct fschmd_data { | |||
290 | u8 fan_ripple[7]; /* divider for rps */ | 297 | u8 fan_ripple[7]; /* divider for rps */ |
291 | }; | 298 | }; |
292 | 299 | ||
293 | /* Global variables to hold information read from special DMI tables, which are | 300 | /* |
294 | available on FSC machines with an fscher or later chip. There is no need to | 301 | * Global variables to hold information read from special DMI tables, which are |
295 | protect these with a lock as they are only modified from our attach function | 302 | * available on FSC machines with an fscher or later chip. There is no need to |
296 | which always gets called with the i2c-core lock held and never accessed | 303 | * protect these with a lock as they are only modified from our attach function |
297 | before the attach function is done with them. */ | 304 | * which always gets called with the i2c-core lock held and never accessed |
305 | * before the attach function is done with them. | ||
306 | */ | ||
298 | static int dmi_mult[6] = { 490, 200, 100, 100, 200, 100 }; | 307 | static int dmi_mult[6] = { 490, 200, 100, 100, 200, 100 }; |
299 | static int dmi_offset[6] = { 0, 0, 0, 0, 0, 0 }; | 308 | static int dmi_offset[6] = { 0, 0, 0, 0, 0, 0 }; |
300 | static int dmi_vref = -1; | 309 | static int dmi_vref = -1; |
301 | 310 | ||
302 | /* Somewhat ugly :( global data pointer list with all fschmd devices, so that | 311 | /* |
303 | we can find our device data as when using misc_register there is no other | 312 | * Somewhat ugly :( global data pointer list with all fschmd devices, so that |
304 | method to get to ones device data from the open fop. */ | 313 | * we can find our device data as when using misc_register there is no other |
314 | * method to get to ones device data from the open fop. | ||
315 | */ | ||
305 | static LIST_HEAD(watchdog_data_list); | 316 | static LIST_HEAD(watchdog_data_list); |
306 | /* Note this lock not only protect list access, but also data.kref access */ | 317 | /* Note this lock not only protect list access, but also data.kref access */ |
307 | static DEFINE_MUTEX(watchdog_data_mutex); | 318 | static DEFINE_MUTEX(watchdog_data_mutex); |
308 | 319 | ||
309 | /* Release our data struct when we're detached from the i2c client *and* all | 320 | /* |
310 | references to our watchdog device are released */ | 321 | * Release our data struct when we're detached from the i2c client *and* all |
322 | * references to our watchdog device are released | ||
323 | */ | ||
311 | static void fschmd_release_resources(struct kref *ref) | 324 | static void fschmd_release_resources(struct kref *ref) |
312 | { | 325 | { |
313 | struct fschmd_data *data = container_of(ref, struct fschmd_data, kref); | 326 | struct fschmd_data *data = container_of(ref, struct fschmd_data, kref); |
@@ -359,9 +372,14 @@ static ssize_t store_temp_max(struct device *dev, struct device_attribute | |||
359 | { | 372 | { |
360 | int index = to_sensor_dev_attr(devattr)->index; | 373 | int index = to_sensor_dev_attr(devattr)->index; |
361 | struct fschmd_data *data = dev_get_drvdata(dev); | 374 | struct fschmd_data *data = dev_get_drvdata(dev); |
362 | long v = simple_strtol(buf, NULL, 10) / 1000; | 375 | long v; |
376 | int err; | ||
377 | |||
378 | err = kstrtol(buf, 10, &v); | ||
379 | if (err) | ||
380 | return err; | ||
363 | 381 | ||
364 | v = SENSORS_LIMIT(v, -128, 127) + 128; | 382 | v = SENSORS_LIMIT(v / 1000, -128, 127) + 128; |
365 | 383 | ||
366 | mutex_lock(&data->update_lock); | 384 | mutex_lock(&data->update_lock); |
367 | i2c_smbus_write_byte_data(to_i2c_client(dev), | 385 | i2c_smbus_write_byte_data(to_i2c_client(dev), |
@@ -427,12 +445,23 @@ static ssize_t store_fan_div(struct device *dev, struct device_attribute | |||
427 | int index = to_sensor_dev_attr(devattr)->index; | 445 | int index = to_sensor_dev_attr(devattr)->index; |
428 | struct fschmd_data *data = dev_get_drvdata(dev); | 446 | struct fschmd_data *data = dev_get_drvdata(dev); |
429 | /* supported values: 2, 4, 8 */ | 447 | /* supported values: 2, 4, 8 */ |
430 | unsigned long v = simple_strtoul(buf, NULL, 10); | 448 | unsigned long v; |
449 | int err; | ||
450 | |||
451 | err = kstrtoul(buf, 10, &v); | ||
452 | if (err) | ||
453 | return err; | ||
431 | 454 | ||
432 | switch (v) { | 455 | switch (v) { |
433 | case 2: v = 1; break; | 456 | case 2: |
434 | case 4: v = 2; break; | 457 | v = 1; |
435 | case 8: v = 3; break; | 458 | break; |
459 | case 4: | ||
460 | v = 2; | ||
461 | break; | ||
462 | case 8: | ||
463 | v = 3; | ||
464 | break; | ||
436 | default: | 465 | default: |
437 | dev_err(dev, "fan_div value %lu not supported. " | 466 | dev_err(dev, "fan_div value %lu not supported. " |
438 | "Choose one of 2, 4 or 8!\n", v); | 467 | "Choose one of 2, 4 or 8!\n", v); |
@@ -502,7 +531,12 @@ static ssize_t store_pwm_auto_point1_pwm(struct device *dev, | |||
502 | { | 531 | { |
503 | int index = to_sensor_dev_attr(devattr)->index; | 532 | int index = to_sensor_dev_attr(devattr)->index; |
504 | struct fschmd_data *data = dev_get_drvdata(dev); | 533 | struct fschmd_data *data = dev_get_drvdata(dev); |
505 | unsigned long v = simple_strtoul(buf, NULL, 10); | 534 | unsigned long v; |
535 | int err; | ||
536 | |||
537 | err = kstrtoul(buf, 10, &v); | ||
538 | if (err) | ||
539 | return err; | ||
506 | 540 | ||
507 | /* reg: 0 = allow turning off (except on the syl), 1-255 = 50-100% */ | 541 | /* reg: 0 = allow turning off (except on the syl), 1-255 = 50-100% */ |
508 | if (v || data->kind == fscsyl) { | 542 | if (v || data->kind == fscsyl) { |
@@ -522,8 +556,10 @@ static ssize_t store_pwm_auto_point1_pwm(struct device *dev, | |||
522 | } | 556 | } |
523 | 557 | ||
524 | 558 | ||
525 | /* The FSC hwmon family has the ability to force an attached alert led to flash | 559 | /* |
526 | from software, we export this as an alert_led sysfs attr */ | 560 | * The FSC hwmon family has the ability to force an attached alert led to flash |
561 | * from software, we export this as an alert_led sysfs attr | ||
562 | */ | ||
527 | static ssize_t show_alert_led(struct device *dev, | 563 | static ssize_t show_alert_led(struct device *dev, |
528 | struct device_attribute *devattr, char *buf) | 564 | struct device_attribute *devattr, char *buf) |
529 | { | 565 | { |
@@ -540,7 +576,12 @@ static ssize_t store_alert_led(struct device *dev, | |||
540 | { | 576 | { |
541 | u8 reg; | 577 | u8 reg; |
542 | struct fschmd_data *data = dev_get_drvdata(dev); | 578 | struct fschmd_data *data = dev_get_drvdata(dev); |
543 | unsigned long v = simple_strtoul(buf, NULL, 10); | 579 | unsigned long v; |
580 | int err; | ||
581 | |||
582 | err = kstrtoul(buf, 10, &v); | ||
583 | if (err) | ||
584 | return err; | ||
544 | 585 | ||
545 | mutex_lock(&data->update_lock); | 586 | mutex_lock(&data->update_lock); |
546 | 587 | ||
@@ -754,8 +795,10 @@ static int watchdog_stop(struct fschmd_data *data) | |||
754 | } | 795 | } |
755 | 796 | ||
756 | data->watchdog_control &= ~FSCHMD_WDOG_CONTROL_STARTED; | 797 | data->watchdog_control &= ~FSCHMD_WDOG_CONTROL_STARTED; |
757 | /* Don't store the stop flag in our watchdog control register copy, as | 798 | /* |
758 | its a write only bit (read always returns 0) */ | 799 | * Don't store the stop flag in our watchdog control register copy, as |
800 | * its a write only bit (read always returns 0) | ||
801 | */ | ||
759 | i2c_smbus_write_byte_data(data->client, | 802 | i2c_smbus_write_byte_data(data->client, |
760 | FSCHMD_REG_WDOG_CONTROL[data->kind], | 803 | FSCHMD_REG_WDOG_CONTROL[data->kind], |
761 | data->watchdog_control | FSCHMD_WDOG_CONTROL_STOP); | 804 | data->watchdog_control | FSCHMD_WDOG_CONTROL_STOP); |
@@ -769,10 +812,12 @@ static int watchdog_open(struct inode *inode, struct file *filp) | |||
769 | struct fschmd_data *pos, *data = NULL; | 812 | struct fschmd_data *pos, *data = NULL; |
770 | int watchdog_is_open; | 813 | int watchdog_is_open; |
771 | 814 | ||
772 | /* We get called from drivers/char/misc.c with misc_mtx hold, and we | 815 | /* |
773 | call misc_register() from fschmd_probe() with watchdog_data_mutex | 816 | * We get called from drivers/char/misc.c with misc_mtx hold, and we |
774 | hold, as misc_register() takes the misc_mtx lock, this is a possible | 817 | * call misc_register() from fschmd_probe() with watchdog_data_mutex |
775 | deadlock, so we use mutex_trylock here. */ | 818 | * hold, as misc_register() takes the misc_mtx lock, this is a possible |
819 | * deadlock, so we use mutex_trylock here. | ||
820 | */ | ||
776 | if (!mutex_trylock(&watchdog_data_mutex)) | 821 | if (!mutex_trylock(&watchdog_data_mutex)) |
777 | return -ERESTARTSYS; | 822 | return -ERESTARTSYS; |
778 | list_for_each_entry(pos, &watchdog_data_list, list) { | 823 | list_for_each_entry(pos, &watchdog_data_list, list) { |
@@ -847,7 +892,8 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf, | |||
847 | return count; | 892 | return count; |
848 | } | 893 | } |
849 | 894 | ||
850 | static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 895 | static long watchdog_ioctl(struct file *filp, unsigned int cmd, |
896 | unsigned long arg) | ||
851 | { | 897 | { |
852 | struct watchdog_info ident = { | 898 | struct watchdog_info ident = { |
853 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | | 899 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | |
@@ -930,30 +976,38 @@ static const struct file_operations watchdog_fops = { | |||
930 | * Detect, register, unregister and update device functions | 976 | * Detect, register, unregister and update device functions |
931 | */ | 977 | */ |
932 | 978 | ||
933 | /* DMI decode routine to read voltage scaling factors from special DMI tables, | 979 | /* |
934 | which are available on FSC machines with an fscher or later chip. */ | 980 | * DMI decode routine to read voltage scaling factors from special DMI tables, |
981 | * which are available on FSC machines with an fscher or later chip. | ||
982 | */ | ||
935 | static void fschmd_dmi_decode(const struct dmi_header *header, void *dummy) | 983 | static void fschmd_dmi_decode(const struct dmi_header *header, void *dummy) |
936 | { | 984 | { |
937 | int i, mult[3] = { 0 }, offset[3] = { 0 }, vref = 0, found = 0; | 985 | int i, mult[3] = { 0 }, offset[3] = { 0 }, vref = 0, found = 0; |
938 | 986 | ||
939 | /* dmi code ugliness, we get passed the address of the contents of | 987 | /* |
940 | a complete DMI record, but in the form of a dmi_header pointer, in | 988 | * dmi code ugliness, we get passed the address of the contents of |
941 | reality this address holds header->length bytes of which the header | 989 | * a complete DMI record, but in the form of a dmi_header pointer, in |
942 | are the first 4 bytes */ | 990 | * reality this address holds header->length bytes of which the header |
991 | * are the first 4 bytes | ||
992 | */ | ||
943 | u8 *dmi_data = (u8 *)header; | 993 | u8 *dmi_data = (u8 *)header; |
944 | 994 | ||
945 | /* We are looking for OEM-specific type 185 */ | 995 | /* We are looking for OEM-specific type 185 */ |
946 | if (header->type != 185) | 996 | if (header->type != 185) |
947 | return; | 997 | return; |
948 | 998 | ||
949 | /* we are looking for what Siemens calls "subtype" 19, the subtype | 999 | /* |
950 | is stored in byte 5 of the dmi block */ | 1000 | * we are looking for what Siemens calls "subtype" 19, the subtype |
1001 | * is stored in byte 5 of the dmi block | ||
1002 | */ | ||
951 | if (header->length < 5 || dmi_data[4] != 19) | 1003 | if (header->length < 5 || dmi_data[4] != 19) |
952 | return; | 1004 | return; |
953 | 1005 | ||
954 | /* After the subtype comes 1 unknown byte and then blocks of 5 bytes, | 1006 | /* |
955 | consisting of what Siemens calls an "Entity" number, followed by | 1007 | * After the subtype comes 1 unknown byte and then blocks of 5 bytes, |
956 | 2 16-bit words in LSB first order */ | 1008 | * consisting of what Siemens calls an "Entity" number, followed by |
1009 | * 2 16-bit words in LSB first order | ||
1010 | */ | ||
957 | for (i = 6; (i + 4) < header->length; i += 5) { | 1011 | for (i = 6; (i + 4) < header->length; i += 5) { |
958 | /* entity 1 - 3: voltage multiplier and offset */ | 1012 | /* entity 1 - 3: voltage multiplier and offset */ |
959 | if (dmi_data[i] >= 1 && dmi_data[i] <= 3) { | 1013 | if (dmi_data[i] >= 1 && dmi_data[i] <= 3) { |
@@ -988,9 +1042,11 @@ static void fschmd_dmi_decode(const struct dmi_header *header, void *dummy) | |||
988 | dmi_mult[i] = mult[i] * 10; | 1042 | dmi_mult[i] = mult[i] * 10; |
989 | dmi_offset[i] = offset[i] * 10; | 1043 | dmi_offset[i] = offset[i] * 10; |
990 | } | 1044 | } |
991 | /* According to the docs there should be separate dmi entries | 1045 | /* |
992 | for the mult's and offsets of in3-5 of the syl, but on | 1046 | * According to the docs there should be separate dmi entries |
993 | my test machine these are not present */ | 1047 | * for the mult's and offsets of in3-5 of the syl, but on |
1048 | * my test machine these are not present | ||
1049 | */ | ||
994 | dmi_mult[3] = dmi_mult[2]; | 1050 | dmi_mult[3] = dmi_mult[2]; |
995 | dmi_mult[4] = dmi_mult[1]; | 1051 | dmi_mult[4] = dmi_mult[1]; |
996 | dmi_mult[5] = dmi_mult[2]; | 1052 | dmi_mult[5] = dmi_mult[2]; |
@@ -1058,15 +1114,19 @@ static int fschmd_probe(struct i2c_client *client, | |||
1058 | mutex_init(&data->watchdog_lock); | 1114 | mutex_init(&data->watchdog_lock); |
1059 | INIT_LIST_HEAD(&data->list); | 1115 | INIT_LIST_HEAD(&data->list); |
1060 | kref_init(&data->kref); | 1116 | kref_init(&data->kref); |
1061 | /* Store client pointer in our data struct for watchdog usage | 1117 | /* |
1062 | (where the client is found through a data ptr instead of the | 1118 | * Store client pointer in our data struct for watchdog usage |
1063 | otherway around) */ | 1119 | * (where the client is found through a data ptr instead of the |
1120 | * otherway around) | ||
1121 | */ | ||
1064 | data->client = client; | 1122 | data->client = client; |
1065 | data->kind = kind; | 1123 | data->kind = kind; |
1066 | 1124 | ||
1067 | if (kind == fscpos) { | 1125 | if (kind == fscpos) { |
1068 | /* The Poseidon has hardwired temp limits, fill these | 1126 | /* |
1069 | in for the alarm resetting code */ | 1127 | * The Poseidon has hardwired temp limits, fill these |
1128 | * in for the alarm resetting code | ||
1129 | */ | ||
1070 | data->temp_max[0] = 70 + 128; | 1130 | data->temp_max[0] = 70 + 128; |
1071 | data->temp_max[1] = 50 + 128; | 1131 | data->temp_max[1] = 50 + 128; |
1072 | data->temp_max[2] = 50 + 128; | 1132 | data->temp_max[2] = 50 + 128; |
@@ -1157,9 +1217,11 @@ static int fschmd_probe(struct i2c_client *client, | |||
1157 | goto exit_detach; | 1217 | goto exit_detach; |
1158 | } | 1218 | } |
1159 | 1219 | ||
1160 | /* We take the data_mutex lock early so that watchdog_open() cannot | 1220 | /* |
1161 | run when misc_register() has completed, but we've not yet added | 1221 | * We take the data_mutex lock early so that watchdog_open() cannot |
1162 | our data to the watchdog_data_list (and set the default timeout) */ | 1222 | * run when misc_register() has completed, but we've not yet added |
1223 | * our data to the watchdog_data_list (and set the default timeout) | ||
1224 | */ | ||
1163 | mutex_lock(&watchdog_data_mutex); | 1225 | mutex_lock(&watchdog_data_mutex); |
1164 | for (i = 0; i < ARRAY_SIZE(watchdog_minors); i++) { | 1226 | for (i = 0; i < ARRAY_SIZE(watchdog_minors); i++) { |
1165 | /* Register our watchdog part */ | 1227 | /* Register our watchdog part */ |
@@ -1225,8 +1287,10 @@ static int fschmd_remove(struct i2c_client *client) | |||
1225 | mutex_unlock(&data->watchdog_lock); | 1287 | mutex_unlock(&data->watchdog_lock); |
1226 | } | 1288 | } |
1227 | 1289 | ||
1228 | /* Check if registered in case we're called from fschmd_detect | 1290 | /* |
1229 | to cleanup after an error */ | 1291 | * Check if registered in case we're called from fschmd_detect |
1292 | * to cleanup after an error | ||
1293 | */ | ||
1230 | if (data->hwmon_dev) | 1294 | if (data->hwmon_dev) |
1231 | hwmon_device_unregister(data->hwmon_dev); | 1295 | hwmon_device_unregister(data->hwmon_dev); |
1232 | 1296 | ||
@@ -1269,8 +1333,10 @@ static struct fschmd_data *fschmd_update_device(struct device *dev) | |||
1269 | client, | 1333 | client, |
1270 | FSCHMD_REG_TEMP_LIMIT[data->kind][i]); | 1334 | FSCHMD_REG_TEMP_LIMIT[data->kind][i]); |
1271 | 1335 | ||
1272 | /* reset alarm if the alarm condition is gone, | 1336 | /* |
1273 | the chip doesn't do this itself */ | 1337 | * reset alarm if the alarm condition is gone, |
1338 | * the chip doesn't do this itself | ||
1339 | */ | ||
1274 | if ((data->temp_status[i] & FSCHMD_TEMP_ALARM_MASK) == | 1340 | if ((data->temp_status[i] & FSCHMD_TEMP_ALARM_MASK) == |
1275 | FSCHMD_TEMP_ALARM_MASK && | 1341 | FSCHMD_TEMP_ALARM_MASK && |
1276 | data->temp_act[i] < data->temp_max[i]) | 1342 | data->temp_act[i] < data->temp_max[i]) |