| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * vt8231.c - Part of lm_sensors, Linux kernel modules |
|---|
| 3 | 4 | * for hardware monitoring |
|---|
| .. | .. |
|---|
| 5 | 6 | * Copyright (c) 2005 Roger Lucas <vt8231@hiddenengine.co.uk> |
|---|
| 6 | 7 | * Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> |
|---|
| 7 | 8 | * Aaron M. Marsh <amarsh@sdf.lonestar.org> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 12 | | - * (at your option) any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * You should have received a copy of the GNU General Public License |
|---|
| 20 | | - * along with this program; if not, write to the Free Software |
|---|
| 21 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 22 | 9 | */ |
|---|
| 23 | 10 | |
|---|
| 24 | 11 | /* |
|---|
| .. | .. |
|---|
| 192 | 179 | } |
|---|
| 193 | 180 | |
|---|
| 194 | 181 | /* following are the sysfs callback functions */ |
|---|
| 195 | | -static ssize_t show_in(struct device *dev, struct device_attribute *attr, |
|---|
| 196 | | - char *buf) |
|---|
| 182 | +static ssize_t in_show(struct device *dev, struct device_attribute *attr, |
|---|
| 183 | + char *buf) |
|---|
| 197 | 184 | { |
|---|
| 198 | 185 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 199 | 186 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 202 | 189 | return sprintf(buf, "%d\n", ((data->in[nr] - 3) * 10000) / 958); |
|---|
| 203 | 190 | } |
|---|
| 204 | 191 | |
|---|
| 205 | | -static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, |
|---|
| 206 | | - char *buf) |
|---|
| 192 | +static ssize_t in_min_show(struct device *dev, struct device_attribute *attr, |
|---|
| 193 | + char *buf) |
|---|
| 207 | 194 | { |
|---|
| 208 | 195 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 209 | 196 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 212 | 199 | return sprintf(buf, "%d\n", ((data->in_min[nr] - 3) * 10000) / 958); |
|---|
| 213 | 200 | } |
|---|
| 214 | 201 | |
|---|
| 215 | | -static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, |
|---|
| 216 | | - char *buf) |
|---|
| 202 | +static ssize_t in_max_show(struct device *dev, struct device_attribute *attr, |
|---|
| 203 | + char *buf) |
|---|
| 217 | 204 | { |
|---|
| 218 | 205 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 219 | 206 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 222 | 209 | return sprintf(buf, "%d\n", (((data->in_max[nr] - 3) * 10000) / 958)); |
|---|
| 223 | 210 | } |
|---|
| 224 | 211 | |
|---|
| 225 | | -static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, |
|---|
| 226 | | - const char *buf, size_t count) |
|---|
| 212 | +static ssize_t in_min_store(struct device *dev, struct device_attribute *attr, |
|---|
| 213 | + const char *buf, size_t count) |
|---|
| 227 | 214 | { |
|---|
| 228 | 215 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 229 | 216 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 242 | 229 | return count; |
|---|
| 243 | 230 | } |
|---|
| 244 | 231 | |
|---|
| 245 | | -static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, |
|---|
| 246 | | - const char *buf, size_t count) |
|---|
| 232 | +static ssize_t in_max_store(struct device *dev, struct device_attribute *attr, |
|---|
| 233 | + const char *buf, size_t count) |
|---|
| 247 | 234 | { |
|---|
| 248 | 235 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 249 | 236 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 330 | 317 | return count; |
|---|
| 331 | 318 | } |
|---|
| 332 | 319 | |
|---|
| 333 | | -#define define_voltage_sysfs(offset) \ |
|---|
| 334 | | -static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ |
|---|
| 335 | | - show_in, NULL, offset); \ |
|---|
| 336 | | -static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ |
|---|
| 337 | | - show_in_min, set_in_min, offset); \ |
|---|
| 338 | | -static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ |
|---|
| 339 | | - show_in_max, set_in_max, offset) |
|---|
| 340 | | - |
|---|
| 341 | | -define_voltage_sysfs(0); |
|---|
| 342 | | -define_voltage_sysfs(1); |
|---|
| 343 | | -define_voltage_sysfs(2); |
|---|
| 344 | | -define_voltage_sysfs(3); |
|---|
| 345 | | -define_voltage_sysfs(4); |
|---|
| 320 | +static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0); |
|---|
| 321 | +static SENSOR_DEVICE_ATTR_RW(in0_min, in_min, 0); |
|---|
| 322 | +static SENSOR_DEVICE_ATTR_RW(in0_max, in_max, 0); |
|---|
| 323 | +static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1); |
|---|
| 324 | +static SENSOR_DEVICE_ATTR_RW(in1_min, in_min, 1); |
|---|
| 325 | +static SENSOR_DEVICE_ATTR_RW(in1_max, in_max, 1); |
|---|
| 326 | +static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2); |
|---|
| 327 | +static SENSOR_DEVICE_ATTR_RW(in2_min, in_min, 2); |
|---|
| 328 | +static SENSOR_DEVICE_ATTR_RW(in2_max, in_max, 2); |
|---|
| 329 | +static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3); |
|---|
| 330 | +static SENSOR_DEVICE_ATTR_RW(in3_min, in_min, 3); |
|---|
| 331 | +static SENSOR_DEVICE_ATTR_RW(in3_max, in_max, 3); |
|---|
| 332 | +static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4); |
|---|
| 333 | +static SENSOR_DEVICE_ATTR_RW(in4_min, in_min, 4); |
|---|
| 334 | +static SENSOR_DEVICE_ATTR_RW(in4_max, in_max, 4); |
|---|
| 346 | 335 | |
|---|
| 347 | 336 | static DEVICE_ATTR_RO(in5_input); |
|---|
| 348 | 337 | static DEVICE_ATTR_RW(in5_min); |
|---|
| .. | .. |
|---|
| 407 | 396 | return count; |
|---|
| 408 | 397 | } |
|---|
| 409 | 398 | |
|---|
| 410 | | -static ssize_t show_temp(struct device *dev, struct device_attribute *attr, |
|---|
| 411 | | - char *buf) |
|---|
| 399 | +static ssize_t temp_show(struct device *dev, struct device_attribute *attr, |
|---|
| 400 | + char *buf) |
|---|
| 412 | 401 | { |
|---|
| 413 | 402 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 414 | 403 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 416 | 405 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr])); |
|---|
| 417 | 406 | } |
|---|
| 418 | 407 | |
|---|
| 419 | | -static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, |
|---|
| 420 | | - char *buf) |
|---|
| 408 | +static ssize_t temp_max_show(struct device *dev, |
|---|
| 409 | + struct device_attribute *attr, char *buf) |
|---|
| 421 | 410 | { |
|---|
| 422 | 411 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 423 | 412 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 425 | 414 | return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_max[nr])); |
|---|
| 426 | 415 | } |
|---|
| 427 | 416 | |
|---|
| 428 | | -static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, |
|---|
| 429 | | - char *buf) |
|---|
| 417 | +static ssize_t temp_min_show(struct device *dev, |
|---|
| 418 | + struct device_attribute *attr, char *buf) |
|---|
| 430 | 419 | { |
|---|
| 431 | 420 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 432 | 421 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 434 | 423 | return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_min[nr])); |
|---|
| 435 | 424 | } |
|---|
| 436 | 425 | |
|---|
| 437 | | -static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, |
|---|
| 438 | | - const char *buf, size_t count) |
|---|
| 426 | +static ssize_t temp_max_store(struct device *dev, |
|---|
| 427 | + struct device_attribute *attr, const char *buf, |
|---|
| 428 | + size_t count) |
|---|
| 439 | 429 | { |
|---|
| 440 | 430 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 441 | 431 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 453 | 443 | mutex_unlock(&data->update_lock); |
|---|
| 454 | 444 | return count; |
|---|
| 455 | 445 | } |
|---|
| 456 | | -static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, |
|---|
| 457 | | - const char *buf, size_t count) |
|---|
| 446 | +static ssize_t temp_min_store(struct device *dev, |
|---|
| 447 | + struct device_attribute *attr, const char *buf, |
|---|
| 448 | + size_t count) |
|---|
| 458 | 449 | { |
|---|
| 459 | 450 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 460 | 451 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 477 | 468 | * Note that these map the Linux temperature sensor numbering (1-6) to the VIA |
|---|
| 478 | 469 | * temperature sensor numbering (0-5) |
|---|
| 479 | 470 | */ |
|---|
| 480 | | -#define define_temperature_sysfs(offset) \ |
|---|
| 481 | | -static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
|---|
| 482 | | - show_temp, NULL, offset - 1); \ |
|---|
| 483 | | -static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ |
|---|
| 484 | | - show_temp_max, set_temp_max, offset - 1); \ |
|---|
| 485 | | -static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \ |
|---|
| 486 | | - show_temp_min, set_temp_min, offset - 1) |
|---|
| 487 | 471 | |
|---|
| 488 | 472 | static DEVICE_ATTR_RO(temp1_input); |
|---|
| 489 | 473 | static DEVICE_ATTR_RW(temp1_max); |
|---|
| 490 | 474 | static DEVICE_ATTR_RW(temp1_max_hyst); |
|---|
| 491 | 475 | |
|---|
| 492 | | -define_temperature_sysfs(2); |
|---|
| 493 | | -define_temperature_sysfs(3); |
|---|
| 494 | | -define_temperature_sysfs(4); |
|---|
| 495 | | -define_temperature_sysfs(5); |
|---|
| 496 | | -define_temperature_sysfs(6); |
|---|
| 476 | +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); |
|---|
| 477 | +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1); |
|---|
| 478 | +static SENSOR_DEVICE_ATTR_RW(temp2_max_hyst, temp_min, 1); |
|---|
| 479 | +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); |
|---|
| 480 | +static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2); |
|---|
| 481 | +static SENSOR_DEVICE_ATTR_RW(temp3_max_hyst, temp_min, 2); |
|---|
| 482 | +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3); |
|---|
| 483 | +static SENSOR_DEVICE_ATTR_RW(temp4_max, temp_max, 3); |
|---|
| 484 | +static SENSOR_DEVICE_ATTR_RW(temp4_max_hyst, temp_min, 3); |
|---|
| 485 | +static SENSOR_DEVICE_ATTR_RO(temp5_input, temp, 4); |
|---|
| 486 | +static SENSOR_DEVICE_ATTR_RW(temp5_max, temp_max, 4); |
|---|
| 487 | +static SENSOR_DEVICE_ATTR_RW(temp5_max_hyst, temp_min, 4); |
|---|
| 488 | +static SENSOR_DEVICE_ATTR_RO(temp6_input, temp, 5); |
|---|
| 489 | +static SENSOR_DEVICE_ATTR_RW(temp6_max, temp_max, 5); |
|---|
| 490 | +static SENSOR_DEVICE_ATTR_RW(temp6_max_hyst, temp_min, 5); |
|---|
| 497 | 491 | |
|---|
| 498 | 492 | /* Fans */ |
|---|
| 499 | | -static ssize_t show_fan(struct device *dev, struct device_attribute *attr, |
|---|
| 500 | | - char *buf) |
|---|
| 493 | +static ssize_t fan_show(struct device *dev, struct device_attribute *attr, |
|---|
| 494 | + char *buf) |
|---|
| 501 | 495 | { |
|---|
| 502 | 496 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 503 | 497 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 506 | 500 | DIV_FROM_REG(data->fan_div[nr]))); |
|---|
| 507 | 501 | } |
|---|
| 508 | 502 | |
|---|
| 509 | | -static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, |
|---|
| 510 | | - char *buf) |
|---|
| 503 | +static ssize_t fan_min_show(struct device *dev, struct device_attribute *attr, |
|---|
| 504 | + char *buf) |
|---|
| 511 | 505 | { |
|---|
| 512 | 506 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 513 | 507 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 516 | 510 | DIV_FROM_REG(data->fan_div[nr]))); |
|---|
| 517 | 511 | } |
|---|
| 518 | 512 | |
|---|
| 519 | | -static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, |
|---|
| 520 | | - char *buf) |
|---|
| 513 | +static ssize_t fan_div_show(struct device *dev, struct device_attribute *attr, |
|---|
| 514 | + char *buf) |
|---|
| 521 | 515 | { |
|---|
| 522 | 516 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 523 | 517 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 525 | 519 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr])); |
|---|
| 526 | 520 | } |
|---|
| 527 | 521 | |
|---|
| 528 | | -static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, |
|---|
| 529 | | - const char *buf, size_t count) |
|---|
| 522 | +static ssize_t fan_min_store(struct device *dev, |
|---|
| 523 | + struct device_attribute *attr, const char *buf, |
|---|
| 524 | + size_t count) |
|---|
| 530 | 525 | { |
|---|
| 531 | 526 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| 532 | 527 | int nr = sensor_attr->index; |
|---|
| .. | .. |
|---|
| 545 | 540 | return count; |
|---|
| 546 | 541 | } |
|---|
| 547 | 542 | |
|---|
| 548 | | -static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
|---|
| 549 | | - const char *buf, size_t count) |
|---|
| 543 | +static ssize_t fan_div_store(struct device *dev, |
|---|
| 544 | + struct device_attribute *attr, const char *buf, |
|---|
| 545 | + size_t count) |
|---|
| 550 | 546 | { |
|---|
| 551 | 547 | struct vt8231_data *data = dev_get_drvdata(dev); |
|---|
| 552 | 548 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
|---|
| .. | .. |
|---|
| 593 | 589 | return count; |
|---|
| 594 | 590 | } |
|---|
| 595 | 591 | |
|---|
| 596 | | - |
|---|
| 597 | | -#define define_fan_sysfs(offset) \ |
|---|
| 598 | | -static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ |
|---|
| 599 | | - show_fan, NULL, offset - 1); \ |
|---|
| 600 | | -static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ |
|---|
| 601 | | - show_fan_div, set_fan_div, offset - 1); \ |
|---|
| 602 | | -static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ |
|---|
| 603 | | - show_fan_min, set_fan_min, offset - 1) |
|---|
| 604 | | - |
|---|
| 605 | | -define_fan_sysfs(1); |
|---|
| 606 | | -define_fan_sysfs(2); |
|---|
| 592 | +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0); |
|---|
| 593 | +static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0); |
|---|
| 594 | +static SENSOR_DEVICE_ATTR_RW(fan1_div, fan_div, 0); |
|---|
| 595 | +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1); |
|---|
| 596 | +static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); |
|---|
| 597 | +static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1); |
|---|
| 607 | 598 | |
|---|
| 608 | 599 | /* Alarms */ |
|---|
| 609 | 600 | static ssize_t alarms_show(struct device *dev, struct device_attribute *attr, |
|---|
| .. | .. |
|---|
| 614 | 605 | } |
|---|
| 615 | 606 | static DEVICE_ATTR_RO(alarms); |
|---|
| 616 | 607 | |
|---|
| 617 | | -static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, |
|---|
| 608 | +static ssize_t alarm_show(struct device *dev, struct device_attribute *attr, |
|---|
| 618 | 609 | char *buf) |
|---|
| 619 | 610 | { |
|---|
| 620 | 611 | int bitnr = to_sensor_dev_attr(attr)->index; |
|---|
| 621 | 612 | struct vt8231_data *data = vt8231_update_device(dev); |
|---|
| 622 | 613 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); |
|---|
| 623 | 614 | } |
|---|
| 624 | | -static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); |
|---|
| 625 | | -static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11); |
|---|
| 626 | | -static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 0); |
|---|
| 627 | | -static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_alarm, NULL, 1); |
|---|
| 628 | | -static SENSOR_DEVICE_ATTR(temp5_alarm, S_IRUGO, show_alarm, NULL, 3); |
|---|
| 629 | | -static SENSOR_DEVICE_ATTR(temp6_alarm, S_IRUGO, show_alarm, NULL, 8); |
|---|
| 630 | | -static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 11); |
|---|
| 631 | | -static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 0); |
|---|
| 632 | | -static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 1); |
|---|
| 633 | | -static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); |
|---|
| 634 | | -static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8); |
|---|
| 635 | | -static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 2); |
|---|
| 636 | | -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6); |
|---|
| 637 | | -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7); |
|---|
| 615 | +static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 4); |
|---|
| 616 | +static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 11); |
|---|
| 617 | +static SENSOR_DEVICE_ATTR_RO(temp3_alarm, alarm, 0); |
|---|
| 618 | +static SENSOR_DEVICE_ATTR_RO(temp4_alarm, alarm, 1); |
|---|
| 619 | +static SENSOR_DEVICE_ATTR_RO(temp5_alarm, alarm, 3); |
|---|
| 620 | +static SENSOR_DEVICE_ATTR_RO(temp6_alarm, alarm, 8); |
|---|
| 621 | +static SENSOR_DEVICE_ATTR_RO(in0_alarm, alarm, 11); |
|---|
| 622 | +static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm, 0); |
|---|
| 623 | +static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm, 1); |
|---|
| 624 | +static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm, 3); |
|---|
| 625 | +static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm, 8); |
|---|
| 626 | +static SENSOR_DEVICE_ATTR_RO(in5_alarm, alarm, 2); |
|---|
| 627 | +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 6); |
|---|
| 628 | +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 7); |
|---|
| 638 | 629 | |
|---|
| 639 | 630 | static ssize_t name_show(struct device *dev, struct device_attribute |
|---|
| 640 | 631 | *devattr, char *buf) |
|---|
| .. | .. |
|---|
| 1001 | 992 | return -ENODEV; |
|---|
| 1002 | 993 | } |
|---|
| 1003 | 994 | |
|---|
| 1004 | | - if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_BASE_REG, |
|---|
| 1005 | | - &val)) |
|---|
| 995 | + pci_read_config_word(dev, VT8231_BASE_REG, &val); |
|---|
| 996 | + if (val == (u16)~0) |
|---|
| 1006 | 997 | return -ENODEV; |
|---|
| 1007 | 998 | |
|---|
| 1008 | 999 | address = val & ~(VT8231_EXTENT - 1); |
|---|
| .. | .. |
|---|
| 1011 | 1002 | return -ENODEV; |
|---|
| 1012 | 1003 | } |
|---|
| 1013 | 1004 | |
|---|
| 1014 | | - if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_ENABLE_REG, |
|---|
| 1015 | | - &val)) |
|---|
| 1005 | + pci_read_config_word(dev, VT8231_ENABLE_REG, &val); |
|---|
| 1006 | + if (val == (u16)~0) |
|---|
| 1016 | 1007 | return -ENODEV; |
|---|
| 1017 | 1008 | |
|---|
| 1018 | 1009 | if (!(val & 0x0001)) { |
|---|