aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ac.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/ac.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/ac.c')
-rw-r--r--drivers/acpi/ac.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 4537ae4838c4..e0a1b1541362 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -50,6 +50,9 @@ ACPI_MODULE_NAME("acpi_ac")
50MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME); 50MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
51MODULE_LICENSE("GPL"); 51MODULE_LICENSE("GPL");
52 52
53extern struct proc_dir_entry *acpi_lock_ac_dir(void);
54extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
55
53static int acpi_ac_add(struct acpi_device *device); 56static int acpi_ac_add(struct acpi_device *device);
54static int acpi_ac_remove(struct acpi_device *device, int type); 57static int acpi_ac_remove(struct acpi_device *device, int type);
55static int acpi_ac_open_fs(struct inode *inode, struct file *file); 58static int acpi_ac_open_fs(struct inode *inode, struct file *file);
@@ -278,17 +281,16 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
278 281
279static int __init acpi_ac_init(void) 282static int __init acpi_ac_init(void)
280{ 283{
281 int result = 0; 284 int result;
282 285
283 286
284 acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); 287 acpi_ac_dir = acpi_lock_ac_dir();
285 if (!acpi_ac_dir) 288 if (!acpi_ac_dir)
286 return -ENODEV; 289 return -ENODEV;
287 acpi_ac_dir->owner = THIS_MODULE;
288 290
289 result = acpi_bus_register_driver(&acpi_ac_driver); 291 result = acpi_bus_register_driver(&acpi_ac_driver);
290 if (result < 0) { 292 if (result < 0) {
291 remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); 293 acpi_unlock_ac_dir(acpi_ac_dir);
292 return -ENODEV; 294 return -ENODEV;
293 } 295 }
294 296
@@ -300,7 +302,7 @@ static void __exit acpi_ac_exit(void)
300 302
301 acpi_bus_unregister_driver(&acpi_ac_driver); 303 acpi_bus_unregister_driver(&acpi_ac_driver);
302 304
303 remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); 305 acpi_unlock_ac_dir(acpi_ac_dir);
304 306
305 return; 307 return;
306} 308}