aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorRich Townsend <rhdt@bartol.udel.edu>2006-07-01 11:36:54 -0400
committerLen Brown <len.brown@intel.com>2006-07-01 16:36:14 -0400
commit3f86b83243d59bb50caf5938d284d22e10d082a4 (patch)
treeebc93aff4abae0b3f4aa96c19973782eede3411d /drivers/acpi/battery.c
parent37672d4c5263d54ee4302f55242f6fd5317b0f9f (diff)
ACPI: add support for Smart Battery
Most batteries today are ACPI "Control Method" batteries, but some models ship with the older "Smart Battery" that requires this code. Rich Townsend and Bruno Ducrot were the original authors. Vladimir Lebedev updated to run on latest kernel. http://bugzilla.kernel.org/show_bug.cgi?id=3734 Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 2b8aab560b58..3ea79decfe24 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -59,6 +59,9 @@ ACPI_MODULE_NAME("acpi_battery")
59MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME); 59MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
60MODULE_LICENSE("GPL"); 60MODULE_LICENSE("GPL");
61 61
62extern struct proc_dir_entry *acpi_lock_battery_dir(void);
63extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
64
62static int acpi_battery_add(struct acpi_device *device); 65static int acpi_battery_add(struct acpi_device *device);
63static int acpi_battery_remove(struct acpi_device *device, int type); 66static int acpi_battery_remove(struct acpi_device *device, int type);
64 67
@@ -750,17 +753,15 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
750 753
751static int __init acpi_battery_init(void) 754static int __init acpi_battery_init(void)
752{ 755{
753 int result = 0; 756 int result;
754
755 757
756 acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); 758 acpi_battery_dir = acpi_lock_battery_dir();
757 if (!acpi_battery_dir) 759 if (!acpi_battery_dir)
758 return -ENODEV; 760 return -ENODEV;
759 acpi_battery_dir->owner = THIS_MODULE;
760 761
761 result = acpi_bus_register_driver(&acpi_battery_driver); 762 result = acpi_bus_register_driver(&acpi_battery_driver);
762 if (result < 0) { 763 if (result < 0) {
763 remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); 764 acpi_unlock_battery_dir(acpi_battery_dir);
764 return -ENODEV; 765 return -ENODEV;
765 } 766 }
766 767
@@ -772,7 +773,7 @@ static void __exit acpi_battery_exit(void)
772 773
773 acpi_bus_unregister_driver(&acpi_battery_driver); 774 acpi_bus_unregister_driver(&acpi_battery_driver);
774 775
775 remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); 776 acpi_unlock_battery_dir(acpi_battery_dir);
776 777
777 return; 778 return;
778} 779}