Pull hwmon fixes from Guenter Roeck: - bug fixes in asus_atk0110, it87 and max31790 drivers - added missing API definition to hwmon core * tag 'hwmon-for-linus-v4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (asus_atk0110) fix uninitialized data access hwmon: Add missing HWMON_T_ALARM hwmon: (it87) Avoid registering the same chip on both SIO addresses hwmon: (max31790) Set correct PWM value
Unified · Split
| @@ -646,6 +646,9 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) · 645 unmodified lines | ||
| 646 | 646 | else |
| 647 | 647 | err = atk_read_value_new(sensor, value); |
| 648 | 648 | |
| 649 | + if (err) | |
| 650 | + return err; | |
| 651 | + | |
| 649 | 652 | sensor->is_valid = true; |
| 650 | 653 | sensor->last_updated = jiffies; |
| 651 | 654 | sensor->cached_value = *value; |
| @@ -3198,7 +3198,7 @@ static int __init sm_it87_init(void) · 3197 unmodified lines | ||
| 3198 | 3198 | { |
| 3199 | 3199 | int sioaddr[2] = { REG_2E, REG_4E }; |
| 3200 | 3200 | struct it87_sio_data sio_data; |
| 3201 | − unsigned short isa_address; | |
| 3201 | + unsigned short isa_address[2]; | |
| 3202 | 3202 | bool found = false; |
| 3203 | 3203 | int i, err; |
| 3204 | 3204 | |
| @@ -3208,15 +3208,29 @@ static int __init sm_it87_init(void) · 3 unmodified lines | ||
| 3208 | 3208 | |
| 3209 | 3209 | for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { |
| 3210 | 3210 | memset(&sio_data, 0, sizeof(struct it87_sio_data)); |
| 3211 | − isa_address = 0; | |
| 3212 | − err = it87_find(sioaddr[i], &isa_address, &sio_data); | |
| 3213 | − if (err || isa_address == 0) | |
| 3211 | + isa_address[i] = 0; | |
| 3212 | + err = it87_find(sioaddr[i], &isa_address[i], &sio_data); | |
| 3213 | + if (err || isa_address[i] == 0) | |
| 3214 | 3214 | continue; |
| 3215 | + /* | |
| 3216 | + * Don't register second chip if its ISA address matches | |
| 3217 | + * the first chip's ISA address. | |
| 3218 | + */ | |
| 3219 | + if (i && isa_address[i] == isa_address[0]) | |
| 3220 | + break; | |
| 3215 | 3221 | |
| 3216 | − err = it87_device_add(i, isa_address, &sio_data); | |
| 3222 | + err = it87_device_add(i, isa_address[i], &sio_data); | |
| 3217 | 3223 | if (err) |
| 3218 | 3224 | goto exit_dev_unregister; |
| 3225 | + | |
| 3219 | 3226 | found = true; |
| 3227 | + | |
| 3228 | + /* | |
| 3229 | + * IT8705F may respond on both SIO addresses. | |
| 3230 | + * Stop probing after finding one. | |
| 3231 | + */ | |
| 3232 | + if (sio_data.type == it87) | |
| 3233 | + break; | |
| 3220 | 3234 | } |
| 3221 | 3235 | |
| 3222 | 3236 | if (!found) { |
| @@ -311,7 +311,7 @@ static int max31790_write_pwm(struct device *dev, u32 attr, int channel, · 310 unmodified lines | ||
| 311 | 311 | data->pwm[channel] = val << 8; |
| 312 | 312 | err = i2c_smbus_write_word_swapped(client, |
| 313 | 313 | MAX31790_REG_PWMOUT(channel), |
| 314 | − val); | |
| 314 | + data->pwm[channel]); | |
| 315 | 315 | break; |
| 316 | 316 | case hwmon_pwm_enable: |
| 317 | 317 | fan_config = data->fan_config[channel]; |
| @@ -88,6 +88,7 @@ enum hwmon_temp_attributes { · 87 unmodified lines | ||
| 88 | 88 | #define HWMON_T_CRIT_HYST BIT(hwmon_temp_crit_hyst) |
| 89 | 89 | #define HWMON_T_EMERGENCY BIT(hwmon_temp_emergency) |
| 90 | 90 | #define HWMON_T_EMERGENCY_HYST BIT(hwmon_temp_emergency_hyst) |
| 91 | +#define HWMON_T_ALARM BIT(hwmon_temp_alarm) | |
| 91 | 92 | #define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm) |
| 92 | 93 | #define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm) |
| 93 | 94 | #define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm) |