diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/lineage-pem.c | 2 | ||||
-rw-r--r-- | drivers/hwmon/lm75.h | 2 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ltc2978.c | 14 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 12 |
4 files changed, 18 insertions, 12 deletions
diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c index 41df29f59b0e..ebbb9f4f27a3 100644 --- a/drivers/hwmon/lineage-pem.c +++ b/drivers/hwmon/lineage-pem.c | |||
@@ -422,6 +422,7 @@ static struct attribute *pem_input_attributes[] = { | |||
422 | &sensor_dev_attr_in2_input.dev_attr.attr, | 422 | &sensor_dev_attr_in2_input.dev_attr.attr, |
423 | &sensor_dev_attr_curr1_input.dev_attr.attr, | 423 | &sensor_dev_attr_curr1_input.dev_attr.attr, |
424 | &sensor_dev_attr_power1_input.dev_attr.attr, | 424 | &sensor_dev_attr_power1_input.dev_attr.attr, |
425 | NULL | ||
425 | }; | 426 | }; |
426 | 427 | ||
427 | static const struct attribute_group pem_input_group = { | 428 | static const struct attribute_group pem_input_group = { |
@@ -432,6 +433,7 @@ static struct attribute *pem_fan_attributes[] = { | |||
432 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 433 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
433 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 434 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
434 | &sensor_dev_attr_fan3_input.dev_attr.attr, | 435 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
436 | NULL | ||
435 | }; | 437 | }; |
436 | 438 | ||
437 | static const struct attribute_group pem_fan_group = { | 439 | static const struct attribute_group pem_fan_group = { |
diff --git a/drivers/hwmon/lm75.h b/drivers/hwmon/lm75.h index 668ff4721323..5cde94e56f17 100644 --- a/drivers/hwmon/lm75.h +++ b/drivers/hwmon/lm75.h | |||
@@ -25,7 +25,7 @@ | |||
25 | which contains this code, we don't worry about the wasted space. | 25 | which contains this code, we don't worry about the wasted space. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/hwmon.h> | 28 | #include <linux/kernel.h> |
29 | 29 | ||
30 | /* straight from the datasheet */ | 30 | /* straight from the datasheet */ |
31 | #define LM75_TEMP_MIN (-55000) | 31 | #define LM75_TEMP_MIN (-55000) |
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index a58de38e23d8..6d6130752f94 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c | |||
@@ -59,7 +59,7 @@ enum chips { ltc2978, ltc3880 }; | |||
59 | struct ltc2978_data { | 59 | struct ltc2978_data { |
60 | enum chips id; | 60 | enum chips id; |
61 | int vin_min, vin_max; | 61 | int vin_min, vin_max; |
62 | int temp_min, temp_max; | 62 | int temp_min, temp_max[2]; |
63 | int vout_min[8], vout_max[8]; | 63 | int vout_min[8], vout_max[8]; |
64 | int iout_max[2]; | 64 | int iout_max[2]; |
65 | int temp2_max; | 65 | int temp2_max; |
@@ -113,9 +113,10 @@ static int ltc2978_read_word_data_common(struct i2c_client *client, int page, | |||
113 | ret = pmbus_read_word_data(client, page, | 113 | ret = pmbus_read_word_data(client, page, |
114 | LTC2978_MFR_TEMPERATURE_PEAK); | 114 | LTC2978_MFR_TEMPERATURE_PEAK); |
115 | if (ret >= 0) { | 115 | if (ret >= 0) { |
116 | if (lin11_to_val(ret) > lin11_to_val(data->temp_max)) | 116 | if (lin11_to_val(ret) |
117 | data->temp_max = ret; | 117 | > lin11_to_val(data->temp_max[page])) |
118 | ret = data->temp_max; | 118 | data->temp_max[page] = ret; |
119 | ret = data->temp_max[page]; | ||
119 | } | 120 | } |
120 | break; | 121 | break; |
121 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | 122 | case PMBUS_VIRT_RESET_VOUT_HISTORY: |
@@ -266,7 +267,7 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | |||
266 | break; | 267 | break; |
267 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | 268 | case PMBUS_VIRT_RESET_TEMP_HISTORY: |
268 | data->temp_min = 0x7bff; | 269 | data->temp_min = 0x7bff; |
269 | data->temp_max = 0x7c00; | 270 | data->temp_max[page] = 0x7c00; |
270 | ret = ltc2978_clear_peaks(client, page, data->id); | 271 | ret = ltc2978_clear_peaks(client, page, data->id); |
271 | break; | 272 | break; |
272 | default: | 273 | default: |
@@ -323,7 +324,8 @@ static int ltc2978_probe(struct i2c_client *client, | |||
323 | data->vin_min = 0x7bff; | 324 | data->vin_min = 0x7bff; |
324 | data->vin_max = 0x7c00; | 325 | data->vin_max = 0x7c00; |
325 | data->temp_min = 0x7bff; | 326 | data->temp_min = 0x7bff; |
326 | data->temp_max = 0x7c00; | 327 | for (i = 0; i < ARRAY_SIZE(data->temp_max); i++) |
328 | data->temp_max[i] = 0x7c00; | ||
327 | data->temp2_max = 0x7c00; | 329 | data->temp2_max = 0x7c00; |
328 | 330 | ||
329 | switch (data->id) { | 331 | switch (data->id) { |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 80eef50c50fd..9add60920ac0 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -766,12 +766,14 @@ static ssize_t pmbus_show_label(struct device *dev, | |||
766 | static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) | 766 | static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) |
767 | { | 767 | { |
768 | if (data->num_attributes >= data->max_attributes - 1) { | 768 | if (data->num_attributes >= data->max_attributes - 1) { |
769 | data->max_attributes += PMBUS_ATTR_ALLOC_SIZE; | 769 | int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE; |
770 | data->group.attrs = krealloc(data->group.attrs, | 770 | void *new_attrs = krealloc(data->group.attrs, |
771 | sizeof(struct attribute *) * | 771 | new_max_attrs * sizeof(void *), |
772 | data->max_attributes, GFP_KERNEL); | 772 | GFP_KERNEL); |
773 | if (data->group.attrs == NULL) | 773 | if (!new_attrs) |
774 | return -ENOMEM; | 774 | return -ENOMEM; |
775 | data->group.attrs = new_attrs; | ||
776 | data->max_attributes = new_max_attrs; | ||
775 | } | 777 | } |
776 | 778 | ||
777 | data->group.attrs[data->num_attributes++] = attr; | 779 | data->group.attrs[data->num_attributes++] = attr; |