aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2007-05-30 19:50:14 -0400
committerLen Brown <len.brown@intel.com>2007-05-31 12:53:00 -0400
commitcc4c24e115ca7bc2e4ec74d70bcb8fda1d1a8df8 (patch)
tree9da120a598b8f540c8b72050f7d252c700316c9f
parent68ccfaa8222f2a26f0689fad9e8c0c3f4c19f599 (diff)
ACPI: thinkpad-acpi: do not use named sysfs groups
The initial version of the thinkpad-acpi sysfs interface (not yet released in any stable mainline kernel) made liberal use of named sysfs groups, in order to get the attributes more organized. This proved to be a really bad design decision. Maybe if attribute groups were as flexible as a real directory, and if binary attributes were not second-class citizens, the idea of subdirs and named groups would not have been so bad. This patch makes all the thinkpad-acpi sysfs groups anonymous (thus removing the subdirs), adds the former group names as a prefix (so that hotkey/enable becomes hotkey_enable for example), and updates the documentation. These changes will make the thinkpad-acpi sysfs ABI a lot easier to maintain. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--Documentation/thinkpad-acpi.txt25
-rw-r--r--drivers/misc/thinkpad_acpi.c17
-rw-r--r--drivers/misc/thinkpad_acpi.h6
3 files changed, 18 insertions, 30 deletions
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 2d4803359a04..9e6b94face4b 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -138,7 +138,7 @@ Hot keys
138-------- 138--------
139 139
140procfs: /proc/acpi/ibm/hotkey 140procfs: /proc/acpi/ibm/hotkey
141sysfs device attribute: hotkey/* 141sysfs device attribute: hotkey_*
142 142
143Without this driver, only the Fn-F4 key (sleep button) generates an 143Without this driver, only the Fn-F4 key (sleep button) generates an
144ACPI event. With the driver loaded, the hotkey feature enabled and the 144ACPI event. With the driver loaded, the hotkey feature enabled and the
@@ -196,10 +196,7 @@ The following commands can be written to the /proc/acpi/ibm/hotkey file:
196 196
197sysfs notes: 197sysfs notes:
198 198
199 The hot keys attributes are in a hotkey/ subdirectory off the 199 hotkey_bios_enabled:
200 thinkpad device.
201
202 bios_enabled:
203 Returns the status of the hot keys feature when 200 Returns the status of the hot keys feature when
204 thinkpad-acpi was loaded. Upon module unload, the hot 201 thinkpad-acpi was loaded. Upon module unload, the hot
205 key feature status will be restored to this value. 202 key feature status will be restored to this value.
@@ -207,19 +204,19 @@ sysfs notes:
207 0: hot keys were disabled 204 0: hot keys were disabled
208 1: hot keys were enabled 205 1: hot keys were enabled
209 206
210 bios_mask: 207 hotkey_bios_mask:
211 Returns the hot keys mask when thinkpad-acpi was loaded. 208 Returns the hot keys mask when thinkpad-acpi was loaded.
212 Upon module unload, the hot keys mask will be restored 209 Upon module unload, the hot keys mask will be restored
213 to this value. 210 to this value.
214 211
215 enable: 212 hotkey_enable:
216 Enables/disables the hot keys feature, and reports 213 Enables/disables the hot keys feature, and reports
217 current status of the hot keys feature. 214 current status of the hot keys feature.
218 215
219 0: disables the hot keys feature / feature disabled 216 0: disables the hot keys feature / feature disabled
220 1: enables the hot keys feature / feature enabled 217 1: enables the hot keys feature / feature enabled
221 218
222 mask: 219 hotkey_mask:
223 bit mask to enable ACPI event generation for each hot 220 bit mask to enable ACPI event generation for each hot
224 key (see above). Returns the current status of the hot 221 key (see above). Returns the current status of the hot
225 keys mask, and allows one to modify it. 222 keys mask, and allows one to modify it.
@@ -229,7 +226,7 @@ Bluetooth
229--------- 226---------
230 227
231procfs: /proc/acpi/ibm/bluetooth 228procfs: /proc/acpi/ibm/bluetooth
232sysfs device attribute: bluetooth/enable 229sysfs device attribute: bluetooth_enable
233 230
234This feature shows the presence and current state of a ThinkPad 231This feature shows the presence and current state of a ThinkPad
235Bluetooth device in the internal ThinkPad CDC slot. 232Bluetooth device in the internal ThinkPad CDC slot.
@@ -244,7 +241,7 @@ If Bluetooth is installed, the following commands can be used:
244Sysfs notes: 241Sysfs notes:
245 242
246 If the Bluetooth CDC card is installed, it can be enabled / 243 If the Bluetooth CDC card is installed, it can be enabled /
247 disabled through the "bluetooth/enable" thinkpad-acpi device 244 disabled through the "bluetooth_enable" thinkpad-acpi device
248 attribute, and its current status can also be queried. 245 attribute, and its current status can also be queried.
249 246
250 enable: 247 enable:
@@ -252,7 +249,7 @@ Sysfs notes:
252 1: enables Bluetooth / Bluetooth is enabled. 249 1: enables Bluetooth / Bluetooth is enabled.
253 250
254 Note: this interface will be probably be superseeded by the 251 Note: this interface will be probably be superseeded by the
255 generic rfkill class. 252 generic rfkill class, so it is NOT to be considered stable yet.
256 253
257Video output control -- /proc/acpi/ibm/video 254Video output control -- /proc/acpi/ibm/video
258-------------------------------------------- 255--------------------------------------------
@@ -898,7 +895,7 @@ EXPERIMENTAL: WAN
898----------------- 895-----------------
899 896
900procfs: /proc/acpi/ibm/wan 897procfs: /proc/acpi/ibm/wan
901sysfs device attribute: wwan/enable 898sysfs device attribute: wwan_enable
902 899
903This feature is marked EXPERIMENTAL because the implementation 900This feature is marked EXPERIMENTAL because the implementation
904directly accesses hardware registers and may not work as expected. USE 901directly accesses hardware registers and may not work as expected. USE
@@ -921,7 +918,7 @@ If the W-WAN card is installed, the following commands can be used:
921Sysfs notes: 918Sysfs notes:
922 919
923 If the W-WAN card is installed, it can be enabled / 920 If the W-WAN card is installed, it can be enabled /
924 disabled through the "wwan/enable" thinkpad-acpi device 921 disabled through the "wwan_enable" thinkpad-acpi device
925 attribute, and its current status can also be queried. 922 attribute, and its current status can also be queried.
926 923
927 enable: 924 enable:
@@ -929,7 +926,7 @@ Sysfs notes:
929 1: enables WWAN card / WWAN card is enabled. 926 1: enables WWAN card / WWAN card is enabled.
930 927
931 Note: this interface will be probably be superseeded by the 928 Note: this interface will be probably be superseeded by the
932 generic rfkill class. 929 generic rfkill class, so it is NOT to be considered stable yet.
933 930
934Multiple Commands, Module Parameters 931Multiple Commands, Module Parameters
935------------------------------------ 932------------------------------------
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 6c36a55cb3d1..95c0b96e83f2 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -740,7 +740,7 @@ static ssize_t hotkey_enable_store(struct device *dev,
740} 740}
741 741
742static struct device_attribute dev_attr_hotkey_enable = 742static struct device_attribute dev_attr_hotkey_enable =
743 __ATTR(enable, S_IWUSR | S_IRUGO, 743 __ATTR(hotkey_enable, S_IWUSR | S_IRUGO,
744 hotkey_enable_show, hotkey_enable_store); 744 hotkey_enable_show, hotkey_enable_store);
745 745
746/* sysfs hotkey mask --------------------------------------------------- */ 746/* sysfs hotkey mask --------------------------------------------------- */
@@ -775,7 +775,7 @@ static ssize_t hotkey_mask_store(struct device *dev,
775} 775}
776 776
777static struct device_attribute dev_attr_hotkey_mask = 777static struct device_attribute dev_attr_hotkey_mask =
778 __ATTR(mask, S_IWUSR | S_IRUGO, 778 __ATTR(hotkey_mask, S_IWUSR | S_IRUGO,
779 hotkey_mask_show, hotkey_mask_store); 779 hotkey_mask_show, hotkey_mask_store);
780 780
781/* sysfs hotkey bios_enabled ------------------------------------------- */ 781/* sysfs hotkey bios_enabled ------------------------------------------- */
@@ -787,7 +787,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
787} 787}
788 788
789static struct device_attribute dev_attr_hotkey_bios_enabled = 789static struct device_attribute dev_attr_hotkey_bios_enabled =
790 __ATTR(bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL); 790 __ATTR(hotkey_bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL);
791 791
792/* sysfs hotkey bios_mask ---------------------------------------------- */ 792/* sysfs hotkey bios_mask ---------------------------------------------- */
793static ssize_t hotkey_bios_mask_show(struct device *dev, 793static ssize_t hotkey_bios_mask_show(struct device *dev,
@@ -798,7 +798,7 @@ static ssize_t hotkey_bios_mask_show(struct device *dev,
798} 798}
799 799
800static struct device_attribute dev_attr_hotkey_bios_mask = 800static struct device_attribute dev_attr_hotkey_bios_mask =
801 __ATTR(bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL); 801 __ATTR(hotkey_bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL);
802 802
803/* --------------------------------------------------------------------- */ 803/* --------------------------------------------------------------------- */
804 804
@@ -824,8 +824,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
824 str_supported(tp_features.hotkey)); 824 str_supported(tp_features.hotkey));
825 825
826 if (tp_features.hotkey) { 826 if (tp_features.hotkey) {
827 hotkey_dev_attributes = create_attr_set(4, 827 hotkey_dev_attributes = create_attr_set(4, NULL);
828 TPACPI_HOTKEY_SYSFS_GROUP);
829 if (!hotkey_dev_attributes) 828 if (!hotkey_dev_attributes)
830 return -ENOMEM; 829 return -ENOMEM;
831 res = add_to_attr_set(hotkey_dev_attributes, 830 res = add_to_attr_set(hotkey_dev_attributes,
@@ -1050,7 +1049,7 @@ static ssize_t bluetooth_enable_store(struct device *dev,
1050} 1049}
1051 1050
1052static struct device_attribute dev_attr_bluetooth_enable = 1051static struct device_attribute dev_attr_bluetooth_enable =
1053 __ATTR(enable, S_IWUSR | S_IRUGO, 1052 __ATTR(bluetooth_enable, S_IWUSR | S_IRUGO,
1054 bluetooth_enable_show, bluetooth_enable_store); 1053 bluetooth_enable_show, bluetooth_enable_store);
1055 1054
1056/* --------------------------------------------------------------------- */ 1055/* --------------------------------------------------------------------- */
@@ -1061,7 +1060,6 @@ static struct attribute *bluetooth_attributes[] = {
1061}; 1060};
1062 1061
1063static const struct attribute_group bluetooth_attr_group = { 1062static const struct attribute_group bluetooth_attr_group = {
1064 .name = TPACPI_BLUETH_SYSFS_GROUP,
1065 .attrs = bluetooth_attributes, 1063 .attrs = bluetooth_attributes,
1066}; 1064};
1067 1065
@@ -1215,7 +1213,7 @@ static ssize_t wan_enable_store(struct device *dev,
1215} 1213}
1216 1214
1217static struct device_attribute dev_attr_wan_enable = 1215static struct device_attribute dev_attr_wan_enable =
1218 __ATTR(enable, S_IWUSR | S_IRUGO, 1216 __ATTR(wwan_enable, S_IWUSR | S_IRUGO,
1219 wan_enable_show, wan_enable_store); 1217 wan_enable_show, wan_enable_store);
1220 1218
1221/* --------------------------------------------------------------------- */ 1219/* --------------------------------------------------------------------- */
@@ -1226,7 +1224,6 @@ static struct attribute *wan_attributes[] = {
1226}; 1224};
1227 1225
1228static const struct attribute_group wan_attr_group = { 1226static const struct attribute_group wan_attr_group = {
1229 .name = TPACPI_WAN_SYSFS_GROUP,
1230 .attrs = wan_attributes, 1227 .attrs = wan_attributes,
1231}; 1228};
1232 1229
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 440145a02617..72d62f2dabb9 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -278,8 +278,6 @@ static int beep_write(char *buf);
278 * Bluetooth subdriver 278 * Bluetooth subdriver
279 */ 279 */
280 280
281#define TPACPI_BLUETH_SYSFS_GROUP "bluetooth"
282
283enum { 281enum {
284 /* ACPI GBDC/SBDC bits */ 282 /* ACPI GBDC/SBDC bits */
285 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */ 283 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */
@@ -416,8 +414,6 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc);
416 * Hotkey subdriver 414 * Hotkey subdriver
417 */ 415 */
418 416
419#define TPACPI_HOTKEY_SYSFS_GROUP "hotkey"
420
421static int hotkey_orig_status; 417static int hotkey_orig_status;
422static int hotkey_orig_mask; 418static int hotkey_orig_mask;
423 419
@@ -553,8 +549,6 @@ static int volume_write(char *buf);
553 * Wan subdriver 549 * Wan subdriver
554 */ 550 */
555 551
556#define TPACPI_WAN_SYSFS_GROUP "wwan"
557
558enum { 552enum {
559 /* ACPI GWAN/SWAN bits */ 553 /* ACPI GWAN/SWAN bits */
560 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */ 554 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */