aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2007-11-19 08:33:45 -0500
committerLen Brown <len.brown@intel.com>2007-11-19 11:21:50 -0500
commitfdcedbba2f98c94bfbac9f6e712ab765f997b8dc (patch)
tree438968c5718fa25eebd332d7ac7a4e2ee4114a29 /drivers
parent2ffbb8377c7a0713baf6644e285adc27a5654582 (diff)
ACPI: Split out control for /proc/acpi entries from battery, ac, and sbs.
Introduce new ACPI_PROCFS_POWER (default Yes) config option and move procfs code in battery, ac, and sbs drivers under it. This is done to allow ACPI_PROCFS to be default No. Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig16
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/ac.c20
-rw-r--r--drivers/acpi/battery.c20
-rw-r--r--drivers/acpi/sbs.c20
5 files changed, 46 insertions, 32 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 087a7028ae84..497e92d3833b 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -69,7 +69,21 @@ config ACPI_PROCFS
69 and functions which do not yet exist in /sys. 69 and functions which do not yet exist in /sys.
70 70
71 Say N to delete /proc/acpi/ files that have moved to /sys/ 71 Say N to delete /proc/acpi/ files that have moved to /sys/
72 72config ACPI_PROCFS_POWER
73 bool "Deprecated power /proc/acpi folders"
74 depends on PROC_FS
75 default y
76 ---help---
77 For backwards compatibility, this option allows
78 deprecated power /proc/acpi/ folders to exist, even when
79 they have been replaced by functions in /sys.
80 The deprecated folders (and their replacements) include:
81 /proc/acpi/battery/* (/sys/class/power_supply/*)
82 /proc/acpi/ac_adapter/* (sys/class/power_supply/*)
83 This option has no effect on /proc/acpi/ folders
84 and functions, which do not yet exist in /sys
85
86 Say N to delete power /proc/acpi/ folders that have moved to /sys/
73config ACPI_PROC_EVENT 87config ACPI_PROC_EVENT
74 bool "Deprecated /proc/acpi/event support" 88 bool "Deprecated /proc/acpi/event support"
75 depends on PROC_FS 89 depends on PROC_FS
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 54e3ab0e5fc0..456446f90077 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o
58obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o 58obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
59obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o 59obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o 60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
61obj-y += cm_sbs.o 61obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
62obj-$(CONFIG_ACPI_SBS) += sbs.o 62obj-$(CONFIG_ACPI_SBS) += sbs.o
63obj-$(CONFIG_ACPI_SBS) += sbshc.o 63obj-$(CONFIG_ACPI_SBS) += sbshc.o
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 30238f6ff232..76ed4f52bebd 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -27,7 +27,7 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef CONFIG_ACPI_PROCFS 30#ifdef CONFIG_ACPI_PROCFS_POWER
31#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#endif 33#endif
@@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh");
51MODULE_DESCRIPTION("ACPI AC Adapter Driver"); 51MODULE_DESCRIPTION("ACPI AC Adapter Driver");
52MODULE_LICENSE("GPL"); 52MODULE_LICENSE("GPL");
53 53
54#ifdef CONFIG_ACPI_PROCFS 54#ifdef CONFIG_ACPI_PROCFS_POWER
55extern struct proc_dir_entry *acpi_lock_ac_dir(void); 55extern struct proc_dir_entry *acpi_lock_ac_dir(void);
56extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 56extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
57static int acpi_ac_open_fs(struct inode *inode, struct file *file); 57static int acpi_ac_open_fs(struct inode *inode, struct file *file);
@@ -86,7 +86,7 @@ struct acpi_ac {
86 86
87#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); 87#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
88 88
89#ifdef CONFIG_ACPI_PROCFS 89#ifdef CONFIG_ACPI_PROCFS_POWER
90static const struct file_operations acpi_ac_fops = { 90static const struct file_operations acpi_ac_fops = {
91 .open = acpi_ac_open_fs, 91 .open = acpi_ac_open_fs,
92 .read = seq_read, 92 .read = seq_read,
@@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
136 return 0; 136 return 0;
137} 137}
138 138
139#ifdef CONFIG_ACPI_PROCFS 139#ifdef CONFIG_ACPI_PROCFS_POWER
140/* -------------------------------------------------------------------------- 140/* --------------------------------------------------------------------------
141 FS Interface (/proc) 141 FS Interface (/proc)
142 -------------------------------------------------------------------------- */ 142 -------------------------------------------------------------------------- */
@@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device)
275 if (result) 275 if (result)
276 goto end; 276 goto end;
277 277
278#ifdef CONFIG_ACPI_PROCFS 278#ifdef CONFIG_ACPI_PROCFS_POWER
279 result = acpi_ac_add_fs(device); 279 result = acpi_ac_add_fs(device);
280#endif 280#endif
281 if (result) 281 if (result)
@@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device)
300 300
301 end: 301 end:
302 if (result) { 302 if (result) {
303#ifdef CONFIG_ACPI_PROCFS 303#ifdef CONFIG_ACPI_PROCFS_POWER
304 acpi_ac_remove_fs(device); 304 acpi_ac_remove_fs(device);
305#endif 305#endif
306 kfree(ac); 306 kfree(ac);
@@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
339 ACPI_ALL_NOTIFY, acpi_ac_notify); 339 ACPI_ALL_NOTIFY, acpi_ac_notify);
340 if (ac->charger.dev) 340 if (ac->charger.dev)
341 power_supply_unregister(&ac->charger); 341 power_supply_unregister(&ac->charger);
342#ifdef CONFIG_ACPI_PROCFS 342#ifdef CONFIG_ACPI_PROCFS_POWER
343 acpi_ac_remove_fs(device); 343 acpi_ac_remove_fs(device);
344#endif 344#endif
345 345
@@ -355,7 +355,7 @@ static int __init acpi_ac_init(void)
355 if (acpi_disabled) 355 if (acpi_disabled)
356 return -ENODEV; 356 return -ENODEV;
357 357
358#ifdef CONFIG_ACPI_PROCFS 358#ifdef CONFIG_ACPI_PROCFS_POWER
359 acpi_ac_dir = acpi_lock_ac_dir(); 359 acpi_ac_dir = acpi_lock_ac_dir();
360 if (!acpi_ac_dir) 360 if (!acpi_ac_dir)
361 return -ENODEV; 361 return -ENODEV;
@@ -363,7 +363,7 @@ static int __init acpi_ac_init(void)
363 363
364 result = acpi_bus_register_driver(&acpi_ac_driver); 364 result = acpi_bus_register_driver(&acpi_ac_driver);
365 if (result < 0) { 365 if (result < 0) {
366#ifdef CONFIG_ACPI_PROCFS 366#ifdef CONFIG_ACPI_PROCFS_POWER
367 acpi_unlock_ac_dir(acpi_ac_dir); 367 acpi_unlock_ac_dir(acpi_ac_dir);
368#endif 368#endif
369 return -ENODEV; 369 return -ENODEV;
@@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void)
377 377
378 acpi_bus_unregister_driver(&acpi_ac_driver); 378 acpi_bus_unregister_driver(&acpi_ac_driver);
379 379
380#ifdef CONFIG_ACPI_PROCFS 380#ifdef CONFIG_ACPI_PROCFS_POWER
381 acpi_unlock_ac_dir(acpi_ac_dir); 381 acpi_unlock_ac_dir(acpi_ac_dir);
382#endif 382#endif
383 383
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 192c244f6190..b871f289dd30 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -31,7 +31,7 @@
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33 33
34#ifdef CONFIG_ACPI_PROCFS 34#ifdef CONFIG_ACPI_PROCFS_POWER
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
@@ -63,7 +63,7 @@ static unsigned int cache_time = 1000;
63module_param(cache_time, uint, 0644); 63module_param(cache_time, uint, 0644);
64MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 64MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
65 65
66#ifdef CONFIG_ACPI_PROCFS 66#ifdef CONFIG_ACPI_PROCFS_POWER
67extern struct proc_dir_entry *acpi_lock_battery_dir(void); 67extern struct proc_dir_entry *acpi_lock_battery_dir(void);
68extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); 68extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
69 69
@@ -221,7 +221,7 @@ static enum power_supply_property energy_battery_props[] = {
221 POWER_SUPPLY_PROP_MANUFACTURER, 221 POWER_SUPPLY_PROP_MANUFACTURER,
222}; 222};
223 223
224#ifdef CONFIG_ACPI_PROCFS 224#ifdef CONFIG_ACPI_PROCFS_POWER
225inline char *acpi_battery_units(struct acpi_battery *battery) 225inline char *acpi_battery_units(struct acpi_battery *battery)
226{ 226{
227 return (battery->power_unit)?"mA":"mW"; 227 return (battery->power_unit)?"mA":"mW";
@@ -479,7 +479,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
479 FS Interface (/proc) 479 FS Interface (/proc)
480 -------------------------------------------------------------------------- */ 480 -------------------------------------------------------------------------- */
481 481
482#ifdef CONFIG_ACPI_PROCFS 482#ifdef CONFIG_ACPI_PROCFS_POWER
483static struct proc_dir_entry *acpi_battery_dir; 483static struct proc_dir_entry *acpi_battery_dir;
484 484
485static int acpi_battery_print_info(struct seq_file *seq, int result) 485static int acpi_battery_print_info(struct seq_file *seq, int result)
@@ -786,7 +786,7 @@ static int acpi_battery_add(struct acpi_device *device)
786 acpi_driver_data(device) = battery; 786 acpi_driver_data(device) = battery;
787 mutex_init(&battery->lock); 787 mutex_init(&battery->lock);
788 acpi_battery_update(battery); 788 acpi_battery_update(battery);
789#ifdef CONFIG_ACPI_PROCFS 789#ifdef CONFIG_ACPI_PROCFS_POWER
790 result = acpi_battery_add_fs(device); 790 result = acpi_battery_add_fs(device);
791 if (result) 791 if (result)
792 goto end; 792 goto end;
@@ -804,7 +804,7 @@ static int acpi_battery_add(struct acpi_device *device)
804 device->status.battery_present ? "present" : "absent"); 804 device->status.battery_present ? "present" : "absent");
805 end: 805 end:
806 if (result) { 806 if (result) {
807#ifdef CONFIG_ACPI_PROCFS 807#ifdef CONFIG_ACPI_PROCFS_POWER
808 acpi_battery_remove_fs(device); 808 acpi_battery_remove_fs(device);
809#endif 809#endif
810 kfree(battery); 810 kfree(battery);
@@ -823,7 +823,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
823 status = acpi_remove_notify_handler(device->handle, 823 status = acpi_remove_notify_handler(device->handle,
824 ACPI_ALL_NOTIFY, 824 ACPI_ALL_NOTIFY,
825 acpi_battery_notify); 825 acpi_battery_notify);
826#ifdef CONFIG_ACPI_PROCFS 826#ifdef CONFIG_ACPI_PROCFS_POWER
827 acpi_battery_remove_fs(device); 827 acpi_battery_remove_fs(device);
828#endif 828#endif
829 sysfs_remove_battery(battery); 829 sysfs_remove_battery(battery);
@@ -859,13 +859,13 @@ static int __init acpi_battery_init(void)
859{ 859{
860 if (acpi_disabled) 860 if (acpi_disabled)
861 return -ENODEV; 861 return -ENODEV;
862#ifdef CONFIG_ACPI_PROCFS 862#ifdef CONFIG_ACPI_PROCFS_POWER
863 acpi_battery_dir = acpi_lock_battery_dir(); 863 acpi_battery_dir = acpi_lock_battery_dir();
864 if (!acpi_battery_dir) 864 if (!acpi_battery_dir)
865 return -ENODEV; 865 return -ENODEV;
866#endif 866#endif
867 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { 867 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
868#ifdef CONFIG_ACPI_PROCFS 868#ifdef CONFIG_ACPI_PROCFS_POWER
869 acpi_unlock_battery_dir(acpi_battery_dir); 869 acpi_unlock_battery_dir(acpi_battery_dir);
870#endif 870#endif
871 return -ENODEV; 871 return -ENODEV;
@@ -876,7 +876,7 @@ static int __init acpi_battery_init(void)
876static void __exit acpi_battery_exit(void) 876static void __exit acpi_battery_exit(void)
877{ 877{
878 acpi_bus_unregister_driver(&acpi_battery_driver); 878 acpi_bus_unregister_driver(&acpi_battery_driver);
879#ifdef CONFIG_ACPI_PROCFS 879#ifdef CONFIG_ACPI_PROCFS_POWER
880 acpi_unlock_battery_dir(acpi_battery_dir); 880 acpi_unlock_battery_dir(acpi_battery_dir);
881#endif 881#endif
882} 882}
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 90fd09c65f95..278d20f9366a 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -29,7 +29,7 @@
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31 31
32#ifdef CONFIG_ACPI_PROCFS 32#ifdef CONFIG_ACPI_PROCFS_POWER
33#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
88struct acpi_battery { 88struct acpi_battery {
89 struct power_supply bat; 89 struct power_supply bat;
90 struct acpi_sbs *sbs; 90 struct acpi_sbs *sbs;
91#ifdef CONFIG_ACPI_PROCFS 91#ifdef CONFIG_ACPI_PROCFS_POWER
92 struct proc_dir_entry *proc_entry; 92 struct proc_dir_entry *proc_entry;
93#endif 93#endif
94 unsigned long update_time; 94 unsigned long update_time;
@@ -122,7 +122,7 @@ struct acpi_sbs {
122 struct acpi_device *device; 122 struct acpi_device *device;
123 struct acpi_smb_hc *hc; 123 struct acpi_smb_hc *hc;
124 struct mutex lock; 124 struct mutex lock;
125#ifdef CONFIG_ACPI_PROCFS 125#ifdef CONFIG_ACPI_PROCFS_POWER
126 struct proc_dir_entry *charger_entry; 126 struct proc_dir_entry *charger_entry;
127#endif 127#endif
128 struct acpi_battery battery[MAX_SBS_BAT]; 128 struct acpi_battery battery[MAX_SBS_BAT];
@@ -468,7 +468,7 @@ static struct device_attribute alarm_attr = {
468 FS Interface (/proc/acpi) 468 FS Interface (/proc/acpi)
469 -------------------------------------------------------------------------- */ 469 -------------------------------------------------------------------------- */
470 470
471#ifdef CONFIG_ACPI_PROCFS 471#ifdef CONFIG_ACPI_PROCFS_POWER
472/* Generic Routines */ 472/* Generic Routines */
473static int 473static int
474acpi_sbs_add_fs(struct proc_dir_entry **dir, 474acpi_sbs_add_fs(struct proc_dir_entry **dir,
@@ -789,7 +789,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
789 return result; 789 return result;
790 790
791 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); 791 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id);
792#ifdef CONFIG_ACPI_PROCFS 792#ifdef CONFIG_ACPI_PROCFS_POWER
793 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, 793 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir,
794 battery->name, &acpi_battery_info_fops, 794 battery->name, &acpi_battery_info_fops,
795 &acpi_battery_state_fops, &acpi_battery_alarm_fops, 795 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
@@ -820,7 +820,7 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
820 if (sbs->battery[id].bat.dev) 820 if (sbs->battery[id].bat.dev)
821 device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); 821 device_remove_file(sbs->battery[id].bat.dev, &alarm_attr);
822 power_supply_unregister(&sbs->battery[id].bat); 822 power_supply_unregister(&sbs->battery[id].bat);
823#ifdef CONFIG_ACPI_PROCFS 823#ifdef CONFIG_ACPI_PROCFS_POWER
824 if (sbs->battery[id].proc_entry) { 824 if (sbs->battery[id].proc_entry) {
825 acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), 825 acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry),
826 acpi_battery_dir); 826 acpi_battery_dir);
@@ -835,7 +835,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
835 result = acpi_ac_get_present(sbs); 835 result = acpi_ac_get_present(sbs);
836 if (result) 836 if (result)
837 goto end; 837 goto end;
838#ifdef CONFIG_ACPI_PROCFS 838#ifdef CONFIG_ACPI_PROCFS_POWER
839 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, 839 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir,
840 ACPI_AC_DIR_NAME, NULL, 840 ACPI_AC_DIR_NAME, NULL,
841 &acpi_ac_state_fops, NULL, sbs); 841 &acpi_ac_state_fops, NULL, sbs);
@@ -859,7 +859,7 @@ static void acpi_charger_remove(struct acpi_sbs *sbs)
859{ 859{
860 if (sbs->charger.dev) 860 if (sbs->charger.dev)
861 power_supply_unregister(&sbs->charger); 861 power_supply_unregister(&sbs->charger);
862#ifdef CONFIG_ACPI_PROCFS 862#ifdef CONFIG_ACPI_PROCFS_POWER
863 if (sbs->charger_entry) 863 if (sbs->charger_entry)
864 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); 864 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
865#endif 865#endif
@@ -965,7 +965,7 @@ static int acpi_sbs_remove(struct acpi_device *device, int type)
965 965
966static void acpi_sbs_rmdirs(void) 966static void acpi_sbs_rmdirs(void)
967{ 967{
968#ifdef CONFIG_ACPI_PROCFS 968#ifdef CONFIG_ACPI_PROCFS_POWER
969 if (acpi_ac_dir) { 969 if (acpi_ac_dir) {
970 acpi_unlock_ac_dir(acpi_ac_dir); 970 acpi_unlock_ac_dir(acpi_ac_dir);
971 acpi_ac_dir = NULL; 971 acpi_ac_dir = NULL;
@@ -1004,7 +1004,7 @@ static int __init acpi_sbs_init(void)
1004 1004
1005 if (acpi_disabled) 1005 if (acpi_disabled)
1006 return -ENODEV; 1006 return -ENODEV;
1007#ifdef CONFIG_ACPI_PROCFS 1007#ifdef CONFIG_ACPI_PROCFS_POWER
1008 acpi_ac_dir = acpi_lock_ac_dir(); 1008 acpi_ac_dir = acpi_lock_ac_dir();
1009 if (!acpi_ac_dir) 1009 if (!acpi_ac_dir)
1010 return -ENODEV; 1010 return -ENODEV;