aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83795.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:46 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:46 -0400
commitb2cc528e5838d744892b30c5104bd872a439088f (patch)
tree27f3a0718da764b23addbc99e06487dc0918ac83 /drivers/hwmon/w83795.c
parentb5f6a90a0bbedc07a0b0b82b83aa716c7203fcd2 (diff)
hwmon: (w83795) Only create fan[1-8]_target files when needed
Only create fan[1-8]_target files when the fan in question can be controlled (PWM output is present.) Also name these files according to the standard. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r--drivers/hwmon/w83795.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index 76e89c7bc465..00d64b0c200f 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -1482,11 +1482,9 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
1482 SENSOR_ATTR_2(fan##index##_div, S_IWUSR | S_IRUGO, \ 1482 SENSOR_ATTR_2(fan##index##_div, S_IWUSR | S_IRUGO, \
1483 show_pwm, store_pwm, PWM_DIV, index - 1), \ 1483 show_pwm, store_pwm, PWM_DIV, index - 1), \
1484 SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \ 1484 SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \
1485 show_pwm_enable, store_pwm_enable, NOT_USED, index - 1) } 1485 show_pwm_enable, store_pwm_enable, NOT_USED, index - 1), \
1486 1486 SENSOR_ATTR_2(fan##index##_target, S_IWUSR | S_IRUGO, \
1487#define SENSOR_ATTR_FANIN_TARGET(index) \ 1487 show_fanin, store_fanin, FANIN_TARGET, index - 1) }
1488 SENSOR_ATTR_2(speed_cruise##index##_target, S_IWUSR | S_IRUGO, \
1489 show_fanin, store_fanin, FANIN_TARGET, index - 1)
1490 1488
1491#define SENSOR_ATTR_DTS(index) { \ 1489#define SENSOR_ATTR_DTS(index) { \
1492 SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \ 1490 SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \
@@ -1632,18 +1630,7 @@ static struct sensor_device_attribute_2 w83795_dts[][8] = {
1632 SENSOR_ATTR_DTS(14), 1630 SENSOR_ATTR_DTS(14),
1633}; 1631};
1634 1632
1635static struct sensor_device_attribute_2 w83795_static[] = { 1633static struct sensor_device_attribute_2 w83795_pwm[][7] = {
1636 SENSOR_ATTR_FANIN_TARGET(1),
1637 SENSOR_ATTR_FANIN_TARGET(2),
1638 SENSOR_ATTR_FANIN_TARGET(3),
1639 SENSOR_ATTR_FANIN_TARGET(4),
1640 SENSOR_ATTR_FANIN_TARGET(5),
1641 SENSOR_ATTR_FANIN_TARGET(6),
1642 SENSOR_ATTR_FANIN_TARGET(7),
1643 SENSOR_ATTR_FANIN_TARGET(8),
1644};
1645
1646static struct sensor_device_attribute_2 w83795_pwm[][6] = {
1647 SENSOR_ATTR_PWM(1), 1634 SENSOR_ATTR_PWM(1),
1648 SENSOR_ATTR_PWM(2), 1635 SENSOR_ATTR_PWM(2),
1649 SENSOR_ATTR_PWM(3), 1636 SENSOR_ATTR_PWM(3),
@@ -1837,12 +1824,6 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *,
1837 } 1824 }
1838 } 1825 }
1839 1826
1840 for (i = 0; i < ARRAY_SIZE(w83795_static); i++) {
1841 err = fn(dev, &w83795_static[i].dev_attr);
1842 if (err)
1843 return err;
1844 }
1845
1846 return 0; 1827 return 0;
1847} 1828}
1848 1829