aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-04-04 12:05:57 -0400
committerGuenter Roeck <linux@roeck-us.net>2016-04-19 09:32:37 -0400
commitc962024e306ed598600853854a067b521bf5b530 (patch)
treec5abae5cccc23f05760a662436fb8258b423fdd3
parent2310048db70a58ae89b37fded0322b6a5ae6443f (diff)
hwmon: (it87) Formatting cleanup
Fix various checkpatch complaints to clean up the code and make it easier to read. CHECK: Do not include the paragraph about writing to the FSF CHECK: Alignment should match open parenthesis CHECK: Logical continuations should be on the previous line CHECK: No space is necessary after a cast CHECK: Please don't use multiple blank lines CHECK: Please use a blank line after function/struct/union/enum declarations CHECK: spaces preferred around that '+' (ctx:VxV) WARNING: Missing a blank line after declarations No functional change. Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/it87.c155
1 files changed, 80 insertions, 75 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 118d4c756e40..515c5cd1890b 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -44,10 +44,6 @@
44 * but WITHOUT ANY WARRANTY; without even the implied warranty of 44 * but WITHOUT ANY WARRANTY; without even the implied warranty of
45 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 45 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46 * GNU General Public License for more details. 46 * GNU General Public License for more details.
47 *
48 * You should have received a copy of the GNU General Public License
49 * along with this program; if not, write to the Free Software
50 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
51 */ 47 */
52 48
53#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 49#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -108,6 +104,7 @@ static inline void superio_outb(int ioreg, int reg, int val)
108static int superio_inw(int ioreg, int reg) 104static int superio_inw(int ioreg, int reg)
109{ 105{
110 int val; 106 int val;
107
111 outb(reg++, ioreg); 108 outb(reg++, ioreg);
112 val = inb(ioreg + 1) << 8; 109 val = inb(ioreg + 1) << 8;
113 outb(reg, ioreg); 110 outb(reg, ioreg);
@@ -598,10 +595,10 @@ static int pwm_from_reg(const struct it87_data *data, u8 reg)
598 return (reg & 0x7f) << 1; 595 return (reg & 0x7f) << 1;
599} 596}
600 597
601
602static int DIV_TO_REG(int val) 598static int DIV_TO_REG(int val)
603{ 599{
604 int answer = 0; 600 int answer = 0;
601
605 while (answer < 7 && (val >>= 1)) 602 while (answer < 7 && (val >>= 1))
606 answer++; 603 answer++;
607 return answer; 604 return answer;
@@ -686,8 +683,8 @@ static struct it87_data *it87_update_device(struct device *dev)
686 683
687 mutex_lock(&data->update_lock); 684 mutex_lock(&data->update_lock);
688 685
689 if (time_after(jiffies, data->last_updated + HZ + HZ / 2) 686 if (time_after(jiffies, data->last_updated + HZ + HZ / 2) ||
690 || !data->valid) { 687 !data->valid) {
691 if (update_vbat) { 688 if (update_vbat) {
692 /* 689 /*
693 * Cleared after each update, so reenable. Value 690 * Cleared after each update, so reenable. Value
@@ -798,10 +795,10 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,
798 char *buf) 795 char *buf)
799{ 796{
800 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); 797 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
801 int nr = sattr->nr; 798 struct it87_data *data = it87_update_device(dev);
802 int index = sattr->index; 799 int index = sattr->index;
800 int nr = sattr->nr;
803 801
804 struct it87_data *data = it87_update_device(dev);
805 return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in[nr][index])); 802 return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in[nr][index]));
806} 803}
807 804
@@ -809,10 +806,9 @@ static ssize_t set_in(struct device *dev, struct device_attribute *attr,
809 const char *buf, size_t count) 806 const char *buf, size_t count)
810{ 807{
811 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); 808 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
812 int nr = sattr->nr;
813 int index = sattr->index;
814
815 struct it87_data *data = dev_get_drvdata(dev); 809 struct it87_data *data = dev_get_drvdata(dev);
810 int index = sattr->index;
811 int nr = sattr->nr;
816 unsigned long val; 812 unsigned long val;
817 813
818 if (kstrtoul(buf, 10, &val) < 0) 814 if (kstrtoul(buf, 10, &val) < 0)
@@ -968,8 +964,8 @@ static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr,
968 u8 reg = data->sensor; /* In case value is updated while used */ 964 u8 reg = data->sensor; /* In case value is updated while used */
969 u8 extra = data->extra; 965 u8 extra = data->extra;
970 966
971 if ((has_temp_peci(data, nr) && (reg >> 6 == nr + 1)) 967 if ((has_temp_peci(data, nr) && (reg >> 6 == nr + 1)) ||
972 || (has_temp_old_peci(data, nr) && (extra & 0x80))) 968 (has_temp_old_peci(data, nr) && (extra & 0x80)))
973 return sprintf(buf, "6\n"); /* Intel PECI */ 969 return sprintf(buf, "6\n"); /* Intel PECI */
974 if (reg & (1 << nr)) 970 if (reg & (1 << nr))
975 return sprintf(buf, "3\n"); /* thermal diode */ 971 return sprintf(buf, "3\n"); /* thermal diode */
@@ -1065,35 +1061,38 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *attr,
1065} 1061}
1066 1062
1067static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, 1063static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr,
1068 char *buf) 1064 char *buf)
1069{ 1065{
1070 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1066 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1067 struct it87_data *data = it87_update_device(dev);
1071 int nr = sensor_attr->index; 1068 int nr = sensor_attr->index;
1072 1069
1073 struct it87_data *data = it87_update_device(dev);
1074 return sprintf(buf, "%lu\n", DIV_FROM_REG(data->fan_div[nr])); 1070 return sprintf(buf, "%lu\n", DIV_FROM_REG(data->fan_div[nr]));
1075} 1071}
1072
1076static ssize_t show_pwm_enable(struct device *dev, 1073static ssize_t show_pwm_enable(struct device *dev,
1077 struct device_attribute *attr, char *buf) 1074 struct device_attribute *attr, char *buf)
1078{ 1075{
1079 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1076 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1077 struct it87_data *data = it87_update_device(dev);
1080 int nr = sensor_attr->index; 1078 int nr = sensor_attr->index;
1081 1079
1082 struct it87_data *data = it87_update_device(dev);
1083 return sprintf(buf, "%d\n", pwm_mode(data, nr)); 1080 return sprintf(buf, "%d\n", pwm_mode(data, nr));
1084} 1081}
1082
1085static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, 1083static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
1086 char *buf) 1084 char *buf)
1087{ 1085{
1088 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1086 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1087 struct it87_data *data = it87_update_device(dev);
1089 int nr = sensor_attr->index; 1088 int nr = sensor_attr->index;
1090 1089
1091 struct it87_data *data = it87_update_device(dev);
1092 return sprintf(buf, "%d\n", 1090 return sprintf(buf, "%d\n",
1093 pwm_from_reg(data, data->pwm_duty[nr])); 1091 pwm_from_reg(data, data->pwm_duty[nr]));
1094} 1092}
1093
1095static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr, 1094static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr,
1096 char *buf) 1095 char *buf)
1097{ 1096{
1098 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1097 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1099 struct it87_data *data = it87_update_device(dev); 1098 struct it87_data *data = it87_update_device(dev);
@@ -1157,12 +1156,11 @@ static ssize_t set_fan(struct device *dev, struct device_attribute *attr,
1157} 1156}
1158 1157
1159static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, 1158static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
1160 const char *buf, size_t count) 1159 const char *buf, size_t count)
1161{ 1160{
1162 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1161 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1163 int nr = sensor_attr->index;
1164
1165 struct it87_data *data = dev_get_drvdata(dev); 1162 struct it87_data *data = dev_get_drvdata(dev);
1163 int nr = sensor_attr->index;
1166 unsigned long val; 1164 unsigned long val;
1167 int min; 1165 int min;
1168 u8 old; 1166 u8 old;
@@ -1227,13 +1225,12 @@ static int check_trip_points(struct device *dev, int nr)
1227 return err; 1225 return err;
1228} 1226}
1229 1227
1230static ssize_t set_pwm_enable(struct device *dev, 1228static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
1231 struct device_attribute *attr, const char *buf, size_t count) 1229 const char *buf, size_t count)
1232{ 1230{
1233 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1231 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1234 int nr = sensor_attr->index;
1235
1236 struct it87_data *data = dev_get_drvdata(dev); 1232 struct it87_data *data = dev_get_drvdata(dev);
1233 int nr = sensor_attr->index;
1237 long val; 1234 long val;
1238 1235
1239 if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 2) 1236 if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 2)
@@ -1280,13 +1277,13 @@ static ssize_t set_pwm_enable(struct device *dev,
1280 mutex_unlock(&data->update_lock); 1277 mutex_unlock(&data->update_lock);
1281 return count; 1278 return count;
1282} 1279}
1280
1283static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, 1281static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
1284 const char *buf, size_t count) 1282 const char *buf, size_t count)
1285{ 1283{
1286 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1284 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1287 int nr = sensor_attr->index;
1288
1289 struct it87_data *data = dev_get_drvdata(dev); 1285 struct it87_data *data = dev_get_drvdata(dev);
1286 int nr = sensor_attr->index;
1290 long val; 1287 long val;
1291 1288
1292 if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 255) 1289 if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 255)
@@ -1320,8 +1317,9 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
1320 mutex_unlock(&data->update_lock); 1317 mutex_unlock(&data->update_lock);
1321 return count; 1318 return count;
1322} 1319}
1323static ssize_t set_pwm_freq(struct device *dev, 1320
1324 struct device_attribute *attr, const char *buf, size_t count) 1321static ssize_t set_pwm_freq(struct device *dev, struct device_attribute *attr,
1322 const char *buf, size_t count)
1325{ 1323{
1326 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1324 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1327 struct it87_data *data = dev_get_drvdata(dev); 1325 struct it87_data *data = dev_get_drvdata(dev);
@@ -1337,7 +1335,7 @@ static ssize_t set_pwm_freq(struct device *dev,
1337 1335
1338 /* Search for the nearest available frequency */ 1336 /* Search for the nearest available frequency */
1339 for (i = 0; i < 7; i++) { 1337 for (i = 0; i < 7; i++) {
1340 if (val > (pwm_freq[i] + pwm_freq[i+1]) / 2) 1338 if (val > (pwm_freq[i] + pwm_freq[i + 1]) / 2)
1341 break; 1339 break;
1342 } 1340 }
1343 1341
@@ -1355,13 +1353,13 @@ static ssize_t set_pwm_freq(struct device *dev,
1355 1353
1356 return count; 1354 return count;
1357} 1355}
1356
1358static ssize_t show_pwm_temp_map(struct device *dev, 1357static ssize_t show_pwm_temp_map(struct device *dev,
1359 struct device_attribute *attr, char *buf) 1358 struct device_attribute *attr, char *buf)
1360{ 1359{
1361 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1360 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1362 int nr = sensor_attr->index;
1363
1364 struct it87_data *data = it87_update_device(dev); 1361 struct it87_data *data = it87_update_device(dev);
1362 int nr = sensor_attr->index;
1365 int map; 1363 int map;
1366 1364
1367 if (data->pwm_temp_map[nr] < 3) 1365 if (data->pwm_temp_map[nr] < 3)
@@ -1370,13 +1368,14 @@ static ssize_t show_pwm_temp_map(struct device *dev,
1370 map = 0; /* Should never happen */ 1368 map = 0; /* Should never happen */
1371 return sprintf(buf, "%d\n", map); 1369 return sprintf(buf, "%d\n", map);
1372} 1370}
1371
1373static ssize_t set_pwm_temp_map(struct device *dev, 1372static ssize_t set_pwm_temp_map(struct device *dev,
1374 struct device_attribute *attr, const char *buf, size_t count) 1373 struct device_attribute *attr, const char *buf,
1374 size_t count)
1375{ 1375{
1376 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 1376 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
1377 int nr = sensor_attr->index;
1378
1379 struct it87_data *data = dev_get_drvdata(dev); 1377 struct it87_data *data = dev_get_drvdata(dev);
1378 int nr = sensor_attr->index;
1380 long val; 1379 long val;
1381 u8 reg; 1380 u8 reg;
1382 1381
@@ -1411,8 +1410,8 @@ static ssize_t set_pwm_temp_map(struct device *dev,
1411 return count; 1410 return count;
1412} 1411}
1413 1412
1414static ssize_t show_auto_pwm(struct device *dev, 1413static ssize_t show_auto_pwm(struct device *dev, struct device_attribute *attr,
1415 struct device_attribute *attr, char *buf) 1414 char *buf)
1416{ 1415{
1417 struct it87_data *data = it87_update_device(dev); 1416 struct it87_data *data = it87_update_device(dev);
1418 struct sensor_device_attribute_2 *sensor_attr = 1417 struct sensor_device_attribute_2 *sensor_attr =
@@ -1424,8 +1423,8 @@ static ssize_t show_auto_pwm(struct device *dev,
1424 pwm_from_reg(data, data->auto_pwm[nr][point])); 1423 pwm_from_reg(data, data->auto_pwm[nr][point]));
1425} 1424}
1426 1425
1427static ssize_t set_auto_pwm(struct device *dev, 1426static ssize_t set_auto_pwm(struct device *dev, struct device_attribute *attr,
1428 struct device_attribute *attr, const char *buf, size_t count) 1427 const char *buf, size_t count)
1429{ 1428{
1430 struct it87_data *data = dev_get_drvdata(dev); 1429 struct it87_data *data = dev_get_drvdata(dev);
1431 struct sensor_device_attribute_2 *sensor_attr = 1430 struct sensor_device_attribute_2 *sensor_attr =
@@ -1445,8 +1444,8 @@ static ssize_t set_auto_pwm(struct device *dev,
1445 return count; 1444 return count;
1446} 1445}
1447 1446
1448static ssize_t show_auto_temp(struct device *dev, 1447static ssize_t show_auto_temp(struct device *dev, struct device_attribute *attr,
1449 struct device_attribute *attr, char *buf) 1448 char *buf)
1450{ 1449{
1451 struct it87_data *data = it87_update_device(dev); 1450 struct it87_data *data = it87_update_device(dev);
1452 struct sensor_device_attribute_2 *sensor_attr = 1451 struct sensor_device_attribute_2 *sensor_attr =
@@ -1457,8 +1456,8 @@ static ssize_t show_auto_temp(struct device *dev,
1457 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->auto_temp[nr][point])); 1456 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->auto_temp[nr][point]));
1458} 1457}
1459 1458
1460static ssize_t set_auto_temp(struct device *dev, 1459static ssize_t set_auto_temp(struct device *dev, struct device_attribute *attr,
1461 struct device_attribute *attr, const char *buf, size_t count) 1460 const char *buf, size_t count)
1462{ 1461{
1463 struct it87_data *data = dev_get_drvdata(dev); 1462 struct it87_data *data = dev_get_drvdata(dev);
1464 struct sensor_device_attribute_2 *sensor_attr = 1463 struct sensor_device_attribute_2 *sensor_attr =
@@ -1607,27 +1606,30 @@ static SENSOR_DEVICE_ATTR(pwm6_auto_channels_temp, S_IRUGO,
1607 1606
1608/* Alarms */ 1607/* Alarms */
1609static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, 1608static ssize_t show_alarms(struct device *dev, struct device_attribute *attr,
1610 char *buf) 1609 char *buf)
1611{ 1610{
1612 struct it87_data *data = it87_update_device(dev); 1611 struct it87_data *data = it87_update_device(dev);
1612
1613 return sprintf(buf, "%u\n", data->alarms); 1613 return sprintf(buf, "%u\n", data->alarms);
1614} 1614}
1615static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 1615static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
1616 1616
1617static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, 1617static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
1618 char *buf) 1618 char *buf)
1619{ 1619{
1620 int bitnr = to_sensor_dev_attr(attr)->index;
1621 struct it87_data *data = it87_update_device(dev); 1620 struct it87_data *data = it87_update_device(dev);
1621 int bitnr = to_sensor_dev_attr(attr)->index;
1622
1622 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); 1623 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
1623} 1624}
1624 1625
1625static ssize_t clear_intrusion(struct device *dev, struct device_attribute 1626static ssize_t clear_intrusion(struct device *dev,
1626 *attr, const char *buf, size_t count) 1627 struct device_attribute *attr, const char *buf,
1628 size_t count)
1627{ 1629{
1628 struct it87_data *data = dev_get_drvdata(dev); 1630 struct it87_data *data = dev_get_drvdata(dev);
1629 long val;
1630 int config; 1631 int config;
1632 long val;
1631 1633
1632 if (kstrtol(buf, 10, &val) < 0 || val != 0) 1634 if (kstrtol(buf, 10, &val) < 0 || val != 0)
1633 return -EINVAL; 1635 return -EINVAL;
@@ -1668,21 +1670,22 @@ static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
1668 show_alarm, clear_intrusion, 4); 1670 show_alarm, clear_intrusion, 4);
1669 1671
1670static ssize_t show_beep(struct device *dev, struct device_attribute *attr, 1672static ssize_t show_beep(struct device *dev, struct device_attribute *attr,
1671 char *buf) 1673 char *buf)
1672{ 1674{
1673 int bitnr = to_sensor_dev_attr(attr)->index;
1674 struct it87_data *data = it87_update_device(dev); 1675 struct it87_data *data = it87_update_device(dev);
1676 int bitnr = to_sensor_dev_attr(attr)->index;
1677
1675 return sprintf(buf, "%u\n", (data->beeps >> bitnr) & 1); 1678 return sprintf(buf, "%u\n", (data->beeps >> bitnr) & 1);
1676} 1679}
1680
1677static ssize_t set_beep(struct device *dev, struct device_attribute *attr, 1681static ssize_t set_beep(struct device *dev, struct device_attribute *attr,
1678 const char *buf, size_t count) 1682 const char *buf, size_t count)
1679{ 1683{
1680 int bitnr = to_sensor_dev_attr(attr)->index; 1684 int bitnr = to_sensor_dev_attr(attr)->index;
1681 struct it87_data *data = dev_get_drvdata(dev); 1685 struct it87_data *data = dev_get_drvdata(dev);
1682 long val; 1686 long val;
1683 1687
1684 if (kstrtol(buf, 10, &val) < 0 1688 if (kstrtol(buf, 10, &val) < 0 || (val != 0 && val != 1))
1685 || (val != 0 && val != 1))
1686 return -EINVAL; 1689 return -EINVAL;
1687 1690
1688 mutex_lock(&data->update_lock); 1691 mutex_lock(&data->update_lock);
@@ -1718,13 +1721,15 @@ static SENSOR_DEVICE_ATTR(temp2_beep, S_IRUGO, show_beep, NULL, 2);
1718static SENSOR_DEVICE_ATTR(temp3_beep, S_IRUGO, show_beep, NULL, 2); 1721static SENSOR_DEVICE_ATTR(temp3_beep, S_IRUGO, show_beep, NULL, 2);
1719 1722
1720static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, 1723static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr,
1721 char *buf) 1724 char *buf)
1722{ 1725{
1723 struct it87_data *data = dev_get_drvdata(dev); 1726 struct it87_data *data = dev_get_drvdata(dev);
1727
1724 return sprintf(buf, "%u\n", data->vrm); 1728 return sprintf(buf, "%u\n", data->vrm);
1725} 1729}
1730
1726static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, 1731static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
1727 const char *buf, size_t count) 1732 const char *buf, size_t count)
1728{ 1733{
1729 struct it87_data *data = dev_get_drvdata(dev); 1734 struct it87_data *data = dev_get_drvdata(dev);
1730 unsigned long val; 1735 unsigned long val;
@@ -1739,15 +1744,16 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
1739static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); 1744static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
1740 1745
1741static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, 1746static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr,
1742 char *buf) 1747 char *buf)
1743{ 1748{
1744 struct it87_data *data = it87_update_device(dev); 1749 struct it87_data *data = it87_update_device(dev);
1745 return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); 1750
1751 return sprintf(buf, "%ld\n", (long)vid_from_reg(data->vid, data->vrm));
1746} 1752}
1747static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); 1753static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
1748 1754
1749static ssize_t show_label(struct device *dev, struct device_attribute *attr, 1755static ssize_t show_label(struct device *dev, struct device_attribute *attr,
1750 char *buf) 1756 char *buf)
1751{ 1757{
1752 static const char * const labels[] = { 1758 static const char * const labels[] = {
1753 "+5V", 1759 "+5V",
@@ -2272,8 +2278,8 @@ static int __init it87_find(int sioaddr, unsigned short *address,
2272 /* Check if fan3 is there or not */ 2278 /* Check if fan3 is there or not */
2273 if ((reg27 & BIT(0)) || !(reg2c & BIT(2))) 2279 if ((reg27 & BIT(0)) || !(reg2c & BIT(2)))
2274 sio_data->skip_fan |= BIT(2); 2280 sio_data->skip_fan |= BIT(2);
2275 if ((reg25 & BIT(4)) 2281 if ((reg25 & BIT(4)) ||
2276 || (!(reg2a & BIT(1)) && (regef & BIT(0)))) 2282 (!(reg2a & BIT(1)) && (regef & BIT(0))))
2277 sio_data->skip_pwm |= BIT(2); 2283 sio_data->skip_pwm |= BIT(2);
2278 2284
2279 /* Check if fan2 is there or not */ 2285 /* Check if fan2 is there or not */
@@ -2421,8 +2427,8 @@ static int __init it87_find(int sioaddr, unsigned short *address,
2421 if (reg & BIT(2)) 2427 if (reg & BIT(2))
2422 sio_data->skip_fan |= BIT(1); 2428 sio_data->skip_fan |= BIT(1);
2423 2429
2424 if ((sio_data->type == it8718 || sio_data->type == it8720) 2430 if ((sio_data->type == it8718 || sio_data->type == it8720) &&
2425 && !(sio_data->skip_vid)) 2431 !(sio_data->skip_vid))
2426 sio_data->vid_value = superio_inb(sioaddr, 2432 sio_data->vid_value = superio_inb(sioaddr,
2427 IT87_SIO_VID_REG); 2433 IT87_SIO_VID_REG);
2428 2434
@@ -2478,8 +2484,8 @@ static int __init it87_find(int sioaddr, unsigned short *address,
2478 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); 2484 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
2479 board_name = dmi_get_system_info(DMI_BOARD_NAME); 2485 board_name = dmi_get_system_info(DMI_BOARD_NAME);
2480 if (board_vendor && board_name) { 2486 if (board_vendor && board_name) {
2481 if (strcmp(board_vendor, "nVIDIA") == 0 2487 if (strcmp(board_vendor, "nVIDIA") == 0 &&
2482 && strcmp(board_name, "FN68PT") == 0) { 2488 strcmp(board_name, "FN68PT") == 0) {
2483 /* 2489 /*
2484 * On the Shuttle SN68PT, FAN_CTL2 is apparently not 2490 * On the Shuttle SN68PT, FAN_CTL2 is apparently not
2485 * connected to a fan, but to something else. One user 2491 * connected to a fan, but to something else. One user
@@ -2718,8 +2724,8 @@ static int it87_probe(struct platform_device *pdev)
2718 } 2724 }
2719 2725
2720 /* Now, we do the remaining detection. */ 2726 /* Now, we do the remaining detection. */
2721 if ((it87_read_value(data, IT87_REG_CONFIG) & 0x80) 2727 if ((it87_read_value(data, IT87_REG_CONFIG) & 0x80) ||
2722 || it87_read_value(data, IT87_REG_CHIPID) != 0x90) 2728 it87_read_value(data, IT87_REG_CHIPID) != 0x90)
2723 return -ENODEV; 2729 return -ENODEV;
2724 2730
2725 platform_set_drvdata(pdev, data); 2731 platform_set_drvdata(pdev, data);
@@ -2749,8 +2755,8 @@ static int it87_probe(struct platform_device *pdev)
2749 2755
2750 data->has_temp = 0x07; 2756 data->has_temp = 0x07;
2751 if (sio_data->skip_temp & BIT(2)) { 2757 if (sio_data->skip_temp & BIT(2)) {
2752 if (sio_data->type == it8782 2758 if (sio_data->type == it8782 &&
2753 && !(it87_read_value(data, IT87_REG_TEMP_EXTRA) & 0x80)) 2759 !(it87_read_value(data, IT87_REG_TEMP_EXTRA) & 0x80))
2754 data->has_temp &= ~BIT(2); 2760 data->has_temp &= ~BIT(2);
2755 } 2761 }
2756 2762
@@ -2911,7 +2917,6 @@ static void __exit sm_it87_exit(void)
2911 platform_driver_unregister(&it87_driver); 2917 platform_driver_unregister(&it87_driver);
2912} 2918}
2913 2919
2914
2915MODULE_AUTHOR("Chris Gauthron, Jean Delvare <jdelvare@suse.de>"); 2920MODULE_AUTHOR("Chris Gauthron, Jean Delvare <jdelvare@suse.de>");
2916MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver"); 2921MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver");
2917module_param(update_vbat, bool, 0); 2922module_param(update_vbat, bool, 0);