aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/dme1737.c
diff options
context:
space:
mode:
authorJuerg Haefliger <juergh@gmail.com>2008-08-06 16:41:03 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-08-06 16:41:03 -0400
commit73ce48f6c6b9d9dcf6a2bba0bcde39ede76809f0 (patch)
treeff5f89df634a4adb222454ca9080d49454d01507 /drivers/hwmon/dme1737.c
parent0967d61ea0d8e8a7826bd8949cd93dd1e829ac55 (diff)
hwmon: (dme1737) Cleanups
Fix names of attribute structs to make them more consistent with the rest of the code. Minor comment changes. Signed-off-by: Juerg Haefliger <juergh at gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/dme1737.c')
-rw-r--r--drivers/hwmon/dme1737.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index 5e2cf0aef480..9635fa6014fc 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -1166,7 +1166,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
1166 return sprintf(buf, "%d\n", res); 1166 return sprintf(buf, "%d\n", res);
1167} 1167}
1168 1168
1169static struct attribute *dme1737_attr_pwm[]; 1169static struct attribute *dme1737_pwm_chmod_attr[];
1170static void dme1737_chmod_file(struct device*, struct attribute*, mode_t); 1170static void dme1737_chmod_file(struct device*, struct attribute*, mode_t);
1171 1171
1172static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, 1172static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
@@ -1230,7 +1230,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
1230 switch (val) { 1230 switch (val) {
1231 case 0: 1231 case 0:
1232 /* Change permissions of pwm[ix] to read-only */ 1232 /* Change permissions of pwm[ix] to read-only */
1233 dme1737_chmod_file(dev, dme1737_attr_pwm[ix], 1233 dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
1234 S_IRUGO); 1234 S_IRUGO);
1235 /* Turn fan fully on */ 1235 /* Turn fan fully on */
1236 data->pwm_config[ix] = PWM_EN_TO_REG(0, 1236 data->pwm_config[ix] = PWM_EN_TO_REG(0,
@@ -1245,12 +1245,12 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
1245 dme1737_write(client, DME1737_REG_PWM_CONFIG(ix), 1245 dme1737_write(client, DME1737_REG_PWM_CONFIG(ix),
1246 data->pwm_config[ix]); 1246 data->pwm_config[ix]);
1247 /* Change permissions of pwm[ix] to read-writeable */ 1247 /* Change permissions of pwm[ix] to read-writeable */
1248 dme1737_chmod_file(dev, dme1737_attr_pwm[ix], 1248 dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
1249 S_IRUGO | S_IWUSR); 1249 S_IRUGO | S_IWUSR);
1250 break; 1250 break;
1251 case 2: 1251 case 2:
1252 /* Change permissions of pwm[ix] to read-only */ 1252 /* Change permissions of pwm[ix] to read-only */
1253 dme1737_chmod_file(dev, dme1737_attr_pwm[ix], 1253 dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
1254 S_IRUGO); 1254 S_IRUGO);
1255 /* Turn on auto mode using the saved zone channel 1255 /* Turn on auto mode using the saved zone channel
1256 * assignment */ 1256 * assignment */
@@ -1612,7 +1612,7 @@ static const struct attribute_group dme1737_group = {
1612/* The following structs hold the PWM attributes, some of which are optional. 1612/* The following structs hold the PWM attributes, some of which are optional.
1613 * Their creation depends on the chip configuration which is determined during 1613 * Their creation depends on the chip configuration which is determined during
1614 * module load. */ 1614 * module load. */
1615static struct attribute *dme1737_attr_pwm1[] = { 1615static struct attribute *dme1737_pwm1_attr[] = {
1616 &sensor_dev_attr_pwm1.dev_attr.attr, 1616 &sensor_dev_attr_pwm1.dev_attr.attr,
1617 &sensor_dev_attr_pwm1_freq.dev_attr.attr, 1617 &sensor_dev_attr_pwm1_freq.dev_attr.attr,
1618 &sensor_dev_attr_pwm1_enable.dev_attr.attr, 1618 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
@@ -1623,7 +1623,7 @@ static struct attribute *dme1737_attr_pwm1[] = {
1623 &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, 1623 &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
1624 NULL 1624 NULL
1625}; 1625};
1626static struct attribute *dme1737_attr_pwm2[] = { 1626static struct attribute *dme1737_pwm2_attr[] = {
1627 &sensor_dev_attr_pwm2.dev_attr.attr, 1627 &sensor_dev_attr_pwm2.dev_attr.attr,
1628 &sensor_dev_attr_pwm2_freq.dev_attr.attr, 1628 &sensor_dev_attr_pwm2_freq.dev_attr.attr,
1629 &sensor_dev_attr_pwm2_enable.dev_attr.attr, 1629 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
@@ -1634,7 +1634,7 @@ static struct attribute *dme1737_attr_pwm2[] = {
1634 &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, 1634 &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr,
1635 NULL 1635 NULL
1636}; 1636};
1637static struct attribute *dme1737_attr_pwm3[] = { 1637static struct attribute *dme1737_pwm3_attr[] = {
1638 &sensor_dev_attr_pwm3.dev_attr.attr, 1638 &sensor_dev_attr_pwm3.dev_attr.attr,
1639 &sensor_dev_attr_pwm3_freq.dev_attr.attr, 1639 &sensor_dev_attr_pwm3_freq.dev_attr.attr,
1640 &sensor_dev_attr_pwm3_enable.dev_attr.attr, 1640 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
@@ -1645,13 +1645,13 @@ static struct attribute *dme1737_attr_pwm3[] = {
1645 &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, 1645 &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr,
1646 NULL 1646 NULL
1647}; 1647};
1648static struct attribute *dme1737_attr_pwm5[] = { 1648static struct attribute *dme1737_pwm5_attr[] = {
1649 &sensor_dev_attr_pwm5.dev_attr.attr, 1649 &sensor_dev_attr_pwm5.dev_attr.attr,
1650 &sensor_dev_attr_pwm5_freq.dev_attr.attr, 1650 &sensor_dev_attr_pwm5_freq.dev_attr.attr,
1651 &sensor_dev_attr_pwm5_enable.dev_attr.attr, 1651 &sensor_dev_attr_pwm5_enable.dev_attr.attr,
1652 NULL 1652 NULL
1653}; 1653};
1654static struct attribute *dme1737_attr_pwm6[] = { 1654static struct attribute *dme1737_pwm6_attr[] = {
1655 &sensor_dev_attr_pwm6.dev_attr.attr, 1655 &sensor_dev_attr_pwm6.dev_attr.attr,
1656 &sensor_dev_attr_pwm6_freq.dev_attr.attr, 1656 &sensor_dev_attr_pwm6_freq.dev_attr.attr,
1657 &sensor_dev_attr_pwm6_enable.dev_attr.attr, 1657 &sensor_dev_attr_pwm6_enable.dev_attr.attr,
@@ -1659,53 +1659,53 @@ static struct attribute *dme1737_attr_pwm6[] = {
1659}; 1659};
1660 1660
1661static const struct attribute_group dme1737_pwm_group[] = { 1661static const struct attribute_group dme1737_pwm_group[] = {
1662 { .attrs = dme1737_attr_pwm1 }, 1662 { .attrs = dme1737_pwm1_attr },
1663 { .attrs = dme1737_attr_pwm2 }, 1663 { .attrs = dme1737_pwm2_attr },
1664 { .attrs = dme1737_attr_pwm3 }, 1664 { .attrs = dme1737_pwm3_attr },
1665 { .attrs = NULL }, 1665 { .attrs = NULL },
1666 { .attrs = dme1737_attr_pwm5 }, 1666 { .attrs = dme1737_pwm5_attr },
1667 { .attrs = dme1737_attr_pwm6 }, 1667 { .attrs = dme1737_pwm6_attr },
1668}; 1668};
1669 1669
1670/* The following structs hold the fan attributes, some of which are optional. 1670/* The following structs hold the fan attributes, some of which are optional.
1671 * Their creation depends on the chip configuration which is determined during 1671 * Their creation depends on the chip configuration which is determined during
1672 * module load. */ 1672 * module load. */
1673static struct attribute *dme1737_attr_fan1[] = { 1673static struct attribute *dme1737_fan1_attr[] = {
1674 &sensor_dev_attr_fan1_input.dev_attr.attr, 1674 &sensor_dev_attr_fan1_input.dev_attr.attr,
1675 &sensor_dev_attr_fan1_min.dev_attr.attr, 1675 &sensor_dev_attr_fan1_min.dev_attr.attr,
1676 &sensor_dev_attr_fan1_alarm.dev_attr.attr, 1676 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
1677 &sensor_dev_attr_fan1_type.dev_attr.attr, 1677 &sensor_dev_attr_fan1_type.dev_attr.attr,
1678 NULL 1678 NULL
1679}; 1679};
1680static struct attribute *dme1737_attr_fan2[] = { 1680static struct attribute *dme1737_fan2_attr[] = {
1681 &sensor_dev_attr_fan2_input.dev_attr.attr, 1681 &sensor_dev_attr_fan2_input.dev_attr.attr,
1682 &sensor_dev_attr_fan2_min.dev_attr.attr, 1682 &sensor_dev_attr_fan2_min.dev_attr.attr,
1683 &sensor_dev_attr_fan2_alarm.dev_attr.attr, 1683 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
1684 &sensor_dev_attr_fan2_type.dev_attr.attr, 1684 &sensor_dev_attr_fan2_type.dev_attr.attr,
1685 NULL 1685 NULL
1686}; 1686};
1687static struct attribute *dme1737_attr_fan3[] = { 1687static struct attribute *dme1737_fan3_attr[] = {
1688 &sensor_dev_attr_fan3_input.dev_attr.attr, 1688 &sensor_dev_attr_fan3_input.dev_attr.attr,
1689 &sensor_dev_attr_fan3_min.dev_attr.attr, 1689 &sensor_dev_attr_fan3_min.dev_attr.attr,
1690 &sensor_dev_attr_fan3_alarm.dev_attr.attr, 1690 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
1691 &sensor_dev_attr_fan3_type.dev_attr.attr, 1691 &sensor_dev_attr_fan3_type.dev_attr.attr,
1692 NULL 1692 NULL
1693}; 1693};
1694static struct attribute *dme1737_attr_fan4[] = { 1694static struct attribute *dme1737_fan4_attr[] = {
1695 &sensor_dev_attr_fan4_input.dev_attr.attr, 1695 &sensor_dev_attr_fan4_input.dev_attr.attr,
1696 &sensor_dev_attr_fan4_min.dev_attr.attr, 1696 &sensor_dev_attr_fan4_min.dev_attr.attr,
1697 &sensor_dev_attr_fan4_alarm.dev_attr.attr, 1697 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
1698 &sensor_dev_attr_fan4_type.dev_attr.attr, 1698 &sensor_dev_attr_fan4_type.dev_attr.attr,
1699 NULL 1699 NULL
1700}; 1700};
1701static struct attribute *dme1737_attr_fan5[] = { 1701static struct attribute *dme1737_fan5_attr[] = {
1702 &sensor_dev_attr_fan5_input.dev_attr.attr, 1702 &sensor_dev_attr_fan5_input.dev_attr.attr,
1703 &sensor_dev_attr_fan5_min.dev_attr.attr, 1703 &sensor_dev_attr_fan5_min.dev_attr.attr,
1704 &sensor_dev_attr_fan5_alarm.dev_attr.attr, 1704 &sensor_dev_attr_fan5_alarm.dev_attr.attr,
1705 &sensor_dev_attr_fan5_max.dev_attr.attr, 1705 &sensor_dev_attr_fan5_max.dev_attr.attr,
1706 NULL 1706 NULL
1707}; 1707};
1708static struct attribute *dme1737_attr_fan6[] = { 1708static struct attribute *dme1737_fan6_attr[] = {
1709 &sensor_dev_attr_fan6_input.dev_attr.attr, 1709 &sensor_dev_attr_fan6_input.dev_attr.attr,
1710 &sensor_dev_attr_fan6_min.dev_attr.attr, 1710 &sensor_dev_attr_fan6_min.dev_attr.attr,
1711 &sensor_dev_attr_fan6_alarm.dev_attr.attr, 1711 &sensor_dev_attr_fan6_alarm.dev_attr.attr,
@@ -1714,17 +1714,17 @@ static struct attribute *dme1737_attr_fan6[] = {
1714}; 1714};
1715 1715
1716static const struct attribute_group dme1737_fan_group[] = { 1716static const struct attribute_group dme1737_fan_group[] = {
1717 { .attrs = dme1737_attr_fan1 }, 1717 { .attrs = dme1737_fan1_attr },
1718 { .attrs = dme1737_attr_fan2 }, 1718 { .attrs = dme1737_fan2_attr },
1719 { .attrs = dme1737_attr_fan3 }, 1719 { .attrs = dme1737_fan3_attr },
1720 { .attrs = dme1737_attr_fan4 }, 1720 { .attrs = dme1737_fan4_attr },
1721 { .attrs = dme1737_attr_fan5 }, 1721 { .attrs = dme1737_fan5_attr },
1722 { .attrs = dme1737_attr_fan6 }, 1722 { .attrs = dme1737_fan6_attr },
1723}; 1723};
1724 1724
1725/* The permissions of all of the following attributes are changed to read- 1725/* The permissions of all of the following attributes are changed to read-
1726 * writeable if the chip is *not* locked. Otherwise they stay read-only. */ 1726 * writeable if the chip is *not* locked. Otherwise they stay read-only. */
1727static struct attribute *dme1737_attr_lock[] = { 1727static struct attribute *dme1737_misc_chmod_attr[] = {
1728 /* Temperatures */ 1728 /* Temperatures */
1729 &sensor_dev_attr_temp1_offset.dev_attr.attr, 1729 &sensor_dev_attr_temp1_offset.dev_attr.attr,
1730 &sensor_dev_attr_temp2_offset.dev_attr.attr, 1730 &sensor_dev_attr_temp2_offset.dev_attr.attr,
@@ -1745,14 +1745,14 @@ static struct attribute *dme1737_attr_lock[] = {
1745 NULL 1745 NULL
1746}; 1746};
1747 1747
1748static const struct attribute_group dme1737_lock_group = { 1748static const struct attribute_group dme1737_misc_chmod_group = {
1749 .attrs = dme1737_attr_lock, 1749 .attrs = dme1737_misc_chmod_attr,
1750}; 1750};
1751 1751
1752/* The permissions of the following PWM attributes are changed to read- 1752/* The permissions of the following PWM attributes are changed to read-
1753 * writeable if the chip is *not* locked and the respective PWM is available. 1753 * writeable if the chip is *not* locked and the respective PWM is available.
1754 * Otherwise they stay read-only. */ 1754 * Otherwise they stay read-only. */
1755static struct attribute *dme1737_attr_pwm1_lock[] = { 1755static struct attribute *dme1737_pwm1_chmod_attr[] = {
1756 &sensor_dev_attr_pwm1_freq.dev_attr.attr, 1756 &sensor_dev_attr_pwm1_freq.dev_attr.attr,
1757 &sensor_dev_attr_pwm1_enable.dev_attr.attr, 1757 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
1758 &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr, 1758 &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr,
@@ -1761,7 +1761,7 @@ static struct attribute *dme1737_attr_pwm1_lock[] = {
1761 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, 1761 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
1762 NULL 1762 NULL
1763}; 1763};
1764static struct attribute *dme1737_attr_pwm2_lock[] = { 1764static struct attribute *dme1737_pwm2_chmod_attr[] = {
1765 &sensor_dev_attr_pwm2_freq.dev_attr.attr, 1765 &sensor_dev_attr_pwm2_freq.dev_attr.attr,
1766 &sensor_dev_attr_pwm2_enable.dev_attr.attr, 1766 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
1767 &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr, 1767 &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr,
@@ -1770,7 +1770,7 @@ static struct attribute *dme1737_attr_pwm2_lock[] = {
1770 &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, 1770 &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
1771 NULL 1771 NULL
1772}; 1772};
1773static struct attribute *dme1737_attr_pwm3_lock[] = { 1773static struct attribute *dme1737_pwm3_chmod_attr[] = {
1774 &sensor_dev_attr_pwm3_freq.dev_attr.attr, 1774 &sensor_dev_attr_pwm3_freq.dev_attr.attr,
1775 &sensor_dev_attr_pwm3_enable.dev_attr.attr, 1775 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
1776 &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr, 1776 &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr,
@@ -1779,29 +1779,29 @@ static struct attribute *dme1737_attr_pwm3_lock[] = {
1779 &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, 1779 &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
1780 NULL 1780 NULL
1781}; 1781};
1782static struct attribute *dme1737_attr_pwm5_lock[] = { 1782static struct attribute *dme1737_pwm5_chmod_attr[] = {
1783 &sensor_dev_attr_pwm5.dev_attr.attr, 1783 &sensor_dev_attr_pwm5.dev_attr.attr,
1784 &sensor_dev_attr_pwm5_freq.dev_attr.attr, 1784 &sensor_dev_attr_pwm5_freq.dev_attr.attr,
1785 NULL 1785 NULL
1786}; 1786};
1787static struct attribute *dme1737_attr_pwm6_lock[] = { 1787static struct attribute *dme1737_pwm6_chmod_attr[] = {
1788 &sensor_dev_attr_pwm6.dev_attr.attr, 1788 &sensor_dev_attr_pwm6.dev_attr.attr,
1789 &sensor_dev_attr_pwm6_freq.dev_attr.attr, 1789 &sensor_dev_attr_pwm6_freq.dev_attr.attr,
1790 NULL 1790 NULL
1791}; 1791};
1792 1792
1793static const struct attribute_group dme1737_pwm_lock_group[] = { 1793static const struct attribute_group dme1737_pwm_chmod_group[] = {
1794 { .attrs = dme1737_attr_pwm1_lock }, 1794 { .attrs = dme1737_pwm1_chmod_attr },
1795 { .attrs = dme1737_attr_pwm2_lock }, 1795 { .attrs = dme1737_pwm2_chmod_attr },
1796 { .attrs = dme1737_attr_pwm3_lock }, 1796 { .attrs = dme1737_pwm3_chmod_attr },
1797 { .attrs = NULL }, 1797 { .attrs = NULL },
1798 { .attrs = dme1737_attr_pwm5_lock }, 1798 { .attrs = dme1737_pwm5_chmod_attr },
1799 { .attrs = dme1737_attr_pwm6_lock }, 1799 { .attrs = dme1737_pwm6_chmod_attr },
1800}; 1800};
1801 1801
1802/* Pwm[1-3] are read-writeable if the associated pwm is in manual mode and the 1802/* Pwm[1-3] are read-writeable if the associated pwm is in manual mode and the
1803 * chip is not locked. Otherwise they are read-only. */ 1803 * chip is not locked. Otherwise they are read-only. */
1804static struct attribute *dme1737_attr_pwm[] = { 1804static struct attribute *dme1737_pwm_chmod_attr[] = {
1805 &sensor_dev_attr_pwm1.dev_attr.attr, 1805 &sensor_dev_attr_pwm1.dev_attr.attr,
1806 &sensor_dev_attr_pwm2.dev_attr.attr, 1806 &sensor_dev_attr_pwm2.dev_attr.attr,
1807 &sensor_dev_attr_pwm3.dev_attr.attr, 1807 &sensor_dev_attr_pwm3.dev_attr.attr,
@@ -1927,15 +1927,15 @@ static int dme1737_create_files(struct device *dev)
1927 dev_info(dev, "Device is locked. Some attributes " 1927 dev_info(dev, "Device is locked. Some attributes "
1928 "will be read-only.\n"); 1928 "will be read-only.\n");
1929 } else { 1929 } else {
1930 /* Change permissions of standard attributes */ 1930 /* Change permissions of standard sysfs attributes */
1931 dme1737_chmod_group(dev, &dme1737_lock_group, 1931 dme1737_chmod_group(dev, &dme1737_misc_chmod_group,
1932 S_IRUGO | S_IWUSR); 1932 S_IRUGO | S_IWUSR);
1933 1933
1934 /* Change permissions of PWM attributes */ 1934 /* Change permissions of PWM sysfs attributes */
1935 for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_lock_group); ix++) { 1935 for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_chmod_group); ix++) {
1936 if (data->has_pwm & (1 << ix)) { 1936 if (data->has_pwm & (1 << ix)) {
1937 dme1737_chmod_group(dev, 1937 dme1737_chmod_group(dev,
1938 &dme1737_pwm_lock_group[ix], 1938 &dme1737_pwm_chmod_group[ix],
1939 S_IRUGO | S_IWUSR); 1939 S_IRUGO | S_IWUSR);
1940 } 1940 }
1941 } 1941 }
@@ -1945,7 +1945,7 @@ static int dme1737_create_files(struct device *dev)
1945 if ((data->has_pwm & (1 << ix)) && 1945 if ((data->has_pwm & (1 << ix)) &&
1946 (PWM_EN_FROM_REG(data->pwm_config[ix]) == 1)) { 1946 (PWM_EN_FROM_REG(data->pwm_config[ix]) == 1)) {
1947 dme1737_chmod_file(dev, 1947 dme1737_chmod_file(dev,
1948 dme1737_attr_pwm[ix], 1948 dme1737_pwm_chmod_attr[ix],
1949 S_IRUGO | S_IWUSR); 1949 S_IRUGO | S_IWUSR);
1950 } 1950 }
1951 } 1951 }