aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-07-05 14:36:12 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:30 -0400
commitb353a487b9d835da331edb443afedfd7977b3d76 (patch)
treed4fc64e99a9c9f7085437f581a24088befab7dfa /drivers/hwmon
parent1beeffe43311f64df8dd0ab08ff6b1858c58363f (diff)
hwmon: (lm85) Use dynamic sysfs callbacks
This lets us get rid of macro-generated functions and shrinks the driver size by about 10%. I used a new style suggested by Mark M. Hoffman to retrieve the channel number. Instead of: struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); int nr = sda->index; I do: int nr = to_sensor_dev_attr(attr)->index; This looks better, and even allows the compiler to do some minor optimizations. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm85.c551
1 files changed, 244 insertions, 307 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index 954c364f38b4..111c2c800100 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -30,6 +30,7 @@
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31#include <linux/hwmon.h> 31#include <linux/hwmon.h>
32#include <linux/hwmon-vid.h> 32#include <linux/hwmon-vid.h>
33#include <linux/hwmon-sysfs.h>
33#include <linux/err.h> 34#include <linux/err.h>
34#include <linux/mutex.h> 35#include <linux/mutex.h>
35 36
@@ -387,19 +388,26 @@ static struct i2c_driver lm85_driver = {
387 388
388 389
389/* 4 Fans */ 390/* 4 Fans */
390static ssize_t show_fan(struct device *dev, char *buf, int nr) 391static ssize_t show_fan(struct device *dev, struct device_attribute *attr,
392 char *buf)
391{ 393{
394 int nr = to_sensor_dev_attr(attr)->index;
392 struct lm85_data *data = lm85_update_device(dev); 395 struct lm85_data *data = lm85_update_device(dev);
393 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr]) ); 396 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr]) );
394} 397}
395static ssize_t show_fan_min(struct device *dev, char *buf, int nr) 398
399static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr,
400 char *buf)
396{ 401{
402 int nr = to_sensor_dev_attr(attr)->index;
397 struct lm85_data *data = lm85_update_device(dev); 403 struct lm85_data *data = lm85_update_device(dev);
398 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr]) ); 404 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr]) );
399} 405}
400static ssize_t set_fan_min(struct device *dev, const char *buf, 406
401 size_t count, int nr) 407static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
408 const char *buf, size_t count)
402{ 409{
410 int nr = to_sensor_dev_attr(attr)->index;
403 struct i2c_client *client = to_i2c_client(dev); 411 struct i2c_client *client = to_i2c_client(dev);
404 struct lm85_data *data = i2c_get_clientdata(client); 412 struct lm85_data *data = i2c_get_clientdata(client);
405 long val = simple_strtol(buf, NULL, 10); 413 long val = simple_strtol(buf, NULL, 10);
@@ -412,23 +420,10 @@ static ssize_t set_fan_min(struct device *dev, const char *buf,
412} 420}
413 421
414#define show_fan_offset(offset) \ 422#define show_fan_offset(offset) \
415static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ 423static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
416{ \ 424 show_fan, NULL, offset - 1); \
417 return show_fan(dev, buf, offset - 1); \ 425static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
418} \ 426 show_fan_min, set_fan_min, offset - 1)
419static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \
420{ \
421 return show_fan_min(dev, buf, offset - 1); \
422} \
423static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \
424 const char *buf, size_t count) \
425{ \
426 return set_fan_min(dev, buf, count, offset - 1); \
427} \
428static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, \
429 NULL); \
430static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
431 show_fan_##offset##_min, set_fan_##offset##_min);
432 427
433show_fan_offset(1); 428show_fan_offset(1);
434show_fan_offset(2); 429show_fan_offset(2);
@@ -484,14 +479,18 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
484 479
485/* pwm */ 480/* pwm */
486 481
487static ssize_t show_pwm(struct device *dev, char *buf, int nr) 482static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
483 char *buf)
488{ 484{
485 int nr = to_sensor_dev_attr(attr)->index;
489 struct lm85_data *data = lm85_update_device(dev); 486 struct lm85_data *data = lm85_update_device(dev);
490 return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm[nr]) ); 487 return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm[nr]) );
491} 488}
492static ssize_t set_pwm(struct device *dev, const char *buf, 489
493 size_t count, int nr) 490static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
491 const char *buf, size_t count)
494{ 492{
493 int nr = to_sensor_dev_attr(attr)->index;
495 struct i2c_client *client = to_i2c_client(dev); 494 struct i2c_client *client = to_i2c_client(dev);
496 struct lm85_data *data = i2c_get_clientdata(client); 495 struct lm85_data *data = i2c_get_clientdata(client);
497 long val = simple_strtol(buf, NULL, 10); 496 long val = simple_strtol(buf, NULL, 10);
@@ -502,8 +501,11 @@ static ssize_t set_pwm(struct device *dev, const char *buf,
502 mutex_unlock(&data->update_lock); 501 mutex_unlock(&data->update_lock);
503 return count; 502 return count;
504} 503}
505static ssize_t show_pwm_enable(struct device *dev, char *buf, int nr) 504
505static ssize_t show_pwm_enable(struct device *dev, struct device_attribute
506 *attr, char *buf)
506{ 507{
508 int nr = to_sensor_dev_attr(attr)->index;
507 struct lm85_data *data = lm85_update_device(dev); 509 struct lm85_data *data = lm85_update_device(dev);
508 int pwm_zone; 510 int pwm_zone;
509 511
@@ -512,23 +514,10 @@ static ssize_t show_pwm_enable(struct device *dev, char *buf, int nr)
512} 514}
513 515
514#define show_pwm_reg(offset) \ 516#define show_pwm_reg(offset) \
515static ssize_t show_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ 517static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
516{ \ 518 show_pwm, set_pwm, offset - 1); \
517 return show_pwm(dev, buf, offset - 1); \ 519static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO, \
518} \ 520 show_pwm_enable, NULL, offset - 1)
519static ssize_t set_pwm_##offset (struct device *dev, struct device_attribute *attr, \
520 const char *buf, size_t count) \
521{ \
522 return set_pwm(dev, buf, count, offset - 1); \
523} \
524static ssize_t show_pwm_enable##offset (struct device *dev, struct device_attribute *attr, char *buf) \
525{ \
526 return show_pwm_enable(dev, buf, offset - 1); \
527} \
528static DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
529 show_pwm_##offset, set_pwm_##offset); \
530static DEVICE_ATTR(pwm##offset##_enable, S_IRUGO, \
531 show_pwm_enable##offset, NULL);
532 521
533show_pwm_reg(1); 522show_pwm_reg(1);
534show_pwm_reg(2); 523show_pwm_reg(2);
@@ -536,22 +525,29 @@ show_pwm_reg(3);
536 525
537/* Voltages */ 526/* Voltages */
538 527
539static ssize_t show_in(struct device *dev, char *buf, int nr) 528static ssize_t show_in(struct device *dev, struct device_attribute *attr,
529 char *buf)
540{ 530{
531 int nr = to_sensor_dev_attr(attr)->index;
541 struct lm85_data *data = lm85_update_device(dev); 532 struct lm85_data *data = lm85_update_device(dev);
542 return sprintf( buf, "%d\n", INSEXT_FROM_REG(nr, 533 return sprintf( buf, "%d\n", INSEXT_FROM_REG(nr,
543 data->in[nr], 534 data->in[nr],
544 data->in_ext[nr], 535 data->in_ext[nr],
545 data->adc_scale) ); 536 data->adc_scale) );
546} 537}
547static ssize_t show_in_min(struct device *dev, char *buf, int nr) 538
539static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,
540 char *buf)
548{ 541{
542 int nr = to_sensor_dev_attr(attr)->index;
549 struct lm85_data *data = lm85_update_device(dev); 543 struct lm85_data *data = lm85_update_device(dev);
550 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr]) ); 544 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr]) );
551} 545}
552static ssize_t set_in_min(struct device *dev, const char *buf, 546
553 size_t count, int nr) 547static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
548 const char *buf, size_t count)
554{ 549{
550 int nr = to_sensor_dev_attr(attr)->index;
555 struct i2c_client *client = to_i2c_client(dev); 551 struct i2c_client *client = to_i2c_client(dev);
556 struct lm85_data *data = i2c_get_clientdata(client); 552 struct lm85_data *data = i2c_get_clientdata(client);
557 long val = simple_strtol(buf, NULL, 10); 553 long val = simple_strtol(buf, NULL, 10);
@@ -562,14 +558,19 @@ static ssize_t set_in_min(struct device *dev, const char *buf,
562 mutex_unlock(&data->update_lock); 558 mutex_unlock(&data->update_lock);
563 return count; 559 return count;
564} 560}
565static ssize_t show_in_max(struct device *dev, char *buf, int nr) 561
562static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
563 char *buf)
566{ 564{
565 int nr = to_sensor_dev_attr(attr)->index;
567 struct lm85_data *data = lm85_update_device(dev); 566 struct lm85_data *data = lm85_update_device(dev);
568 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr]) ); 567 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr]) );
569} 568}
570static ssize_t set_in_max(struct device *dev, const char *buf, 569
571 size_t count, int nr) 570static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
571 const char *buf, size_t count)
572{ 572{
573 int nr = to_sensor_dev_attr(attr)->index;
573 struct i2c_client *client = to_i2c_client(dev); 574 struct i2c_client *client = to_i2c_client(dev);
574 struct lm85_data *data = i2c_get_clientdata(client); 575 struct lm85_data *data = i2c_get_clientdata(client);
575 long val = simple_strtol(buf, NULL, 10); 576 long val = simple_strtol(buf, NULL, 10);
@@ -580,35 +581,14 @@ static ssize_t set_in_max(struct device *dev, const char *buf,
580 mutex_unlock(&data->update_lock); 581 mutex_unlock(&data->update_lock);
581 return count; 582 return count;
582} 583}
584
583#define show_in_reg(offset) \ 585#define show_in_reg(offset) \
584static ssize_t show_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ 586static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \
585{ \ 587 show_in, NULL, offset); \
586 return show_in(dev, buf, offset); \ 588static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
587} \ 589 show_in_min, set_in_min, offset); \
588static ssize_t show_in_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ 590static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
589{ \ 591 show_in_max, set_in_max, offset)
590 return show_in_min(dev, buf, offset); \
591} \
592static ssize_t show_in_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \
593{ \
594 return show_in_max(dev, buf, offset); \
595} \
596static ssize_t set_in_##offset##_min (struct device *dev, struct device_attribute *attr, \
597 const char *buf, size_t count) \
598{ \
599 return set_in_min(dev, buf, count, offset); \
600} \
601static ssize_t set_in_##offset##_max (struct device *dev, struct device_attribute *attr, \
602 const char *buf, size_t count) \
603{ \
604 return set_in_max(dev, buf, count, offset); \
605} \
606static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in_##offset, \
607 NULL); \
608static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
609 show_in_##offset##_min, set_in_##offset##_min); \
610static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
611 show_in_##offset##_max, set_in_##offset##_max);
612 592
613show_in_reg(0); 593show_in_reg(0);
614show_in_reg(1); 594show_in_reg(1);
@@ -618,21 +598,28 @@ show_in_reg(4);
618 598
619/* Temps */ 599/* Temps */
620 600
621static ssize_t show_temp(struct device *dev, char *buf, int nr) 601static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
602 char *buf)
622{ 603{
604 int nr = to_sensor_dev_attr(attr)->index;
623 struct lm85_data *data = lm85_update_device(dev); 605 struct lm85_data *data = lm85_update_device(dev);
624 return sprintf(buf,"%d\n", TEMPEXT_FROM_REG(data->temp[nr], 606 return sprintf(buf,"%d\n", TEMPEXT_FROM_REG(data->temp[nr],
625 data->temp_ext[nr], 607 data->temp_ext[nr],
626 data->adc_scale) ); 608 data->adc_scale) );
627} 609}
628static ssize_t show_temp_min(struct device *dev, char *buf, int nr) 610
611static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,
612 char *buf)
629{ 613{
614 int nr = to_sensor_dev_attr(attr)->index;
630 struct lm85_data *data = lm85_update_device(dev); 615 struct lm85_data *data = lm85_update_device(dev);
631 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr]) ); 616 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr]) );
632} 617}
633static ssize_t set_temp_min(struct device *dev, const char *buf, 618
634 size_t count, int nr) 619static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
620 const char *buf, size_t count)
635{ 621{
622 int nr = to_sensor_dev_attr(attr)->index;
636 struct i2c_client *client = to_i2c_client(dev); 623 struct i2c_client *client = to_i2c_client(dev);
637 struct lm85_data *data = i2c_get_clientdata(client); 624 struct lm85_data *data = i2c_get_clientdata(client);
638 long val = simple_strtol(buf, NULL, 10); 625 long val = simple_strtol(buf, NULL, 10);
@@ -643,14 +630,19 @@ static ssize_t set_temp_min(struct device *dev, const char *buf,
643 mutex_unlock(&data->update_lock); 630 mutex_unlock(&data->update_lock);
644 return count; 631 return count;
645} 632}
646static ssize_t show_temp_max(struct device *dev, char *buf, int nr) 633
634static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
635 char *buf)
647{ 636{
637 int nr = to_sensor_dev_attr(attr)->index;
648 struct lm85_data *data = lm85_update_device(dev); 638 struct lm85_data *data = lm85_update_device(dev);
649 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr]) ); 639 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr]) );
650} 640}
651static ssize_t set_temp_max(struct device *dev, const char *buf, 641
652 size_t count, int nr) 642static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
643 const char *buf, size_t count)
653{ 644{
645 int nr = to_sensor_dev_attr(attr)->index;
654 struct i2c_client *client = to_i2c_client(dev); 646 struct i2c_client *client = to_i2c_client(dev);
655 struct lm85_data *data = i2c_get_clientdata(client); 647 struct lm85_data *data = i2c_get_clientdata(client);
656 long val = simple_strtol(buf, NULL, 10); 648 long val = simple_strtol(buf, NULL, 10);
@@ -661,35 +653,14 @@ static ssize_t set_temp_max(struct device *dev, const char *buf,
661 mutex_unlock(&data->update_lock); 653 mutex_unlock(&data->update_lock);
662 return count; 654 return count;
663} 655}
656
664#define show_temp_reg(offset) \ 657#define show_temp_reg(offset) \
665static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ 658static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
666{ \ 659 show_temp, NULL, offset - 1); \
667 return show_temp(dev, buf, offset - 1); \ 660static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
668} \ 661 show_temp_min, set_temp_min, offset - 1); \
669static ssize_t show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ 662static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
670{ \ 663 show_temp_max, set_temp_max, offset - 1);
671 return show_temp_min(dev, buf, offset - 1); \
672} \
673static ssize_t show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \
674{ \
675 return show_temp_max(dev, buf, offset - 1); \
676} \
677static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \
678 const char *buf, size_t count) \
679{ \
680 return set_temp_min(dev, buf, count, offset - 1); \
681} \
682static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \
683 const char *buf, size_t count) \
684{ \
685 return set_temp_max(dev, buf, count, offset - 1); \
686} \
687static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp_##offset, \
688 NULL); \
689static DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
690 show_temp_##offset##_min, set_temp_##offset##_min); \
691static DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
692 show_temp_##offset##_max, set_temp_##offset##_max);
693 664
694show_temp_reg(1); 665show_temp_reg(1);
695show_temp_reg(2); 666show_temp_reg(2);
@@ -698,14 +669,18 @@ show_temp_reg(3);
698 669
699/* Automatic PWM control */ 670/* Automatic PWM control */
700 671
701static ssize_t show_pwm_auto_channels(struct device *dev, char *buf, int nr) 672static ssize_t show_pwm_auto_channels(struct device *dev,
673 struct device_attribute *attr, char *buf)
702{ 674{
675 int nr = to_sensor_dev_attr(attr)->index;
703 struct lm85_data *data = lm85_update_device(dev); 676 struct lm85_data *data = lm85_update_device(dev);
704 return sprintf(buf,"%d\n", ZONE_FROM_REG(data->autofan[nr].config)); 677 return sprintf(buf,"%d\n", ZONE_FROM_REG(data->autofan[nr].config));
705} 678}
706static ssize_t set_pwm_auto_channels(struct device *dev, const char *buf, 679
707 size_t count, int nr) 680static ssize_t set_pwm_auto_channels(struct device *dev,
681 struct device_attribute *attr, const char *buf, size_t count)
708{ 682{
683 int nr = to_sensor_dev_attr(attr)->index;
709 struct i2c_client *client = to_i2c_client(dev); 684 struct i2c_client *client = to_i2c_client(dev);
710 struct lm85_data *data = i2c_get_clientdata(client); 685 struct lm85_data *data = i2c_get_clientdata(client);
711 long val = simple_strtol(buf, NULL, 10); 686 long val = simple_strtol(buf, NULL, 10);
@@ -718,14 +693,19 @@ static ssize_t set_pwm_auto_channels(struct device *dev, const char *buf,
718 mutex_unlock(&data->update_lock); 693 mutex_unlock(&data->update_lock);
719 return count; 694 return count;
720} 695}
721static ssize_t show_pwm_auto_pwm_min(struct device *dev, char *buf, int nr) 696
697static ssize_t show_pwm_auto_pwm_min(struct device *dev,
698 struct device_attribute *attr, char *buf)
722{ 699{
700 int nr = to_sensor_dev_attr(attr)->index;
723 struct lm85_data *data = lm85_update_device(dev); 701 struct lm85_data *data = lm85_update_device(dev);
724 return sprintf(buf,"%d\n", PWM_FROM_REG(data->autofan[nr].min_pwm)); 702 return sprintf(buf,"%d\n", PWM_FROM_REG(data->autofan[nr].min_pwm));
725} 703}
726static ssize_t set_pwm_auto_pwm_min(struct device *dev, const char *buf, 704
727 size_t count, int nr) 705static ssize_t set_pwm_auto_pwm_min(struct device *dev,
706 struct device_attribute *attr, const char *buf, size_t count)
728{ 707{
708 int nr = to_sensor_dev_attr(attr)->index;
729 struct i2c_client *client = to_i2c_client(dev); 709 struct i2c_client *client = to_i2c_client(dev);
730 struct lm85_data *data = i2c_get_clientdata(client); 710 struct lm85_data *data = i2c_get_clientdata(client);
731 long val = simple_strtol(buf, NULL, 10); 711 long val = simple_strtol(buf, NULL, 10);
@@ -737,14 +717,19 @@ static ssize_t set_pwm_auto_pwm_min(struct device *dev, const char *buf,
737 mutex_unlock(&data->update_lock); 717 mutex_unlock(&data->update_lock);
738 return count; 718 return count;
739} 719}
740static ssize_t show_pwm_auto_pwm_minctl(struct device *dev, char *buf, int nr) 720
721static ssize_t show_pwm_auto_pwm_minctl(struct device *dev,
722 struct device_attribute *attr, char *buf)
741{ 723{
724 int nr = to_sensor_dev_attr(attr)->index;
742 struct lm85_data *data = lm85_update_device(dev); 725 struct lm85_data *data = lm85_update_device(dev);
743 return sprintf(buf,"%d\n", data->autofan[nr].min_off); 726 return sprintf(buf,"%d\n", data->autofan[nr].min_off);
744} 727}
745static ssize_t set_pwm_auto_pwm_minctl(struct device *dev, const char *buf, 728
746 size_t count, int nr) 729static ssize_t set_pwm_auto_pwm_minctl(struct device *dev,
730 struct device_attribute *attr, const char *buf, size_t count)
747{ 731{
732 int nr = to_sensor_dev_attr(attr)->index;
748 struct i2c_client *client = to_i2c_client(dev); 733 struct i2c_client *client = to_i2c_client(dev);
749 struct lm85_data *data = i2c_get_clientdata(client); 734 struct lm85_data *data = i2c_get_clientdata(client);
750 long val = simple_strtol(buf, NULL, 10); 735 long val = simple_strtol(buf, NULL, 10);
@@ -760,14 +745,19 @@ static ssize_t set_pwm_auto_pwm_minctl(struct device *dev, const char *buf,
760 mutex_unlock(&data->update_lock); 745 mutex_unlock(&data->update_lock);
761 return count; 746 return count;
762} 747}
763static ssize_t show_pwm_auto_pwm_freq(struct device *dev, char *buf, int nr) 748
749static ssize_t show_pwm_auto_pwm_freq(struct device *dev,
750 struct device_attribute *attr, char *buf)
764{ 751{
752 int nr = to_sensor_dev_attr(attr)->index;
765 struct lm85_data *data = lm85_update_device(dev); 753 struct lm85_data *data = lm85_update_device(dev);
766 return sprintf(buf,"%d\n", FREQ_FROM_REG(data->autofan[nr].freq)); 754 return sprintf(buf,"%d\n", FREQ_FROM_REG(data->autofan[nr].freq));
767} 755}
768static ssize_t set_pwm_auto_pwm_freq(struct device *dev, const char *buf, 756
769 size_t count, int nr) 757static ssize_t set_pwm_auto_pwm_freq(struct device *dev,
758 struct device_attribute *attr, const char *buf, size_t count)
770{ 759{
760 int nr = to_sensor_dev_attr(attr)->index;
771 struct i2c_client *client = to_i2c_client(dev); 761 struct i2c_client *client = to_i2c_client(dev);
772 struct lm85_data *data = i2c_get_clientdata(client); 762 struct lm85_data *data = i2c_get_clientdata(client);
773 long val = simple_strtol(buf, NULL, 10); 763 long val = simple_strtol(buf, NULL, 10);
@@ -781,74 +771,40 @@ static ssize_t set_pwm_auto_pwm_freq(struct device *dev, const char *buf,
781 mutex_unlock(&data->update_lock); 771 mutex_unlock(&data->update_lock);
782 return count; 772 return count;
783} 773}
774
784#define pwm_auto(offset) \ 775#define pwm_auto(offset) \
785static ssize_t show_pwm##offset##_auto_channels (struct device *dev, struct device_attribute *attr, \ 776static SENSOR_DEVICE_ATTR(pwm##offset##_auto_channels, \
786 char *buf) \ 777 S_IRUGO | S_IWUSR, show_pwm_auto_channels, \
787{ \ 778 set_pwm_auto_channels, offset - 1); \
788 return show_pwm_auto_channels(dev, buf, offset - 1); \ 779static SENSOR_DEVICE_ATTR(pwm##offset##_auto_pwm_min, \
789} \ 780 S_IRUGO | S_IWUSR, show_pwm_auto_pwm_min, \
790static ssize_t set_pwm##offset##_auto_channels (struct device *dev, struct device_attribute *attr, \ 781 set_pwm_auto_pwm_min, offset - 1); \
791 const char *buf, size_t count) \ 782static SENSOR_DEVICE_ATTR(pwm##offset##_auto_pwm_minctl, \
792{ \ 783 S_IRUGO | S_IWUSR, show_pwm_auto_pwm_minctl, \
793 return set_pwm_auto_channels(dev, buf, count, offset - 1); \ 784 set_pwm_auto_pwm_minctl, offset - 1); \
794} \ 785static SENSOR_DEVICE_ATTR(pwm##offset##_auto_pwm_freq, \
795static ssize_t show_pwm##offset##_auto_pwm_min (struct device *dev, struct device_attribute *attr, \ 786 S_IRUGO | S_IWUSR, show_pwm_auto_pwm_freq, \
796 char *buf) \ 787 set_pwm_auto_pwm_freq, offset - 1);
797{ \ 788
798 return show_pwm_auto_pwm_min(dev, buf, offset - 1); \
799} \
800static ssize_t set_pwm##offset##_auto_pwm_min (struct device *dev, struct device_attribute *attr, \
801 const char *buf, size_t count) \
802{ \
803 return set_pwm_auto_pwm_min(dev, buf, count, offset - 1); \
804} \
805static ssize_t show_pwm##offset##_auto_pwm_minctl (struct device *dev, struct device_attribute *attr, \
806 char *buf) \
807{ \
808 return show_pwm_auto_pwm_minctl(dev, buf, offset - 1); \
809} \
810static ssize_t set_pwm##offset##_auto_pwm_minctl (struct device *dev, struct device_attribute *attr, \
811 const char *buf, size_t count) \
812{ \
813 return set_pwm_auto_pwm_minctl(dev, buf, count, offset - 1); \
814} \
815static ssize_t show_pwm##offset##_auto_pwm_freq (struct device *dev, struct device_attribute *attr, \
816 char *buf) \
817{ \
818 return show_pwm_auto_pwm_freq(dev, buf, offset - 1); \
819} \
820static ssize_t set_pwm##offset##_auto_pwm_freq(struct device *dev, struct device_attribute *attr, \
821 const char *buf, size_t count) \
822{ \
823 return set_pwm_auto_pwm_freq(dev, buf, count, offset - 1); \
824} \
825static DEVICE_ATTR(pwm##offset##_auto_channels, S_IRUGO | S_IWUSR, \
826 show_pwm##offset##_auto_channels, \
827 set_pwm##offset##_auto_channels); \
828static DEVICE_ATTR(pwm##offset##_auto_pwm_min, S_IRUGO | S_IWUSR, \
829 show_pwm##offset##_auto_pwm_min, \
830 set_pwm##offset##_auto_pwm_min); \
831static DEVICE_ATTR(pwm##offset##_auto_pwm_minctl, S_IRUGO | S_IWUSR, \
832 show_pwm##offset##_auto_pwm_minctl, \
833 set_pwm##offset##_auto_pwm_minctl); \
834static DEVICE_ATTR(pwm##offset##_auto_pwm_freq, S_IRUGO | S_IWUSR, \
835 show_pwm##offset##_auto_pwm_freq, \
836 set_pwm##offset##_auto_pwm_freq);
837pwm_auto(1); 789pwm_auto(1);
838pwm_auto(2); 790pwm_auto(2);
839pwm_auto(3); 791pwm_auto(3);
840 792
841/* Temperature settings for automatic PWM control */ 793/* Temperature settings for automatic PWM control */
842 794
843static ssize_t show_temp_auto_temp_off(struct device *dev, char *buf, int nr) 795static ssize_t show_temp_auto_temp_off(struct device *dev,
796 struct device_attribute *attr, char *buf)
844{ 797{
798 int nr = to_sensor_dev_attr(attr)->index;
845 struct lm85_data *data = lm85_update_device(dev); 799 struct lm85_data *data = lm85_update_device(dev);
846 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) - 800 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) -
847 HYST_FROM_REG(data->zone[nr].hyst)); 801 HYST_FROM_REG(data->zone[nr].hyst));
848} 802}
849static ssize_t set_temp_auto_temp_off(struct device *dev, const char *buf, 803
850 size_t count, int nr) 804static ssize_t set_temp_auto_temp_off(struct device *dev,
805 struct device_attribute *attr, const char *buf, size_t count)
851{ 806{
807 int nr = to_sensor_dev_attr(attr)->index;
852 struct i2c_client *client = to_i2c_client(dev); 808 struct i2c_client *client = to_i2c_client(dev);
853 struct lm85_data *data = i2c_get_clientdata(client); 809 struct lm85_data *data = i2c_get_clientdata(client);
854 int min; 810 int min;
@@ -871,14 +827,19 @@ static ssize_t set_temp_auto_temp_off(struct device *dev, const char *buf,
871 mutex_unlock(&data->update_lock); 827 mutex_unlock(&data->update_lock);
872 return count; 828 return count;
873} 829}
874static ssize_t show_temp_auto_temp_min(struct device *dev, char *buf, int nr) 830
831static ssize_t show_temp_auto_temp_min(struct device *dev,
832 struct device_attribute *attr, char *buf)
875{ 833{
834 int nr = to_sensor_dev_attr(attr)->index;
876 struct lm85_data *data = lm85_update_device(dev); 835 struct lm85_data *data = lm85_update_device(dev);
877 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) ); 836 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) );
878} 837}
879static ssize_t set_temp_auto_temp_min(struct device *dev, const char *buf, 838
880 size_t count, int nr) 839static ssize_t set_temp_auto_temp_min(struct device *dev,
840 struct device_attribute *attr, const char *buf, size_t count)
881{ 841{
842 int nr = to_sensor_dev_attr(attr)->index;
882 struct i2c_client *client = to_i2c_client(dev); 843 struct i2c_client *client = to_i2c_client(dev);
883 struct lm85_data *data = i2c_get_clientdata(client); 844 struct lm85_data *data = i2c_get_clientdata(client);
884 long val = simple_strtol(buf, NULL, 10); 845 long val = simple_strtol(buf, NULL, 10);
@@ -913,15 +874,20 @@ static ssize_t set_temp_auto_temp_min(struct device *dev, const char *buf,
913 mutex_unlock(&data->update_lock); 874 mutex_unlock(&data->update_lock);
914 return count; 875 return count;
915} 876}
916static ssize_t show_temp_auto_temp_max(struct device *dev, char *buf, int nr) 877
878static ssize_t show_temp_auto_temp_max(struct device *dev,
879 struct device_attribute *attr, char *buf)
917{ 880{
881 int nr = to_sensor_dev_attr(attr)->index;
918 struct lm85_data *data = lm85_update_device(dev); 882 struct lm85_data *data = lm85_update_device(dev);
919 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) + 883 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) +
920 RANGE_FROM_REG(data->zone[nr].range)); 884 RANGE_FROM_REG(data->zone[nr].range));
921} 885}
922static ssize_t set_temp_auto_temp_max(struct device *dev, const char *buf, 886
923 size_t count, int nr) 887static ssize_t set_temp_auto_temp_max(struct device *dev,
888 struct device_attribute *attr, const char *buf, size_t count)
924{ 889{
890 int nr = to_sensor_dev_attr(attr)->index;
925 struct i2c_client *client = to_i2c_client(dev); 891 struct i2c_client *client = to_i2c_client(dev);
926 struct lm85_data *data = i2c_get_clientdata(client); 892 struct lm85_data *data = i2c_get_clientdata(client);
927 int min; 893 int min;
@@ -938,14 +904,19 @@ static ssize_t set_temp_auto_temp_max(struct device *dev, const char *buf,
938 mutex_unlock(&data->update_lock); 904 mutex_unlock(&data->update_lock);
939 return count; 905 return count;
940} 906}
941static ssize_t show_temp_auto_temp_crit(struct device *dev, char *buf, int nr) 907
908static ssize_t show_temp_auto_temp_crit(struct device *dev,
909 struct device_attribute *attr, char *buf)
942{ 910{
911 int nr = to_sensor_dev_attr(attr)->index;
943 struct lm85_data *data = lm85_update_device(dev); 912 struct lm85_data *data = lm85_update_device(dev);
944 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].critical)); 913 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].critical));
945} 914}
946static ssize_t set_temp_auto_temp_crit(struct device *dev, const char *buf, 915
947 size_t count, int nr) 916static ssize_t set_temp_auto_temp_crit(struct device *dev,
917 struct device_attribute *attr,const char *buf, size_t count)
948{ 918{
919 int nr = to_sensor_dev_attr(attr)->index;
949 struct i2c_client *client = to_i2c_client(dev); 920 struct i2c_client *client = to_i2c_client(dev);
950 struct lm85_data *data = i2c_get_clientdata(client); 921 struct lm85_data *data = i2c_get_clientdata(client);
951 long val = simple_strtol(buf, NULL, 10); 922 long val = simple_strtol(buf, NULL, 10);
@@ -957,59 +928,21 @@ static ssize_t set_temp_auto_temp_crit(struct device *dev, const char *buf,
957 mutex_unlock(&data->update_lock); 928 mutex_unlock(&data->update_lock);
958 return count; 929 return count;
959} 930}
931
960#define temp_auto(offset) \ 932#define temp_auto(offset) \
961static ssize_t show_temp##offset##_auto_temp_off (struct device *dev, struct device_attribute *attr, \ 933static SENSOR_DEVICE_ATTR(temp##offset##_auto_temp_off, \
962 char *buf) \ 934 S_IRUGO | S_IWUSR, show_temp_auto_temp_off, \
963{ \ 935 set_temp_auto_temp_off, offset - 1); \
964 return show_temp_auto_temp_off(dev, buf, offset - 1); \ 936static SENSOR_DEVICE_ATTR(temp##offset##_auto_temp_min, \
965} \ 937 S_IRUGO | S_IWUSR, show_temp_auto_temp_min, \
966static ssize_t set_temp##offset##_auto_temp_off (struct device *dev, struct device_attribute *attr, \ 938 set_temp_auto_temp_min, offset - 1); \
967 const char *buf, size_t count) \ 939static SENSOR_DEVICE_ATTR(temp##offset##_auto_temp_max, \
968{ \ 940 S_IRUGO | S_IWUSR, show_temp_auto_temp_max, \
969 return set_temp_auto_temp_off(dev, buf, count, offset - 1); \ 941 set_temp_auto_temp_max, offset - 1); \
970} \ 942static SENSOR_DEVICE_ATTR(temp##offset##_auto_temp_crit, \
971static ssize_t show_temp##offset##_auto_temp_min (struct device *dev, struct device_attribute *attr, \ 943 S_IRUGO | S_IWUSR, show_temp_auto_temp_crit, \
972 char *buf) \ 944 set_temp_auto_temp_crit, offset - 1);
973{ \ 945
974 return show_temp_auto_temp_min(dev, buf, offset - 1); \
975} \
976static ssize_t set_temp##offset##_auto_temp_min (struct device *dev, struct device_attribute *attr, \
977 const char *buf, size_t count) \
978{ \
979 return set_temp_auto_temp_min(dev, buf, count, offset - 1); \
980} \
981static ssize_t show_temp##offset##_auto_temp_max (struct device *dev, struct device_attribute *attr, \
982 char *buf) \
983{ \
984 return show_temp_auto_temp_max(dev, buf, offset - 1); \
985} \
986static ssize_t set_temp##offset##_auto_temp_max (struct device *dev, struct device_attribute *attr, \
987 const char *buf, size_t count) \
988{ \
989 return set_temp_auto_temp_max(dev, buf, count, offset - 1); \
990} \
991static ssize_t show_temp##offset##_auto_temp_crit (struct device *dev, struct device_attribute *attr, \
992 char *buf) \
993{ \
994 return show_temp_auto_temp_crit(dev, buf, offset - 1); \
995} \
996static ssize_t set_temp##offset##_auto_temp_crit (struct device *dev, struct device_attribute *attr, \
997 const char *buf, size_t count) \
998{ \
999 return set_temp_auto_temp_crit(dev, buf, count, offset - 1); \
1000} \
1001static DEVICE_ATTR(temp##offset##_auto_temp_off, S_IRUGO | S_IWUSR, \
1002 show_temp##offset##_auto_temp_off, \
1003 set_temp##offset##_auto_temp_off); \
1004static DEVICE_ATTR(temp##offset##_auto_temp_min, S_IRUGO | S_IWUSR, \
1005 show_temp##offset##_auto_temp_min, \
1006 set_temp##offset##_auto_temp_min); \
1007static DEVICE_ATTR(temp##offset##_auto_temp_max, S_IRUGO | S_IWUSR, \
1008 show_temp##offset##_auto_temp_max, \
1009 set_temp##offset##_auto_temp_max); \
1010static DEVICE_ATTR(temp##offset##_auto_temp_crit, S_IRUGO | S_IWUSR, \
1011 show_temp##offset##_auto_temp_crit, \
1012 set_temp##offset##_auto_temp_crit);
1013temp_auto(1); 946temp_auto(1);
1014temp_auto(2); 947temp_auto(2);
1015temp_auto(3); 948temp_auto(3);
@@ -1022,69 +955,74 @@ static int lm85_attach_adapter(struct i2c_adapter *adapter)
1022} 955}
1023 956
1024static struct attribute *lm85_attributes[] = { 957static struct attribute *lm85_attributes[] = {
1025 &dev_attr_fan1_input.attr, 958 &sensor_dev_attr_fan1_input.dev_attr.attr,
1026 &dev_attr_fan2_input.attr, 959 &sensor_dev_attr_fan2_input.dev_attr.attr,
1027 &dev_attr_fan3_input.attr, 960 &sensor_dev_attr_fan3_input.dev_attr.attr,
1028 &dev_attr_fan4_input.attr, 961 &sensor_dev_attr_fan4_input.dev_attr.attr,
1029 &dev_attr_fan1_min.attr, 962 &sensor_dev_attr_fan1_min.dev_attr.attr,
1030 &dev_attr_fan2_min.attr, 963 &sensor_dev_attr_fan2_min.dev_attr.attr,
1031 &dev_attr_fan3_min.attr, 964 &sensor_dev_attr_fan3_min.dev_attr.attr,
1032 &dev_attr_fan4_min.attr, 965 &sensor_dev_attr_fan4_min.dev_attr.attr,
1033 &dev_attr_pwm1.attr, 966
1034 &dev_attr_pwm2.attr, 967 &sensor_dev_attr_pwm1.dev_attr.attr,
1035 &dev_attr_pwm3.attr, 968 &sensor_dev_attr_pwm2.dev_attr.attr,
1036 &dev_attr_pwm1_enable.attr, 969 &sensor_dev_attr_pwm3.dev_attr.attr,
1037 &dev_attr_pwm2_enable.attr, 970 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
1038 &dev_attr_pwm3_enable.attr, 971 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
1039 &dev_attr_in0_input.attr, 972 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
1040 &dev_attr_in1_input.attr, 973
1041 &dev_attr_in2_input.attr, 974 &sensor_dev_attr_in0_input.dev_attr.attr,
1042 &dev_attr_in3_input.attr, 975 &sensor_dev_attr_in1_input.dev_attr.attr,
1043 &dev_attr_in0_min.attr, 976 &sensor_dev_attr_in2_input.dev_attr.attr,
1044 &dev_attr_in1_min.attr, 977 &sensor_dev_attr_in3_input.dev_attr.attr,
1045 &dev_attr_in2_min.attr, 978 &sensor_dev_attr_in0_min.dev_attr.attr,
1046 &dev_attr_in3_min.attr, 979 &sensor_dev_attr_in1_min.dev_attr.attr,
1047 &dev_attr_in0_max.attr, 980 &sensor_dev_attr_in2_min.dev_attr.attr,
1048 &dev_attr_in1_max.attr, 981 &sensor_dev_attr_in3_min.dev_attr.attr,
1049 &dev_attr_in2_max.attr, 982 &sensor_dev_attr_in0_max.dev_attr.attr,
1050 &dev_attr_in3_max.attr, 983 &sensor_dev_attr_in1_max.dev_attr.attr,
1051 &dev_attr_temp1_input.attr, 984 &sensor_dev_attr_in2_max.dev_attr.attr,
1052 &dev_attr_temp2_input.attr, 985 &sensor_dev_attr_in3_max.dev_attr.attr,
1053 &dev_attr_temp3_input.attr, 986
1054 &dev_attr_temp1_min.attr, 987 &sensor_dev_attr_temp1_input.dev_attr.attr,
1055 &dev_attr_temp2_min.attr, 988 &sensor_dev_attr_temp2_input.dev_attr.attr,
1056 &dev_attr_temp3_min.attr, 989 &sensor_dev_attr_temp3_input.dev_attr.attr,
1057 &dev_attr_temp1_max.attr, 990 &sensor_dev_attr_temp1_min.dev_attr.attr,
1058 &dev_attr_temp2_max.attr, 991 &sensor_dev_attr_temp2_min.dev_attr.attr,
1059 &dev_attr_temp3_max.attr, 992 &sensor_dev_attr_temp3_min.dev_attr.attr,
993 &sensor_dev_attr_temp1_max.dev_attr.attr,
994 &sensor_dev_attr_temp2_max.dev_attr.attr,
995 &sensor_dev_attr_temp3_max.dev_attr.attr,
996
997 &sensor_dev_attr_pwm1_auto_channels.dev_attr.attr,
998 &sensor_dev_attr_pwm2_auto_channels.dev_attr.attr,
999 &sensor_dev_attr_pwm3_auto_channels.dev_attr.attr,
1000 &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr,
1001 &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr,
1002 &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr,
1003 &sensor_dev_attr_pwm1_auto_pwm_minctl.dev_attr.attr,
1004 &sensor_dev_attr_pwm2_auto_pwm_minctl.dev_attr.attr,
1005 &sensor_dev_attr_pwm3_auto_pwm_minctl.dev_attr.attr,
1006 &sensor_dev_attr_pwm1_auto_pwm_freq.dev_attr.attr,
1007 &sensor_dev_attr_pwm2_auto_pwm_freq.dev_attr.attr,
1008 &sensor_dev_attr_pwm3_auto_pwm_freq.dev_attr.attr,
1009
1010 &sensor_dev_attr_temp1_auto_temp_off.dev_attr.attr,
1011 &sensor_dev_attr_temp2_auto_temp_off.dev_attr.attr,
1012 &sensor_dev_attr_temp3_auto_temp_off.dev_attr.attr,
1013 &sensor_dev_attr_temp1_auto_temp_min.dev_attr.attr,
1014 &sensor_dev_attr_temp2_auto_temp_min.dev_attr.attr,
1015 &sensor_dev_attr_temp3_auto_temp_min.dev_attr.attr,
1016 &sensor_dev_attr_temp1_auto_temp_max.dev_attr.attr,
1017 &sensor_dev_attr_temp2_auto_temp_max.dev_attr.attr,
1018 &sensor_dev_attr_temp3_auto_temp_max.dev_attr.attr,
1019 &sensor_dev_attr_temp1_auto_temp_crit.dev_attr.attr,
1020 &sensor_dev_attr_temp2_auto_temp_crit.dev_attr.attr,
1021 &sensor_dev_attr_temp3_auto_temp_crit.dev_attr.attr,
1022
1060 &dev_attr_vrm.attr, 1023 &dev_attr_vrm.attr,
1061 &dev_attr_cpu0_vid.attr, 1024 &dev_attr_cpu0_vid.attr,
1062 &dev_attr_alarms.attr, 1025 &dev_attr_alarms.attr,
1063 &dev_attr_pwm1_auto_channels.attr,
1064 &dev_attr_pwm2_auto_channels.attr,
1065 &dev_attr_pwm3_auto_channels.attr,
1066 &dev_attr_pwm1_auto_pwm_min.attr,
1067 &dev_attr_pwm2_auto_pwm_min.attr,
1068 &dev_attr_pwm3_auto_pwm_min.attr,
1069 &dev_attr_pwm1_auto_pwm_minctl.attr,
1070 &dev_attr_pwm2_auto_pwm_minctl.attr,
1071 &dev_attr_pwm3_auto_pwm_minctl.attr,
1072 &dev_attr_pwm1_auto_pwm_freq.attr,
1073 &dev_attr_pwm2_auto_pwm_freq.attr,
1074 &dev_attr_pwm3_auto_pwm_freq.attr,
1075 &dev_attr_temp1_auto_temp_off.attr,
1076 &dev_attr_temp2_auto_temp_off.attr,
1077 &dev_attr_temp3_auto_temp_off.attr,
1078 &dev_attr_temp1_auto_temp_min.attr,
1079 &dev_attr_temp2_auto_temp_min.attr,
1080 &dev_attr_temp3_auto_temp_min.attr,
1081 &dev_attr_temp1_auto_temp_max.attr,
1082 &dev_attr_temp2_auto_temp_max.attr,
1083 &dev_attr_temp3_auto_temp_max.attr,
1084 &dev_attr_temp1_auto_temp_crit.attr,
1085 &dev_attr_temp2_auto_temp_crit.attr,
1086 &dev_attr_temp3_auto_temp_crit.attr,
1087
1088 NULL 1026 NULL
1089}; 1027};
1090 1028
@@ -1093,10 +1031,9 @@ static const struct attribute_group lm85_group = {
1093}; 1031};
1094 1032
1095static struct attribute *lm85_attributes_opt[] = { 1033static struct attribute *lm85_attributes_opt[] = {
1096 &dev_attr_in4_input.attr, 1034 &sensor_dev_attr_in4_input.dev_attr.attr,
1097 &dev_attr_in4_min.attr, 1035 &sensor_dev_attr_in4_min.dev_attr.attr,
1098 &dev_attr_in4_max.attr, 1036 &sensor_dev_attr_in4_max.dev_attr.attr,
1099
1100 NULL 1037 NULL
1101}; 1038};
1102 1039
@@ -1250,11 +1187,11 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
1250 data->vid = lm85_read_value(new_client, LM85_REG_VID); 1187 data->vid = lm85_read_value(new_client, LM85_REG_VID);
1251 if (!(kind == adt7463 && (data->vid & 0x80))) 1188 if (!(kind == adt7463 && (data->vid & 0x80)))
1252 if ((err = device_create_file(&new_client->dev, 1189 if ((err = device_create_file(&new_client->dev,
1253 &dev_attr_in4_input)) 1190 &sensor_dev_attr_in4_input.dev_attr))
1254 || (err = device_create_file(&new_client->dev, 1191 || (err = device_create_file(&new_client->dev,
1255 &dev_attr_in4_min)) 1192 &sensor_dev_attr_in4_min.dev_attr))
1256 || (err = device_create_file(&new_client->dev, 1193 || (err = device_create_file(&new_client->dev,
1257 &dev_attr_in4_max))) 1194 &sensor_dev_attr_in4_max.dev_attr)))
1258 goto ERROR3; 1195 goto ERROR3;
1259 1196
1260 data->hwmon_dev = hwmon_device_register(&new_client->dev); 1197 data->hwmon_dev = hwmon_device_register(&new_client->dev);