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.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}