diff options
author | Azael Avalos <coproscefalo@gmail.com> | 2015-02-11 01:44:00 -0500 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2015-02-12 00:17:19 -0500 |
commit | 0c3c0f10d4396a3d3dc9d7432102d5437b181487 (patch) | |
tree | 3f1f816948c2c64801091ad4518141bea581f86a /drivers/platform/x86 | |
parent | 9d3098481934a421ce8b1ce230d22e49f38a2a0b (diff) |
toshiba_acpi: Make use of DEVICE_ATTR_{RO, RW} macros
This patch makes use of the DEVICE_ATTR_{RO, RW} macros to simplify
sysfs attributes declarations.
Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index f66e0aa63d84..1cfc44324514 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1681,6 +1681,7 @@ static ssize_t version_show(struct device *dev, | |||
1681 | { | 1681 | { |
1682 | return sprintf(buf, "%s\n", TOSHIBA_ACPI_VERSION); | 1682 | return sprintf(buf, "%s\n", TOSHIBA_ACPI_VERSION); |
1683 | } | 1683 | } |
1684 | static DEVICE_ATTR_RO(version); | ||
1684 | 1685 | ||
1685 | static ssize_t fan_store(struct device *dev, | 1686 | static ssize_t fan_store(struct device *dev, |
1686 | struct device_attribute *attr, | 1687 | struct device_attribute *attr, |
@@ -1720,6 +1721,7 @@ static ssize_t fan_show(struct device *dev, | |||
1720 | 1721 | ||
1721 | return sprintf(buf, "%d\n", value); | 1722 | return sprintf(buf, "%d\n", value); |
1722 | } | 1723 | } |
1724 | static DEVICE_ATTR_RW(fan); | ||
1723 | 1725 | ||
1724 | static ssize_t kbd_backlight_mode_store(struct device *dev, | 1726 | static ssize_t kbd_backlight_mode_store(struct device *dev, |
1725 | struct device_attribute *attr, | 1727 | struct device_attribute *attr, |
@@ -1790,6 +1792,7 @@ static ssize_t kbd_backlight_mode_show(struct device *dev, | |||
1790 | 1792 | ||
1791 | return sprintf(buf, "%i\n", time & SCI_KBD_MODE_MASK); | 1793 | return sprintf(buf, "%i\n", time & SCI_KBD_MODE_MASK); |
1792 | } | 1794 | } |
1795 | static DEVICE_ATTR_RW(kbd_backlight_mode); | ||
1793 | 1796 | ||
1794 | static ssize_t kbd_type_show(struct device *dev, | 1797 | static ssize_t kbd_type_show(struct device *dev, |
1795 | struct device_attribute *attr, char *buf) | 1798 | struct device_attribute *attr, char *buf) |
@@ -1798,6 +1801,7 @@ static ssize_t kbd_type_show(struct device *dev, | |||
1798 | 1801 | ||
1799 | return sprintf(buf, "%d\n", toshiba->kbd_type); | 1802 | return sprintf(buf, "%d\n", toshiba->kbd_type); |
1800 | } | 1803 | } |
1804 | static DEVICE_ATTR_RO(kbd_type); | ||
1801 | 1805 | ||
1802 | static ssize_t available_kbd_modes_show(struct device *dev, | 1806 | static ssize_t available_kbd_modes_show(struct device *dev, |
1803 | struct device_attribute *attr, | 1807 | struct device_attribute *attr, |
@@ -1812,6 +1816,7 @@ static ssize_t available_kbd_modes_show(struct device *dev, | |||
1812 | return sprintf(buf, "%x %x %x\n", | 1816 | return sprintf(buf, "%x %x %x\n", |
1813 | SCI_KBD_MODE_AUTO, SCI_KBD_MODE_ON, SCI_KBD_MODE_OFF); | 1817 | SCI_KBD_MODE_AUTO, SCI_KBD_MODE_ON, SCI_KBD_MODE_OFF); |
1814 | } | 1818 | } |
1819 | static DEVICE_ATTR_RO(available_kbd_modes); | ||
1815 | 1820 | ||
1816 | static ssize_t kbd_backlight_timeout_store(struct device *dev, | 1821 | static ssize_t kbd_backlight_timeout_store(struct device *dev, |
1817 | struct device_attribute *attr, | 1822 | struct device_attribute *attr, |
@@ -1868,6 +1873,7 @@ static ssize_t kbd_backlight_timeout_show(struct device *dev, | |||
1868 | 1873 | ||
1869 | return sprintf(buf, "%i\n", time >> HCI_MISC_SHIFT); | 1874 | return sprintf(buf, "%i\n", time >> HCI_MISC_SHIFT); |
1870 | } | 1875 | } |
1876 | static DEVICE_ATTR_RW(kbd_backlight_timeout); | ||
1871 | 1877 | ||
1872 | static ssize_t touchpad_store(struct device *dev, | 1878 | static ssize_t touchpad_store(struct device *dev, |
1873 | struct device_attribute *attr, | 1879 | struct device_attribute *attr, |
@@ -1904,6 +1910,7 @@ static ssize_t touchpad_show(struct device *dev, | |||
1904 | 1910 | ||
1905 | return sprintf(buf, "%i\n", state); | 1911 | return sprintf(buf, "%i\n", state); |
1906 | } | 1912 | } |
1913 | static DEVICE_ATTR_RW(touchpad); | ||
1907 | 1914 | ||
1908 | static ssize_t position_show(struct device *dev, | 1915 | static ssize_t position_show(struct device *dev, |
1909 | struct device_attribute *attr, char *buf) | 1916 | struct device_attribute *attr, char *buf) |
@@ -1925,6 +1932,7 @@ static ssize_t position_show(struct device *dev, | |||
1925 | 1932 | ||
1926 | return sprintf(buf, "%d %d %d\n", x, y, z); | 1933 | return sprintf(buf, "%d %d %d\n", x, y, z); |
1927 | } | 1934 | } |
1935 | static DEVICE_ATTR_RO(position); | ||
1928 | 1936 | ||
1929 | static ssize_t usb_sleep_charge_show(struct device *dev, | 1937 | static ssize_t usb_sleep_charge_show(struct device *dev, |
1930 | struct device_attribute *attr, char *buf) | 1938 | struct device_attribute *attr, char *buf) |
@@ -1974,6 +1982,7 @@ static ssize_t usb_sleep_charge_store(struct device *dev, | |||
1974 | 1982 | ||
1975 | return count; | 1983 | return count; |
1976 | } | 1984 | } |
1985 | static DEVICE_ATTR_RW(usb_sleep_charge); | ||
1977 | 1986 | ||
1978 | static ssize_t sleep_functions_on_battery_show(struct device *dev, | 1987 | static ssize_t sleep_functions_on_battery_show(struct device *dev, |
1979 | struct device_attribute *attr, | 1988 | struct device_attribute *attr, |
@@ -2035,6 +2044,7 @@ static ssize_t sleep_functions_on_battery_store(struct device *dev, | |||
2035 | 2044 | ||
2036 | return count; | 2045 | return count; |
2037 | } | 2046 | } |
2047 | static DEVICE_ATTR_RW(sleep_functions_on_battery); | ||
2038 | 2048 | ||
2039 | static ssize_t usb_rapid_charge_show(struct device *dev, | 2049 | static ssize_t usb_rapid_charge_show(struct device *dev, |
2040 | struct device_attribute *attr, char *buf) | 2050 | struct device_attribute *attr, char *buf) |
@@ -2070,6 +2080,7 @@ static ssize_t usb_rapid_charge_store(struct device *dev, | |||
2070 | 2080 | ||
2071 | return count; | 2081 | return count; |
2072 | } | 2082 | } |
2083 | static DEVICE_ATTR_RW(usb_rapid_charge); | ||
2073 | 2084 | ||
2074 | static ssize_t usb_sleep_music_show(struct device *dev, | 2085 | static ssize_t usb_sleep_music_show(struct device *dev, |
2075 | struct device_attribute *attr, char *buf) | 2086 | struct device_attribute *attr, char *buf) |
@@ -2105,6 +2116,7 @@ static ssize_t usb_sleep_music_store(struct device *dev, | |||
2105 | 2116 | ||
2106 | return count; | 2117 | return count; |
2107 | } | 2118 | } |
2119 | static DEVICE_ATTR_RW(usb_sleep_music); | ||
2108 | 2120 | ||
2109 | static ssize_t kbd_function_keys_show(struct device *dev, | 2121 | static ssize_t kbd_function_keys_show(struct device *dev, |
2110 | struct device_attribute *attr, char *buf) | 2122 | struct device_attribute *attr, char *buf) |
@@ -2146,6 +2158,7 @@ static ssize_t kbd_function_keys_store(struct device *dev, | |||
2146 | 2158 | ||
2147 | return count; | 2159 | return count; |
2148 | } | 2160 | } |
2161 | static DEVICE_ATTR_RW(kbd_function_keys); | ||
2149 | 2162 | ||
2150 | static ssize_t panel_power_on_show(struct device *dev, | 2163 | static ssize_t panel_power_on_show(struct device *dev, |
2151 | struct device_attribute *attr, char *buf) | 2164 | struct device_attribute *attr, char *buf) |
@@ -2183,6 +2196,7 @@ static ssize_t panel_power_on_store(struct device *dev, | |||
2183 | 2196 | ||
2184 | return count; | 2197 | return count; |
2185 | } | 2198 | } |
2199 | static DEVICE_ATTR_RW(panel_power_on); | ||
2186 | 2200 | ||
2187 | static ssize_t usb_three_show(struct device *dev, | 2201 | static ssize_t usb_three_show(struct device *dev, |
2188 | struct device_attribute *attr, char *buf) | 2202 | struct device_attribute *attr, char *buf) |
@@ -2224,33 +2238,7 @@ static ssize_t usb_three_store(struct device *dev, | |||
2224 | 2238 | ||
2225 | return count; | 2239 | return count; |
2226 | } | 2240 | } |
2227 | 2241 | static DEVICE_ATTR_RW(usb_three); | |
2228 | static DEVICE_ATTR(version, S_IRUGO, version_show, NULL); | ||
2229 | static DEVICE_ATTR(fan, S_IRUGO | S_IWUSR, fan_show, fan_store); | ||
2230 | static DEVICE_ATTR(kbd_backlight_mode, S_IRUGO | S_IWUSR, | ||
2231 | kbd_backlight_mode_show, kbd_backlight_mode_store); | ||
2232 | static DEVICE_ATTR(kbd_type, S_IRUGO, kbd_type_show, NULL); | ||
2233 | static DEVICE_ATTR(available_kbd_modes, S_IRUGO, | ||
2234 | available_kbd_modes_show, NULL); | ||
2235 | static DEVICE_ATTR(kbd_backlight_timeout, S_IRUGO | S_IWUSR, | ||
2236 | kbd_backlight_timeout_show, kbd_backlight_timeout_store); | ||
2237 | static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR, touchpad_show, touchpad_store); | ||
2238 | static DEVICE_ATTR(position, S_IRUGO, position_show, NULL); | ||
2239 | static DEVICE_ATTR(usb_sleep_charge, S_IRUGO | S_IWUSR, | ||
2240 | usb_sleep_charge_show, usb_sleep_charge_store); | ||
2241 | static DEVICE_ATTR(sleep_functions_on_battery, S_IRUGO | S_IWUSR, | ||
2242 | sleep_functions_on_battery_show, | ||
2243 | sleep_functions_on_battery_store); | ||
2244 | static DEVICE_ATTR(usb_rapid_charge, S_IRUGO | S_IWUSR, | ||
2245 | usb_rapid_charge_show, usb_rapid_charge_store); | ||
2246 | static DEVICE_ATTR(usb_sleep_music, S_IRUGO | S_IWUSR, | ||
2247 | usb_sleep_music_show, usb_sleep_music_store); | ||
2248 | static DEVICE_ATTR(kbd_function_keys, S_IRUGO | S_IWUSR, | ||
2249 | kbd_function_keys_show, kbd_function_keys_store); | ||
2250 | static DEVICE_ATTR(panel_power_on, S_IRUGO | S_IWUSR, | ||
2251 | panel_power_on_show, panel_power_on_store); | ||
2252 | static DEVICE_ATTR(usb_three, S_IRUGO | S_IWUSR, | ||
2253 | usb_three_show, usb_three_store); | ||
2254 | 2242 | ||
2255 | static struct attribute *toshiba_attributes[] = { | 2243 | static struct attribute *toshiba_attributes[] = { |
2256 | &dev_attr_version.attr, | 2244 | &dev_attr_version.attr, |