diff options
author | Guenter Roeck <linux@roeck-us.net> | 2014-06-21 11:08:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-09 19:41:36 -0400 |
commit | b12ce5f24da12fbd4d9e903e5f8f5236eae8707a (patch) | |
tree | e2adfec6c36512c5f03ec94e22c23e716fe3fda3 /drivers/char | |
parent | 3915fc87dee83947f219f9347d47674f48c8c022 (diff) |
i8k: Drop all labels
Labels are known to be wrong for several Dell laptops.
For example, a single fan may be shown as right fan when in reality
it sits on the left side of the chassis. Drop all labels to avoid
such inaccuracies. Users can select labels in the sensors configuration
file instead if desired.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: Andreas Mohr <andi@lisas.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/i8k.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index d915707d2ba1..3dc1a724ecc2 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -542,20 +542,6 @@ static ssize_t i8k_hwmon_set_pwm(struct device *dev, | |||
542 | return err < 0 ? -EIO : count; | 542 | return err < 0 ? -EIO : count; |
543 | } | 543 | } |
544 | 544 | ||
545 | static ssize_t i8k_hwmon_show_label(struct device *dev, | ||
546 | struct device_attribute *devattr, | ||
547 | char *buf) | ||
548 | { | ||
549 | static const char *labels[3] = { | ||
550 | "CPU", | ||
551 | "Left Fan", | ||
552 | "Right Fan", | ||
553 | }; | ||
554 | int index = to_sensor_dev_attr(devattr)->index; | ||
555 | |||
556 | return sprintf(buf, "%s\n", labels[index]); | ||
557 | } | ||
558 | |||
559 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 0); | 545 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 0); |
560 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 1); | 546 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 1); |
561 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 2); | 547 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 2); |
@@ -568,41 +554,34 @@ static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, i8k_hwmon_show_fan, NULL, | |||
568 | I8K_FAN_RIGHT); | 554 | I8K_FAN_RIGHT); |
569 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, i8k_hwmon_show_pwm, | 555 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, i8k_hwmon_show_pwm, |
570 | i8k_hwmon_set_pwm, I8K_FAN_RIGHT); | 556 | i8k_hwmon_set_pwm, I8K_FAN_RIGHT); |
571 | static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, i8k_hwmon_show_label, NULL, 0); | ||
572 | static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, i8k_hwmon_show_label, NULL, 1); | ||
573 | static SENSOR_DEVICE_ATTR(fan2_label, S_IRUGO, i8k_hwmon_show_label, NULL, 2); | ||
574 | 557 | ||
575 | static struct attribute *i8k_attrs[] = { | 558 | static struct attribute *i8k_attrs[] = { |
576 | &sensor_dev_attr_temp1_input.dev_attr.attr, /* 0 */ | 559 | &sensor_dev_attr_temp1_input.dev_attr.attr, /* 0 */ |
577 | &sensor_dev_attr_temp1_label.dev_attr.attr, /* 1 */ | 560 | &sensor_dev_attr_temp2_input.dev_attr.attr, /* 1 */ |
578 | &sensor_dev_attr_temp2_input.dev_attr.attr, /* 2 */ | 561 | &sensor_dev_attr_temp3_input.dev_attr.attr, /* 2 */ |
579 | &sensor_dev_attr_temp3_input.dev_attr.attr, /* 3 */ | 562 | &sensor_dev_attr_temp4_input.dev_attr.attr, /* 3 */ |
580 | &sensor_dev_attr_temp4_input.dev_attr.attr, /* 4 */ | 563 | &sensor_dev_attr_fan1_input.dev_attr.attr, /* 4 */ |
581 | &sensor_dev_attr_fan1_input.dev_attr.attr, /* 5 */ | 564 | &sensor_dev_attr_pwm1.dev_attr.attr, /* 5 */ |
582 | &sensor_dev_attr_pwm1.dev_attr.attr, /* 6 */ | 565 | &sensor_dev_attr_fan2_input.dev_attr.attr, /* 6 */ |
583 | &sensor_dev_attr_fan1_label.dev_attr.attr, /* 7 */ | 566 | &sensor_dev_attr_pwm2.dev_attr.attr, /* 7 */ |
584 | &sensor_dev_attr_fan2_input.dev_attr.attr, /* 8 */ | ||
585 | &sensor_dev_attr_pwm2.dev_attr.attr, /* 9 */ | ||
586 | &sensor_dev_attr_fan2_label.dev_attr.attr, /* 10 */ | ||
587 | NULL | 567 | NULL |
588 | }; | 568 | }; |
589 | 569 | ||
590 | static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr, | 570 | static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr, |
591 | int index) | 571 | int index) |
592 | { | 572 | { |
593 | if ((index == 0 || index == 1) && | 573 | if (index == 0 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP1)) |
594 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP1)) | ||
595 | return 0; | 574 | return 0; |
596 | if (index == 2 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP2)) | 575 | if (index == 1 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP2)) |
597 | return 0; | 576 | return 0; |
598 | if (index == 3 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP3)) | 577 | if (index == 2 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP3)) |
599 | return 0; | 578 | return 0; |
600 | if (index == 4 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP4)) | 579 | if (index == 3 && !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP4)) |
601 | return 0; | 580 | return 0; |
602 | if (index >= 5 && index <= 7 && | 581 | if (index >= 4 && index <= 5 && |
603 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN1)) | 582 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN1)) |
604 | return 0; | 583 | return 0; |
605 | if (index >= 8 && index <= 10 && | 584 | if (index >= 6 && index <= 7 && |
606 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN2)) | 585 | !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN2)) |
607 | return 0; | 586 | return 0; |
608 | 587 | ||