Skip to content

Commit 374630e

Browse files
committed
Merge tag 'hwmon-for-v5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - Fix crash in nct6775 driver - Prevent divide by zero in adt7470 driver - Fix conditional compile warning in pmbus/ir38064 driver - Various minor fixes in lm90 driver * tag 'hwmon-for-v5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (nct6775) Fix crash in clear_caseopen hwmon: (adt7470) Prevent divide by zero in adt7470_fan_write() hwmon: (pmbus/ir38064) Mark ir38064_of_match as __maybe_unused hwmon: (lm90) Fix sysfs and udev notifications hwmon: (lm90) Mark alert as broken for MAX6646/6647/6649 hwmon: (lm90) Mark alert as broken for MAX6680 hwmon: (lm90) Mark alert as broken for MAX6654 hwmon: (lm90) Re-enable interrupts after alert clears hwmon: (lm90) Reduce maximum conversion rate for G781
2 parents 82b550f + 79da533 commit 374630e

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

drivers/hwmon/adt7470.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,9 @@ static int adt7470_fan_write(struct device *dev, u32 attr, int channel, long val
662662
struct adt7470_data *data = dev_get_drvdata(dev);
663663
int err;
664664

665+
if (val <= 0)
666+
return -EINVAL;
667+
665668
val = FAN_RPM_TO_PERIOD(val);
666669
val = clamp_val(val, 1, 65534);
667670

drivers/hwmon/lm90.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static const struct lm90_params lm90_params[] = {
373373
.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
374374
| LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT,
375375
.alert_alarms = 0x7c,
376-
.max_convrate = 8,
376+
.max_convrate = 7,
377377
},
378378
[lm86] = {
379379
.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
@@ -394,12 +394,13 @@ static const struct lm90_params lm90_params[] = {
394394
.max_convrate = 9,
395395
},
396396
[max6646] = {
397-
.flags = LM90_HAVE_CRIT,
397+
.flags = LM90_HAVE_CRIT | LM90_HAVE_BROKEN_ALERT,
398398
.alert_alarms = 0x7c,
399399
.max_convrate = 6,
400400
.reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
401401
},
402402
[max6654] = {
403+
.flags = LM90_HAVE_BROKEN_ALERT,
403404
.alert_alarms = 0x7c,
404405
.max_convrate = 7,
405406
.reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
@@ -418,7 +419,7 @@ static const struct lm90_params lm90_params[] = {
418419
},
419420
[max6680] = {
420421
.flags = LM90_HAVE_OFFSET | LM90_HAVE_CRIT
421-
| LM90_HAVE_CRIT_ALRM_SWP,
422+
| LM90_HAVE_CRIT_ALRM_SWP | LM90_HAVE_BROKEN_ALERT,
422423
.alert_alarms = 0x7c,
423424
.max_convrate = 7,
424425
},
@@ -848,7 +849,7 @@ static int lm90_update_device(struct device *dev)
848849
* Re-enable ALERT# output if it was originally enabled and
849850
* relevant alarms are all clear
850851
*/
851-
if (!(data->config_orig & 0x80) &&
852+
if ((client->irq || !(data->config_orig & 0x80)) &&
852853
!(data->alarms & data->alert_alarms)) {
853854
if (data->config & 0x80) {
854855
dev_dbg(&client->dev, "Re-enabling ALERT#\n");
@@ -1807,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status)
18071808

18081809
if (st & LM90_STATUS_LLOW)
18091810
hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1810-
hwmon_temp_min, 0);
1811+
hwmon_temp_min_alarm, 0);
18111812
if (st & LM90_STATUS_RLOW)
18121813
hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1813-
hwmon_temp_min, 1);
1814+
hwmon_temp_min_alarm, 1);
18141815
if (st2 & MAX6696_STATUS2_R2LOW)
18151816
hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1816-
hwmon_temp_min, 2);
1817+
hwmon_temp_min_alarm, 2);
18171818
if (st & LM90_STATUS_LHIGH)
18181819
hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1819-
hwmon_temp_max, 0);
1820+
hwmon_temp_max_alarm, 0);
18201821
if (st & LM90_STATUS_RHIGH)
18211822
hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1822-
hwmon_temp_max, 1);
1823+
hwmon_temp_max_alarm, 1);
18231824
if (st2 & MAX6696_STATUS2_R2HIGH)
18241825
hwmon_notify_event(data->hwmon_dev, hwmon_temp,
1825-
hwmon_temp_max, 2);
1826+
hwmon_temp_max_alarm, 2);
18261827

18271828
return true;
18281829
}

drivers/hwmon/nct6775.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ static inline u8 in_to_reg(u32 val, u8 nr)
11751175

11761176
struct nct6775_data {
11771177
int addr; /* IO base of hw monitor block */
1178-
int sioreg; /* SIO register address */
1178+
struct nct6775_sio_data *sio_data;
11791179
enum kinds kind;
11801180
const char *name;
11811181

@@ -3559,7 +3559,7 @@ clear_caseopen(struct device *dev, struct device_attribute *attr,
35593559
const char *buf, size_t count)
35603560
{
35613561
struct nct6775_data *data = dev_get_drvdata(dev);
3562-
struct nct6775_sio_data *sio_data = dev_get_platdata(dev);
3562+
struct nct6775_sio_data *sio_data = data->sio_data;
35633563
int nr = to_sensor_dev_attr(attr)->index - INTRUSION_ALARM_BASE;
35643564
unsigned long val;
35653565
u8 reg;
@@ -3967,7 +3967,7 @@ static int nct6775_probe(struct platform_device *pdev)
39673967
return -ENOMEM;
39683968

39693969
data->kind = sio_data->kind;
3970-
data->sioreg = sio_data->sioreg;
3970+
data->sio_data = sio_data;
39713971

39723972
if (sio_data->access == access_direct) {
39733973
data->addr = res->start;

drivers/hwmon/pmbus/ir38064.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static const struct i2c_device_id ir38064_id[] = {
6262

6363
MODULE_DEVICE_TABLE(i2c, ir38064_id);
6464

65-
static const struct of_device_id ir38064_of_match[] = {
65+
static const struct of_device_id __maybe_unused ir38064_of_match[] = {
6666
{ .compatible = "infineon,ir38060" },
6767
{ .compatible = "infineon,ir38064" },
6868
{ .compatible = "infineon,ir38164" },

0 commit comments

Comments
 (0)