aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 192c244f6190..7d6be23eff89 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
@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
153 val->intval = POWER_SUPPLY_STATUS_CHARGING; 153 val->intval = POWER_SUPPLY_STATUS_CHARGING;
154 else if (battery->state == 0) 154 else if (battery->state == 0)
155 val->intval = POWER_SUPPLY_STATUS_FULL; 155 val->intval = POWER_SUPPLY_STATUS_FULL;
156 else
157 val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
156 break; 158 break;
157 case POWER_SUPPLY_PROP_PRESENT: 159 case POWER_SUPPLY_PROP_PRESENT:
158 val->intval = acpi_battery_present(battery); 160 val->intval = acpi_battery_present(battery);
@@ -221,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = {
221 POWER_SUPPLY_PROP_MANUFACTURER, 223 POWER_SUPPLY_PROP_MANUFACTURER,
222}; 224};
223 225
224#ifdef CONFIG_ACPI_PROCFS 226#ifdef CONFIG_ACPI_PROCFS_POWER
225inline char *acpi_battery_units(struct acpi_battery *battery) 227inline char *acpi_battery_units(struct acpi_battery *battery)
226{ 228{
227 return (battery->power_unit)?"mA":"mW"; 229 return (battery->power_unit)?"mA":"mW";
@@ -479,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
479 FS Interface (/proc) 481 FS Interface (/proc)
480 -------------------------------------------------------------------------- */ 482 -------------------------------------------------------------------------- */
481 483
482#ifdef CONFIG_ACPI_PROCFS 484#ifdef CONFIG_ACPI_PROCFS_POWER
483static struct proc_dir_entry *acpi_battery_dir; 485static struct proc_dir_entry *acpi_battery_dir;
484 486
485static int acpi_battery_print_info(struct seq_file *seq, int result) 487static int acpi_battery_print_info(struct seq_file *seq, int result)
@@ -786,7 +788,7 @@ static int acpi_battery_add(struct acpi_device *device)
786 acpi_driver_data(device) = battery; 788 acpi_driver_data(device) = battery;
787 mutex_init(&battery->lock); 789 mutex_init(&battery->lock);
788 acpi_battery_update(battery); 790 acpi_battery_update(battery);
789#ifdef CONFIG_ACPI_PROCFS 791#ifdef CONFIG_ACPI_PROCFS_POWER
790 result = acpi_battery_add_fs(device); 792 result = acpi_battery_add_fs(device);
791 if (result) 793 if (result)
792 goto end; 794 goto end;
@@ -804,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device)
804 device->status.battery_present ? "present" : "absent"); 806 device->status.battery_present ? "present" : "absent");
805 end: 807 end:
806 if (result) { 808 if (result) {
807#ifdef CONFIG_ACPI_PROCFS 809#ifdef CONFIG_ACPI_PROCFS_POWER
808 acpi_battery_remove_fs(device); 810 acpi_battery_remove_fs(device);
809#endif 811#endif
810 kfree(battery); 812 kfree(battery);
@@ -823,7 +825,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
823 status = acpi_remove_notify_handler(device->handle, 825 status = acpi_remove_notify_handler(device->handle,
824 ACPI_ALL_NOTIFY, 826 ACPI_ALL_NOTIFY,
825 acpi_battery_notify); 827 acpi_battery_notify);
826#ifdef CONFIG_ACPI_PROCFS 828#ifdef CONFIG_ACPI_PROCFS_POWER
827 acpi_battery_remove_fs(device); 829 acpi_battery_remove_fs(device);
828#endif 830#endif
829 sysfs_remove_battery(battery); 831 sysfs_remove_battery(battery);
@@ -859,13 +861,13 @@ static int __init acpi_battery_init(void)
859{ 861{
860 if (acpi_disabled) 862 if (acpi_disabled)
861 return -ENODEV; 863 return -ENODEV;
862#ifdef CONFIG_ACPI_PROCFS 864#ifdef CONFIG_ACPI_PROCFS_POWER
863 acpi_battery_dir = acpi_lock_battery_dir(); 865 acpi_battery_dir = acpi_lock_battery_dir();
864 if (!acpi_battery_dir) 866 if (!acpi_battery_dir)
865 return -ENODEV; 867 return -ENODEV;
866#endif 868#endif
867 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { 869 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
868#ifdef CONFIG_ACPI_PROCFS 870#ifdef CONFIG_ACPI_PROCFS_POWER
869 acpi_unlock_battery_dir(acpi_battery_dir); 871 acpi_unlock_battery_dir(acpi_battery_dir);
870#endif 872#endif
871 return -ENODEV; 873 return -ENODEV;
@@ -876,7 +878,7 @@ static int __init acpi_battery_init(void)
876static void __exit acpi_battery_exit(void) 878static void __exit acpi_battery_exit(void)
877{ 879{
878 acpi_bus_unregister_driver(&acpi_battery_driver); 880 acpi_bus_unregister_driver(&acpi_battery_driver);
879#ifdef CONFIG_ACPI_PROCFS 881#ifdef CONFIG_ACPI_PROCFS_POWER
880 acpi_unlock_battery_dir(acpi_battery_dir); 882 acpi_unlock_battery_dir(acpi_battery_dir);
881#endif 883#endif
882} 884}