diff options
-rw-r--r-- | drivers/hwmon/pc87360.c | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 2e5a659db58c..5e87b2f1f13b 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -279,46 +279,46 @@ static ssize_t show_fan_input(struct device *dev, struct device_attribute *devat | |||
279 | { | 279 | { |
280 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 280 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
281 | struct pc87360_data *data = pc87360_update_device(dev); | 281 | struct pc87360_data *data = pc87360_update_device(dev); |
282 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[attr->index-1], | 282 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[attr->index], |
283 | FAN_DIV_FROM_REG(data->fan_status[attr->index-1]))); | 283 | FAN_DIV_FROM_REG(data->fan_status[attr->index]))); |
284 | } | 284 | } |
285 | static ssize_t show_fan_min(struct device *dev, struct device_attribute *devattr, char *buf) | 285 | static ssize_t show_fan_min(struct device *dev, struct device_attribute *devattr, char *buf) |
286 | { | 286 | { |
287 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 287 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
288 | struct pc87360_data *data = pc87360_update_device(dev); | 288 | struct pc87360_data *data = pc87360_update_device(dev); |
289 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[attr->index-1], | 289 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[attr->index], |
290 | FAN_DIV_FROM_REG(data->fan_status[attr->index-1]))); | 290 | FAN_DIV_FROM_REG(data->fan_status[attr->index]))); |
291 | } | 291 | } |
292 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *devattr, char *buf) | 292 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *devattr, char *buf) |
293 | { | 293 | { |
294 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 294 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
295 | struct pc87360_data *data = pc87360_update_device(dev); | 295 | struct pc87360_data *data = pc87360_update_device(dev); |
296 | return sprintf(buf, "%u\n", | 296 | return sprintf(buf, "%u\n", |
297 | FAN_DIV_FROM_REG(data->fan_status[attr->index-1])); | 297 | FAN_DIV_FROM_REG(data->fan_status[attr->index])); |
298 | } | 298 | } |
299 | static ssize_t show_fan_status(struct device *dev, struct device_attribute *devattr, char *buf) | 299 | static ssize_t show_fan_status(struct device *dev, struct device_attribute *devattr, char *buf) |
300 | { | 300 | { |
301 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 301 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
302 | struct pc87360_data *data = pc87360_update_device(dev); | 302 | struct pc87360_data *data = pc87360_update_device(dev); |
303 | return sprintf(buf, "%u\n", | 303 | return sprintf(buf, "%u\n", |
304 | FAN_STATUS_FROM_REG(data->fan_status[attr->index-1])); | 304 | FAN_STATUS_FROM_REG(data->fan_status[attr->index])); |
305 | } | 305 | } |
306 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *devattr, const char *buf, | 306 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *devattr, const char *buf, |
307 | size_t count) | 307 | size_t count) |
308 | { | 308 | { |
309 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 309 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
310 | return _set_fan_min(dev, buf, count, attr->index-1); | 310 | return _set_fan_min(dev, buf, count, attr->index); |
311 | } | 311 | } |
312 | 312 | ||
313 | #define show_and_set_fan(offset) \ | 313 | #define show_and_set_fan(offset) \ |
314 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ | 314 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ |
315 | show_fan_input, NULL, offset); \ | 315 | show_fan_input, NULL, offset-1); \ |
316 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IWUSR | S_IRUGO, \ | 316 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IWUSR | S_IRUGO, \ |
317 | show_fan_min, set_fan_min, offset); \ | 317 | show_fan_min, set_fan_min, offset-1); \ |
318 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO, \ | 318 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO, \ |
319 | show_fan_div, NULL, offset); \ | 319 | show_fan_div, NULL, offset-1); \ |
320 | static SENSOR_DEVICE_ATTR(fan##offset##_status, S_IRUGO, \ | 320 | static SENSOR_DEVICE_ATTR(fan##offset##_status, S_IRUGO, \ |
321 | show_fan_status, NULL, offset); | 321 | show_fan_status, NULL, offset-1); |
322 | show_and_set_fan(1) | 322 | show_and_set_fan(1) |
323 | show_and_set_fan(2) | 323 | show_and_set_fan(2) |
324 | show_and_set_fan(3) | 324 | show_and_set_fan(3) |
@@ -328,9 +328,9 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, ch | |||
328 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 328 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
329 | struct pc87360_data *data = pc87360_update_device(dev); | 329 | struct pc87360_data *data = pc87360_update_device(dev); |
330 | return sprintf(buf, "%u\n", | 330 | return sprintf(buf, "%u\n", |
331 | PWM_FROM_REG(data->pwm[attr->index-1], | 331 | PWM_FROM_REG(data->pwm[attr->index], |
332 | FAN_CONFIG_INVERT(data->fan_conf, | 332 | FAN_CONFIG_INVERT(data->fan_conf, |
333 | attr->index-1))); | 333 | attr->index))); |
334 | } | 334 | } |
335 | static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, const char *buf, | 335 | static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, const char *buf, |
336 | size_t count) | 336 | size_t count) |
@@ -341,17 +341,17 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, con | |||
341 | long val = simple_strtol(buf, NULL, 10); | 341 | long val = simple_strtol(buf, NULL, 10); |
342 | 342 | ||
343 | down(&data->update_lock); | 343 | down(&data->update_lock); |
344 | data->pwm[attr->index-1] = PWM_TO_REG(val, | 344 | data->pwm[attr->index] = PWM_TO_REG(val, |
345 | FAN_CONFIG_INVERT(data->fan_conf, attr->index-1)); | 345 | FAN_CONFIG_INVERT(data->fan_conf, attr->index)); |
346 | pc87360_write_value(data, LD_FAN, NO_BANK, PC87360_REG_PWM(attr->index-1), | 346 | pc87360_write_value(data, LD_FAN, NO_BANK, PC87360_REG_PWM(attr->index), |
347 | data->pwm[attr->index-1]); | 347 | data->pwm[attr->index]); |
348 | up(&data->update_lock); | 348 | up(&data->update_lock); |
349 | return count; | 349 | return count; |
350 | } | 350 | } |
351 | 351 | ||
352 | #define show_and_set_pwm(offset) \ | 352 | #define show_and_set_pwm(offset) \ |
353 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IWUSR | S_IRUGO, \ | 353 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IWUSR | S_IRUGO, \ |
354 | show_pwm, set_pwm, offset); | 354 | show_pwm, set_pwm, offset-1); |
355 | show_and_set_pwm(1) | 355 | show_and_set_pwm(1) |
356 | show_and_set_pwm(2) | 356 | show_and_set_pwm(2) |
357 | show_and_set_pwm(3) | 357 | show_and_set_pwm(3) |
@@ -440,35 +440,35 @@ static ssize_t show_therm_input(struct device *dev, struct device_attribute *dev | |||
440 | { | 440 | { |
441 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 441 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
442 | struct pc87360_data *data = pc87360_update_device(dev); | 442 | struct pc87360_data *data = pc87360_update_device(dev); |
443 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[attr->index+7], | 443 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[attr->index], |
444 | data->in_vref)); | 444 | data->in_vref)); |
445 | } | 445 | } |
446 | static ssize_t show_therm_min(struct device *dev, struct device_attribute *devattr, char *buf) | 446 | static ssize_t show_therm_min(struct device *dev, struct device_attribute *devattr, char *buf) |
447 | { | 447 | { |
448 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 448 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
449 | struct pc87360_data *data = pc87360_update_device(dev); | 449 | struct pc87360_data *data = pc87360_update_device(dev); |
450 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[attr->index+7], | 450 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[attr->index], |
451 | data->in_vref)); | 451 | data->in_vref)); |
452 | } | 452 | } |
453 | static ssize_t show_therm_max(struct device *dev, struct device_attribute *devattr, char *buf) | 453 | static ssize_t show_therm_max(struct device *dev, struct device_attribute *devattr, char *buf) |
454 | { | 454 | { |
455 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 455 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
456 | struct pc87360_data *data = pc87360_update_device(dev); | 456 | struct pc87360_data *data = pc87360_update_device(dev); |
457 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[attr->index+7], | 457 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[attr->index], |
458 | data->in_vref)); | 458 | data->in_vref)); |
459 | } | 459 | } |
460 | static ssize_t show_therm_crit(struct device *dev, struct device_attribute *devattr, char *buf) | 460 | static ssize_t show_therm_crit(struct device *dev, struct device_attribute *devattr, char *buf) |
461 | { | 461 | { |
462 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 462 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
463 | struct pc87360_data *data = pc87360_update_device(dev); | 463 | struct pc87360_data *data = pc87360_update_device(dev); |
464 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[attr->index-4], | 464 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[attr->index-11], |
465 | data->in_vref)); | 465 | data->in_vref)); |
466 | } | 466 | } |
467 | static ssize_t show_therm_status(struct device *dev, struct device_attribute *devattr, char *buf) | 467 | static ssize_t show_therm_status(struct device *dev, struct device_attribute *devattr, char *buf) |
468 | { | 468 | { |
469 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 469 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
470 | struct pc87360_data *data = pc87360_update_device(dev); | 470 | struct pc87360_data *data = pc87360_update_device(dev); |
471 | return sprintf(buf, "%u\n", data->in_status[attr->index+7]); | 471 | return sprintf(buf, "%u\n", data->in_status[attr->index]); |
472 | } | 472 | } |
473 | static ssize_t set_therm_min(struct device *dev, struct device_attribute *devattr, const char *buf, | 473 | static ssize_t set_therm_min(struct device *dev, struct device_attribute *devattr, const char *buf, |
474 | size_t count) | 474 | size_t count) |
@@ -479,9 +479,9 @@ static ssize_t set_therm_min(struct device *dev, struct device_attribute *devatt | |||
479 | long val = simple_strtol(buf, NULL, 10); | 479 | long val = simple_strtol(buf, NULL, 10); |
480 | 480 | ||
481 | down(&data->update_lock); | 481 | down(&data->update_lock); |
482 | data->in_min[attr->index+7] = IN_TO_REG(val, data->in_vref); | 482 | data->in_min[attr->index] = IN_TO_REG(val, data->in_vref); |
483 | pc87360_write_value(data, LD_IN, attr->index+7, PC87365_REG_TEMP_MIN, | 483 | pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_TEMP_MIN, |
484 | data->in_min[attr->index+7]); | 484 | data->in_min[attr->index]); |
485 | up(&data->update_lock); | 485 | up(&data->update_lock); |
486 | return count; | 486 | return count; |
487 | } | 487 | } |
@@ -494,9 +494,9 @@ static ssize_t set_therm_max(struct device *dev, struct device_attribute *devatt | |||
494 | long val = simple_strtol(buf, NULL, 10); | 494 | long val = simple_strtol(buf, NULL, 10); |
495 | 495 | ||
496 | down(&data->update_lock); | 496 | down(&data->update_lock); |
497 | data->in_max[attr->index+7] = IN_TO_REG(val, data->in_vref); | 497 | data->in_max[attr->index] = IN_TO_REG(val, data->in_vref); |
498 | pc87360_write_value(data, LD_IN, attr->index+7, PC87365_REG_TEMP_MAX, | 498 | pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_TEMP_MAX, |
499 | data->in_max[attr->index+7]); | 499 | data->in_max[attr->index]); |
500 | up(&data->update_lock); | 500 | up(&data->update_lock); |
501 | return count; | 501 | return count; |
502 | } | 502 | } |
@@ -509,24 +509,24 @@ static ssize_t set_therm_crit(struct device *dev, struct device_attribute *devat | |||
509 | long val = simple_strtol(buf, NULL, 10); | 509 | long val = simple_strtol(buf, NULL, 10); |
510 | 510 | ||
511 | down(&data->update_lock); | 511 | down(&data->update_lock); |
512 | data->in_crit[attr->index-4] = IN_TO_REG(val, data->in_vref); | 512 | data->in_crit[attr->index-11] = IN_TO_REG(val, data->in_vref); |
513 | pc87360_write_value(data, LD_IN, attr->index+7, PC87365_REG_TEMP_CRIT, | 513 | pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_TEMP_CRIT, |
514 | data->in_crit[attr->index-4]); | 514 | data->in_crit[attr->index-11]); |
515 | up(&data->update_lock); | 515 | up(&data->update_lock); |
516 | return count; | 516 | return count; |
517 | } | 517 | } |
518 | 518 | ||
519 | #define show_and_set_therm(offset) \ | 519 | #define show_and_set_therm(offset) \ |
520 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | 520 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
521 | show_therm_input, NULL, offset); \ | 521 | show_therm_input, NULL, 11+offset-4); \ |
522 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \ | 522 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \ |
523 | show_therm_min, set_therm_min, offset); \ | 523 | show_therm_min, set_therm_min, 11+offset-4); \ |
524 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ | 524 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ |
525 | show_therm_max, set_therm_max, offset); \ | 525 | show_therm_max, set_therm_max, 11+offset-4); \ |
526 | static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \ | 526 | static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \ |
527 | show_therm_crit, set_therm_crit, offset); \ | 527 | show_therm_crit, set_therm_crit, 11+offset-4); \ |
528 | static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \ | 528 | static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \ |
529 | show_therm_status, NULL, offset); | 529 | show_therm_status, NULL, 11+offset-4); |
530 | show_and_set_therm(4) | 530 | show_and_set_therm(4) |
531 | show_and_set_therm(5) | 531 | show_and_set_therm(5) |
532 | show_and_set_therm(6) | 532 | show_and_set_therm(6) |
@@ -563,31 +563,31 @@ static ssize_t show_temp_input(struct device *dev, struct device_attribute *deva | |||
563 | { | 563 | { |
564 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 564 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
565 | struct pc87360_data *data = pc87360_update_device(dev); | 565 | struct pc87360_data *data = pc87360_update_device(dev); |
566 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[attr->index-1])); | 566 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[attr->index])); |
567 | } | 567 | } |
568 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *devattr, char *buf) | 568 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *devattr, char *buf) |
569 | { | 569 | { |
570 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 570 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
571 | struct pc87360_data *data = pc87360_update_device(dev); | 571 | struct pc87360_data *data = pc87360_update_device(dev); |
572 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[attr->index-1])); | 572 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[attr->index])); |
573 | } | 573 | } |
574 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *devattr, char *buf) | 574 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *devattr, char *buf) |
575 | { | 575 | { |
576 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 576 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
577 | struct pc87360_data *data = pc87360_update_device(dev); | 577 | struct pc87360_data *data = pc87360_update_device(dev); |
578 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[attr->index-1])); | 578 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[attr->index])); |
579 | } | 579 | } |
580 | static ssize_t show_temp_crit(struct device *dev, struct device_attribute *devattr, char *buf) | 580 | static ssize_t show_temp_crit(struct device *dev, struct device_attribute *devattr, char *buf) |
581 | { | 581 | { |
582 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 582 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
583 | struct pc87360_data *data = pc87360_update_device(dev); | 583 | struct pc87360_data *data = pc87360_update_device(dev); |
584 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[attr->index-1])); | 584 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[attr->index])); |
585 | } | 585 | } |
586 | static ssize_t show_temp_status(struct device *dev, struct device_attribute *devattr, char *buf) | 586 | static ssize_t show_temp_status(struct device *dev, struct device_attribute *devattr, char *buf) |
587 | { | 587 | { |
588 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 588 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
589 | struct pc87360_data *data = pc87360_update_device(dev); | 589 | struct pc87360_data *data = pc87360_update_device(dev); |
590 | return sprintf(buf, "%d\n", data->temp_status[attr->index-1]); | 590 | return sprintf(buf, "%d\n", data->temp_status[attr->index]); |
591 | } | 591 | } |
592 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *devattr, const char *buf, | 592 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *devattr, const char *buf, |
593 | size_t count) | 593 | size_t count) |
@@ -598,9 +598,9 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *devattr | |||
598 | long val = simple_strtol(buf, NULL, 10); | 598 | long val = simple_strtol(buf, NULL, 10); |
599 | 599 | ||
600 | down(&data->update_lock); | 600 | down(&data->update_lock); |
601 | data->temp_min[attr->index-1] = TEMP_TO_REG(val); | 601 | data->temp_min[attr->index] = TEMP_TO_REG(val); |
602 | pc87360_write_value(data, LD_TEMP, attr->index-1, PC87365_REG_TEMP_MIN, | 602 | pc87360_write_value(data, LD_TEMP, attr->index, PC87365_REG_TEMP_MIN, |
603 | data->temp_min[attr->index-1]); | 603 | data->temp_min[attr->index]); |
604 | up(&data->update_lock); | 604 | up(&data->update_lock); |
605 | return count; | 605 | return count; |
606 | } | 606 | } |
@@ -613,9 +613,9 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *devattr | |||
613 | long val = simple_strtol(buf, NULL, 10); | 613 | long val = simple_strtol(buf, NULL, 10); |
614 | 614 | ||
615 | down(&data->update_lock); | 615 | down(&data->update_lock); |
616 | data->temp_max[attr->index-1] = TEMP_TO_REG(val); | 616 | data->temp_max[attr->index] = TEMP_TO_REG(val); |
617 | pc87360_write_value(data, LD_TEMP, attr->index-1, PC87365_REG_TEMP_MAX, | 617 | pc87360_write_value(data, LD_TEMP, attr->index, PC87365_REG_TEMP_MAX, |
618 | data->temp_max[attr->index-1]); | 618 | data->temp_max[attr->index]); |
619 | up(&data->update_lock); | 619 | up(&data->update_lock); |
620 | return count; | 620 | return count; |
621 | } | 621 | } |
@@ -628,24 +628,24 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *devatt | |||
628 | long val = simple_strtol(buf, NULL, 10); | 628 | long val = simple_strtol(buf, NULL, 10); |
629 | 629 | ||
630 | down(&data->update_lock); | 630 | down(&data->update_lock); |
631 | data->temp_crit[attr->index-1] = TEMP_TO_REG(val); | 631 | data->temp_crit[attr->index] = TEMP_TO_REG(val); |
632 | pc87360_write_value(data, LD_TEMP, attr->index-1, PC87365_REG_TEMP_CRIT, | 632 | pc87360_write_value(data, LD_TEMP, attr->index, PC87365_REG_TEMP_CRIT, |
633 | data->temp_crit[attr->index-1]); | 633 | data->temp_crit[attr->index]); |
634 | up(&data->update_lock); | 634 | up(&data->update_lock); |
635 | return count; | 635 | return count; |
636 | } | 636 | } |
637 | 637 | ||
638 | #define show_and_set_temp(offset) \ | 638 | #define show_and_set_temp(offset) \ |
639 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | 639 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
640 | show_temp_input, NULL, offset); \ | 640 | show_temp_input, NULL, offset-1); \ |
641 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \ | 641 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \ |
642 | show_temp_min, set_temp_min, offset); \ | 642 | show_temp_min, set_temp_min, offset-1); \ |
643 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ | 643 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ |
644 | show_temp_max, set_temp_max, offset); \ | 644 | show_temp_max, set_temp_max, offset-1); \ |
645 | static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \ | 645 | static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \ |
646 | show_temp_crit, set_temp_crit, offset); \ | 646 | show_temp_crit, set_temp_crit, offset-1); \ |
647 | static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \ | 647 | static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \ |
648 | show_temp_status, NULL, offset); | 648 | show_temp_status, NULL, offset-1); |
649 | show_and_set_temp(1) | 649 | show_and_set_temp(1) |
650 | show_and_set_temp(2) | 650 | show_and_set_temp(2) |
651 | show_and_set_temp(3) | 651 | show_and_set_temp(3) |