aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/it87.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 5e39e2d40380..a65ba31cad29 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -539,15 +539,14 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr,
539 539
540 struct it87_data *data = dev_get_drvdata(dev); 540 struct it87_data *data = dev_get_drvdata(dev);
541 long val; 541 long val;
542 u8 reg;
542 543
543 if (strict_strtol(buf, 10, &val) < 0) 544 if (strict_strtol(buf, 10, &val) < 0)
544 return -EINVAL; 545 return -EINVAL;
545 546
546 mutex_lock(&data->update_lock); 547 reg = it87_read_value(data, IT87_REG_TEMP_ENABLE);
547 548 reg &= ~(1 << nr);
548 data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); 549 reg &= ~(8 << nr);
549 data->sensor &= ~(1 << nr);
550 data->sensor &= ~(8 << nr);
551 if (val == 2) { /* backwards compatibility */ 550 if (val == 2) { /* backwards compatibility */
552 dev_warn(dev, "Sensor type 2 is deprecated, please use 4 " 551 dev_warn(dev, "Sensor type 2 is deprecated, please use 4 "
553 "instead\n"); 552 "instead\n");
@@ -555,13 +554,14 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr,
555 } 554 }
556 /* 3 = thermal diode; 4 = thermistor; 0 = disabled */ 555 /* 3 = thermal diode; 4 = thermistor; 0 = disabled */
557 if (val == 3) 556 if (val == 3)
558 data->sensor |= 1 << nr; 557 reg |= 1 << nr;
559 else if (val == 4) 558 else if (val == 4)
560 data->sensor |= 8 << nr; 559 reg |= 8 << nr;
561 else if (val != 0) { 560 else if (val != 0)
562 mutex_unlock(&data->update_lock);
563 return -EINVAL; 561 return -EINVAL;
564 } 562
563 mutex_lock(&data->update_lock);
564 data->sensor = reg;
565 it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor); 565 it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor);
566 mutex_unlock(&data->update_lock); 566 mutex_unlock(&data->update_lock);
567 return count; 567 return count;