diff options
author | Zhang Rui <rui.zhang@intel.com> | 2010-10-08 01:54:57 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-10-15 22:02:38 -0400 |
commit | 1b3d4c3b9a597e216c08bff2c59a8de872ef2d09 (patch) | |
tree | 51844bb5a61d5412e290e87bcea8a37043f2ee29 /drivers/acpi | |
parent | cd07202cc8262e1669edff0d97715f3dd9260917 (diff) |
ACPI ac/battery/sbs: sysfs I/F always built in, procfs I/F disabled by default
ACPI AC/Battery/SBS driver has different kernel option for procfs and sysfs I/F.
This patch,
1. Change CONFIG_ACPI_PROCFS_POWER to 'n' by default so that we can remove it in the next release or two.
2. Remove CONFIG_ACPI_SYSFS_POWER and always build in the sysfs I/F of these drivers.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 11 | ||||
-rw-r--r-- | drivers/acpi/ac.c | 14 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 21 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 25 |
4 files changed, 3 insertions, 68 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 88681aca88c5..0f9de2b44c0c 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -66,7 +66,6 @@ config ACPI_PROCFS | |||
66 | config ACPI_PROCFS_POWER | 66 | config ACPI_PROCFS_POWER |
67 | bool "Deprecated power /proc/acpi directories" | 67 | bool "Deprecated power /proc/acpi directories" |
68 | depends on PROC_FS | 68 | depends on PROC_FS |
69 | default y | ||
70 | help | 69 | help |
71 | For backwards compatibility, this option allows | 70 | For backwards compatibility, this option allows |
72 | deprecated power /proc/acpi/ directories to exist, even when | 71 | deprecated power /proc/acpi/ directories to exist, even when |
@@ -90,13 +89,6 @@ config ACPI_POWER_METER | |||
90 | To compile this driver as a module, choose M here: | 89 | To compile this driver as a module, choose M here: |
91 | the module will be called power-meter. | 90 | the module will be called power-meter. |
92 | 91 | ||
93 | config ACPI_SYSFS_POWER | ||
94 | bool "Future power /sys interface" | ||
95 | select POWER_SUPPLY | ||
96 | default y | ||
97 | help | ||
98 | Say N to disable power /sys interface | ||
99 | |||
100 | config ACPI_EC_DEBUGFS | 92 | config ACPI_EC_DEBUGFS |
101 | tristate "EC read/write access through /sys/kernel/debug/ec" | 93 | tristate "EC read/write access through /sys/kernel/debug/ec" |
102 | default n | 94 | default n |
@@ -136,6 +128,7 @@ config ACPI_PROC_EVENT | |||
136 | config ACPI_AC | 128 | config ACPI_AC |
137 | tristate "AC Adapter" | 129 | tristate "AC Adapter" |
138 | depends on X86 | 130 | depends on X86 |
131 | select POWER_SUPPLY | ||
139 | default y | 132 | default y |
140 | help | 133 | help |
141 | This driver supports the AC Adapter object, which indicates | 134 | This driver supports the AC Adapter object, which indicates |
@@ -148,6 +141,7 @@ config ACPI_AC | |||
148 | config ACPI_BATTERY | 141 | config ACPI_BATTERY |
149 | tristate "Battery" | 142 | tristate "Battery" |
150 | depends on X86 | 143 | depends on X86 |
144 | select POWER_SUPPLY | ||
151 | default y | 145 | default y |
152 | help | 146 | help |
153 | This driver adds support for battery information through | 147 | This driver adds support for battery information through |
@@ -364,6 +358,7 @@ config ACPI_HOTPLUG_MEMORY | |||
364 | config ACPI_SBS | 358 | config ACPI_SBS |
365 | tristate "Smart Battery System" | 359 | tristate "Smart Battery System" |
366 | depends on X86 | 360 | depends on X86 |
361 | select POWER_SUPPLY | ||
367 | help | 362 | help |
368 | This driver supports the Smart Battery System, another | 363 | This driver supports the Smart Battery System, another |
369 | type of access to battery information, found on some laptops. | 364 | type of access to battery information, found on some laptops. |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 56205a0b85df..ba9afeaa23ac 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -32,9 +32,7 @@ | |||
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #endif | 34 | #endif |
35 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
36 | #include <linux/power_supply.h> | 35 | #include <linux/power_supply.h> |
37 | #endif | ||
38 | #include <acpi/acpi_bus.h> | 36 | #include <acpi/acpi_bus.h> |
39 | #include <acpi/acpi_drivers.h> | 37 | #include <acpi/acpi_drivers.h> |
40 | 38 | ||
@@ -86,9 +84,7 @@ static struct acpi_driver acpi_ac_driver = { | |||
86 | }; | 84 | }; |
87 | 85 | ||
88 | struct acpi_ac { | 86 | struct acpi_ac { |
89 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
90 | struct power_supply charger; | 87 | struct power_supply charger; |
91 | #endif | ||
92 | struct acpi_device * device; | 88 | struct acpi_device * device; |
93 | unsigned long long state; | 89 | unsigned long long state; |
94 | }; | 90 | }; |
@@ -104,7 +100,6 @@ static const struct file_operations acpi_ac_fops = { | |||
104 | .release = single_release, | 100 | .release = single_release, |
105 | }; | 101 | }; |
106 | #endif | 102 | #endif |
107 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
108 | static int get_ac_property(struct power_supply *psy, | 103 | static int get_ac_property(struct power_supply *psy, |
109 | enum power_supply_property psp, | 104 | enum power_supply_property psp, |
110 | union power_supply_propval *val) | 105 | union power_supply_propval *val) |
@@ -123,7 +118,6 @@ static int get_ac_property(struct power_supply *psy, | |||
123 | static enum power_supply_property ac_props[] = { | 118 | static enum power_supply_property ac_props[] = { |
124 | POWER_SUPPLY_PROP_ONLINE, | 119 | POWER_SUPPLY_PROP_ONLINE, |
125 | }; | 120 | }; |
126 | #endif | ||
127 | /* -------------------------------------------------------------------------- | 121 | /* -------------------------------------------------------------------------- |
128 | AC Adapter Management | 122 | AC Adapter Management |
129 | -------------------------------------------------------------------------- */ | 123 | -------------------------------------------------------------------------- */ |
@@ -247,9 +241,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) | |||
247 | dev_name(&device->dev), event, | 241 | dev_name(&device->dev), event, |
248 | (u32) ac->state); | 242 | (u32) ac->state); |
249 | acpi_notifier_call_chain(device, event, (u32) ac->state); | 243 | acpi_notifier_call_chain(device, event, (u32) ac->state); |
250 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
251 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 244 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
252 | #endif | ||
253 | } | 245 | } |
254 | 246 | ||
255 | return; | 247 | return; |
@@ -282,14 +274,12 @@ static int acpi_ac_add(struct acpi_device *device) | |||
282 | #endif | 274 | #endif |
283 | if (result) | 275 | if (result) |
284 | goto end; | 276 | goto end; |
285 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
286 | ac->charger.name = acpi_device_bid(device); | 277 | ac->charger.name = acpi_device_bid(device); |
287 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; | 278 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; |
288 | ac->charger.properties = ac_props; | 279 | ac->charger.properties = ac_props; |
289 | ac->charger.num_properties = ARRAY_SIZE(ac_props); | 280 | ac->charger.num_properties = ARRAY_SIZE(ac_props); |
290 | ac->charger.get_property = get_ac_property; | 281 | ac->charger.get_property = get_ac_property; |
291 | power_supply_register(&ac->device->dev, &ac->charger); | 282 | power_supply_register(&ac->device->dev, &ac->charger); |
292 | #endif | ||
293 | 283 | ||
294 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", | 284 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", |
295 | acpi_device_name(device), acpi_device_bid(device), | 285 | acpi_device_name(device), acpi_device_bid(device), |
@@ -316,10 +306,8 @@ static int acpi_ac_resume(struct acpi_device *device) | |||
316 | old_state = ac->state; | 306 | old_state = ac->state; |
317 | if (acpi_ac_get_state(ac)) | 307 | if (acpi_ac_get_state(ac)) |
318 | return 0; | 308 | return 0; |
319 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
320 | if (old_state != ac->state) | 309 | if (old_state != ac->state) |
321 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 310 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
322 | #endif | ||
323 | return 0; | 311 | return 0; |
324 | } | 312 | } |
325 | 313 | ||
@@ -333,10 +321,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
333 | 321 | ||
334 | ac = acpi_driver_data(device); | 322 | ac = acpi_driver_data(device); |
335 | 323 | ||
336 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
337 | if (ac->charger.dev) | 324 | if (ac->charger.dev) |
338 | power_supply_unregister(&ac->charger); | 325 | power_supply_unregister(&ac->charger); |
339 | #endif | ||
340 | #ifdef CONFIG_ACPI_PROCFS_POWER | 326 | #ifdef CONFIG_ACPI_PROCFS_POWER |
341 | acpi_ac_remove_fs(device); | 327 | acpi_ac_remove_fs(device); |
342 | #endif | 328 | #endif |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 98417201e9ce..7b8787b490f6 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -42,10 +42,7 @@ | |||
42 | 42 | ||
43 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
44 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
45 | |||
46 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
47 | #include <linux/power_supply.h> | 45 | #include <linux/power_supply.h> |
48 | #endif | ||
49 | 46 | ||
50 | #define PREFIX "ACPI: " | 47 | #define PREFIX "ACPI: " |
51 | 48 | ||
@@ -102,9 +99,7 @@ enum { | |||
102 | 99 | ||
103 | struct acpi_battery { | 100 | struct acpi_battery { |
104 | struct mutex lock; | 101 | struct mutex lock; |
105 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
106 | struct power_supply bat; | 102 | struct power_supply bat; |
107 | #endif | ||
108 | struct acpi_device *device; | 103 | struct acpi_device *device; |
109 | unsigned long update_time; | 104 | unsigned long update_time; |
110 | int rate_now; | 105 | int rate_now; |
@@ -141,7 +136,6 @@ inline int acpi_battery_present(struct acpi_battery *battery) | |||
141 | return battery->device->status.battery_present; | 136 | return battery->device->status.battery_present; |
142 | } | 137 | } |
143 | 138 | ||
144 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
145 | static int acpi_battery_technology(struct acpi_battery *battery) | 139 | static int acpi_battery_technology(struct acpi_battery *battery) |
146 | { | 140 | { |
147 | if (!strcasecmp("NiCd", battery->type)) | 141 | if (!strcasecmp("NiCd", battery->type)) |
@@ -281,7 +275,6 @@ static enum power_supply_property energy_battery_props[] = { | |||
281 | POWER_SUPPLY_PROP_MANUFACTURER, | 275 | POWER_SUPPLY_PROP_MANUFACTURER, |
282 | POWER_SUPPLY_PROP_SERIAL_NUMBER, | 276 | POWER_SUPPLY_PROP_SERIAL_NUMBER, |
283 | }; | 277 | }; |
284 | #endif | ||
285 | 278 | ||
286 | #ifdef CONFIG_ACPI_PROCFS_POWER | 279 | #ifdef CONFIG_ACPI_PROCFS_POWER |
287 | inline char *acpi_battery_units(struct acpi_battery *battery) | 280 | inline char *acpi_battery_units(struct acpi_battery *battery) |
@@ -492,7 +485,6 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) | |||
492 | return acpi_battery_set_alarm(battery); | 485 | return acpi_battery_set_alarm(battery); |
493 | } | 486 | } |
494 | 487 | ||
495 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
496 | static ssize_t acpi_battery_alarm_show(struct device *dev, | 488 | static ssize_t acpi_battery_alarm_show(struct device *dev, |
497 | struct device_attribute *attr, | 489 | struct device_attribute *attr, |
498 | char *buf) | 490 | char *buf) |
@@ -552,7 +544,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery) | |||
552 | power_supply_unregister(&battery->bat); | 544 | power_supply_unregister(&battery->bat); |
553 | battery->bat.dev = NULL; | 545 | battery->bat.dev = NULL; |
554 | } | 546 | } |
555 | #endif | ||
556 | 547 | ||
557 | static void acpi_battery_quirks(struct acpi_battery *battery) | 548 | static void acpi_battery_quirks(struct acpi_battery *battery) |
558 | { | 549 | { |
@@ -568,9 +559,7 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
568 | if (result) | 559 | if (result) |
569 | return result; | 560 | return result; |
570 | if (!acpi_battery_present(battery)) { | 561 | if (!acpi_battery_present(battery)) { |
571 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
572 | sysfs_remove_battery(battery); | 562 | sysfs_remove_battery(battery); |
573 | #endif | ||
574 | battery->update_time = 0; | 563 | battery->update_time = 0; |
575 | return 0; | 564 | return 0; |
576 | } | 565 | } |
@@ -582,10 +571,8 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
582 | acpi_battery_quirks(battery); | 571 | acpi_battery_quirks(battery); |
583 | acpi_battery_init_alarm(battery); | 572 | acpi_battery_init_alarm(battery); |
584 | } | 573 | } |
585 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
586 | if (!battery->bat.dev) | 574 | if (!battery->bat.dev) |
587 | sysfs_add_battery(battery); | 575 | sysfs_add_battery(battery); |
588 | #endif | ||
589 | return acpi_battery_get_state(battery); | 576 | return acpi_battery_get_state(battery); |
590 | } | 577 | } |
591 | 578 | ||
@@ -867,26 +854,20 @@ static void acpi_battery_remove_fs(struct acpi_device *device) | |||
867 | static void acpi_battery_notify(struct acpi_device *device, u32 event) | 854 | static void acpi_battery_notify(struct acpi_device *device, u32 event) |
868 | { | 855 | { |
869 | struct acpi_battery *battery = acpi_driver_data(device); | 856 | struct acpi_battery *battery = acpi_driver_data(device); |
870 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
871 | struct device *old; | 857 | struct device *old; |
872 | #endif | ||
873 | 858 | ||
874 | if (!battery) | 859 | if (!battery) |
875 | return; | 860 | return; |
876 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
877 | old = battery->bat.dev; | 861 | old = battery->bat.dev; |
878 | #endif | ||
879 | acpi_battery_update(battery); | 862 | acpi_battery_update(battery); |
880 | acpi_bus_generate_proc_event(device, event, | 863 | acpi_bus_generate_proc_event(device, event, |
881 | acpi_battery_present(battery)); | 864 | acpi_battery_present(battery)); |
882 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 865 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
883 | dev_name(&device->dev), event, | 866 | dev_name(&device->dev), event, |
884 | acpi_battery_present(battery)); | 867 | acpi_battery_present(battery)); |
885 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
886 | /* acpi_battery_update could remove power_supply object */ | 868 | /* acpi_battery_update could remove power_supply object */ |
887 | if (old && battery->bat.dev) | 869 | if (old && battery->bat.dev) |
888 | power_supply_changed(&battery->bat); | 870 | power_supply_changed(&battery->bat); |
889 | #endif | ||
890 | } | 871 | } |
891 | 872 | ||
892 | static int acpi_battery_add(struct acpi_device *device) | 873 | static int acpi_battery_add(struct acpi_device *device) |
@@ -934,9 +915,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
934 | #ifdef CONFIG_ACPI_PROCFS_POWER | 915 | #ifdef CONFIG_ACPI_PROCFS_POWER |
935 | acpi_battery_remove_fs(device); | 916 | acpi_battery_remove_fs(device); |
936 | #endif | 917 | #endif |
937 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
938 | sysfs_remove_battery(battery); | 918 | sysfs_remove_battery(battery); |
939 | #endif | ||
940 | mutex_destroy(&battery->lock); | 919 | mutex_destroy(&battery->lock); |
941 | kfree(battery); | 920 | kfree(battery); |
942 | return 0; | 921 | return 0; |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 4ff76e8174eb..e5dbedb16bbf 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -40,10 +40,7 @@ | |||
40 | #include <linux/timer.h> | 40 | #include <linux/timer.h> |
41 | #include <linux/jiffies.h> | 41 | #include <linux/jiffies.h> |
42 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
43 | |||
44 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
45 | #include <linux/power_supply.h> | 43 | #include <linux/power_supply.h> |
46 | #endif | ||
47 | 44 | ||
48 | #include "sbshc.h" | 45 | #include "sbshc.h" |
49 | 46 | ||
@@ -85,9 +82,7 @@ static const struct acpi_device_id sbs_device_ids[] = { | |||
85 | MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | 82 | MODULE_DEVICE_TABLE(acpi, sbs_device_ids); |
86 | 83 | ||
87 | struct acpi_battery { | 84 | struct acpi_battery { |
88 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
89 | struct power_supply bat; | 85 | struct power_supply bat; |
90 | #endif | ||
91 | struct acpi_sbs *sbs; | 86 | struct acpi_sbs *sbs; |
92 | #ifdef CONFIG_ACPI_PROCFS_POWER | 87 | #ifdef CONFIG_ACPI_PROCFS_POWER |
93 | struct proc_dir_entry *proc_entry; | 88 | struct proc_dir_entry *proc_entry; |
@@ -120,9 +115,7 @@ struct acpi_battery { | |||
120 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 115 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
121 | 116 | ||
122 | struct acpi_sbs { | 117 | struct acpi_sbs { |
123 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
124 | struct power_supply charger; | 118 | struct power_supply charger; |
125 | #endif | ||
126 | struct acpi_device *device; | 119 | struct acpi_device *device; |
127 | struct acpi_smb_hc *hc; | 120 | struct acpi_smb_hc *hc; |
128 | struct mutex lock; | 121 | struct mutex lock; |
@@ -166,7 +159,6 @@ static inline int acpi_battery_scale(struct acpi_battery *battery) | |||
166 | acpi_battery_ipscale(battery); | 159 | acpi_battery_ipscale(battery); |
167 | } | 160 | } |
168 | 161 | ||
169 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
170 | static int sbs_get_ac_property(struct power_supply *psy, | 162 | static int sbs_get_ac_property(struct power_supply *psy, |
171 | enum power_supply_property psp, | 163 | enum power_supply_property psp, |
172 | union power_supply_propval *val) | 164 | union power_supply_propval *val) |
@@ -313,7 +305,6 @@ static enum power_supply_property sbs_energy_battery_props[] = { | |||
313 | POWER_SUPPLY_PROP_MANUFACTURER, | 305 | POWER_SUPPLY_PROP_MANUFACTURER, |
314 | }; | 306 | }; |
315 | 307 | ||
316 | #endif | ||
317 | 308 | ||
318 | /* -------------------------------------------------------------------------- | 309 | /* -------------------------------------------------------------------------- |
319 | Smart Battery System Management | 310 | Smart Battery System Management |
@@ -449,7 +440,6 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) | |||
449 | return result; | 440 | return result; |
450 | } | 441 | } |
451 | 442 | ||
452 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
453 | static ssize_t acpi_battery_alarm_show(struct device *dev, | 443 | static ssize_t acpi_battery_alarm_show(struct device *dev, |
454 | struct device_attribute *attr, | 444 | struct device_attribute *attr, |
455 | char *buf) | 445 | char *buf) |
@@ -479,7 +469,6 @@ static struct device_attribute alarm_attr = { | |||
479 | .show = acpi_battery_alarm_show, | 469 | .show = acpi_battery_alarm_show, |
480 | .store = acpi_battery_alarm_store, | 470 | .store = acpi_battery_alarm_store, |
481 | }; | 471 | }; |
482 | #endif | ||
483 | 472 | ||
484 | /* -------------------------------------------------------------------------- | 473 | /* -------------------------------------------------------------------------- |
485 | FS Interface (/proc/acpi) | 474 | FS Interface (/proc/acpi) |
@@ -798,7 +787,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
798 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, | 787 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, |
799 | battery); | 788 | battery); |
800 | #endif | 789 | #endif |
801 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
802 | battery->bat.name = battery->name; | 790 | battery->bat.name = battery->name; |
803 | battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; | 791 | battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; |
804 | if (!acpi_battery_mode(battery)) { | 792 | if (!acpi_battery_mode(battery)) { |
@@ -819,7 +807,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
819 | goto end; | 807 | goto end; |
820 | battery->have_sysfs_alarm = 1; | 808 | battery->have_sysfs_alarm = 1; |
821 | end: | 809 | end: |
822 | #endif | ||
823 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 810 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
824 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 811 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
825 | battery->name, battery->present ? "present" : "absent"); | 812 | battery->name, battery->present ? "present" : "absent"); |
@@ -828,17 +815,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
828 | 815 | ||
829 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 816 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
830 | { | 817 | { |
831 | #if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) | ||
832 | struct acpi_battery *battery = &sbs->battery[id]; | 818 | struct acpi_battery *battery = &sbs->battery[id]; |
833 | #endif | ||
834 | 819 | ||
835 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
836 | if (battery->bat.dev) { | 820 | if (battery->bat.dev) { |
837 | if (battery->have_sysfs_alarm) | 821 | if (battery->have_sysfs_alarm) |
838 | device_remove_file(battery->bat.dev, &alarm_attr); | 822 | device_remove_file(battery->bat.dev, &alarm_attr); |
839 | power_supply_unregister(&battery->bat); | 823 | power_supply_unregister(&battery->bat); |
840 | } | 824 | } |
841 | #endif | ||
842 | #ifdef CONFIG_ACPI_PROCFS_POWER | 825 | #ifdef CONFIG_ACPI_PROCFS_POWER |
843 | if (battery->proc_entry) | 826 | if (battery->proc_entry) |
844 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | 827 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); |
@@ -859,14 +842,12 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
859 | if (result) | 842 | if (result) |
860 | goto end; | 843 | goto end; |
861 | #endif | 844 | #endif |
862 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
863 | sbs->charger.name = "sbs-charger"; | 845 | sbs->charger.name = "sbs-charger"; |
864 | sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; | 846 | sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; |
865 | sbs->charger.properties = sbs_ac_props; | 847 | sbs->charger.properties = sbs_ac_props; |
866 | sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); | 848 | sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); |
867 | sbs->charger.get_property = sbs_get_ac_property; | 849 | sbs->charger.get_property = sbs_get_ac_property; |
868 | power_supply_register(&sbs->device->dev, &sbs->charger); | 850 | power_supply_register(&sbs->device->dev, &sbs->charger); |
869 | #endif | ||
870 | printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", | 851 | printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", |
871 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 852 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
872 | ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); | 853 | ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); |
@@ -876,10 +857,8 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
876 | 857 | ||
877 | static void acpi_charger_remove(struct acpi_sbs *sbs) | 858 | static void acpi_charger_remove(struct acpi_sbs *sbs) |
878 | { | 859 | { |
879 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
880 | if (sbs->charger.dev) | 860 | if (sbs->charger.dev) |
881 | power_supply_unregister(&sbs->charger); | 861 | power_supply_unregister(&sbs->charger); |
882 | #endif | ||
883 | #ifdef CONFIG_ACPI_PROCFS_POWER | 862 | #ifdef CONFIG_ACPI_PROCFS_POWER |
884 | if (sbs->charger_entry) | 863 | if (sbs->charger_entry) |
885 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); | 864 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); |
@@ -900,9 +879,7 @@ static void acpi_sbs_callback(void *context) | |||
900 | ACPI_SBS_NOTIFY_STATUS, | 879 | ACPI_SBS_NOTIFY_STATUS, |
901 | sbs->charger_present); | 880 | sbs->charger_present); |
902 | #endif | 881 | #endif |
903 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
904 | kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); | 882 | kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); |
905 | #endif | ||
906 | } | 883 | } |
907 | if (sbs->manager_present) { | 884 | if (sbs->manager_present) { |
908 | for (id = 0; id < MAX_SBS_BAT; ++id) { | 885 | for (id = 0; id < MAX_SBS_BAT; ++id) { |
@@ -919,9 +896,7 @@ static void acpi_sbs_callback(void *context) | |||
919 | ACPI_SBS_NOTIFY_STATUS, | 896 | ACPI_SBS_NOTIFY_STATUS, |
920 | bat->present); | 897 | bat->present); |
921 | #endif | 898 | #endif |
922 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
923 | kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); | 899 | kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); |
924 | #endif | ||
925 | } | 900 | } |
926 | } | 901 | } |
927 | } | 902 | } |