aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrey Borzenkov <arvidjaar@mail.ru>2007-11-14 20:00:37 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-14 21:45:44 -0500
commit8a246ee43f4b1df3fa5cbf9c4a3d3dcad0b1e08c (patch)
treead9027fb48466d7faa6db2849d4538216aa4859a /drivers
parentf96159840bc5f605aca5113ab2d24308d3dc2eff (diff)
make /proc/acpi/ac_adapter dependent on ACPI_PROCFS
Do not provide /proc/acpi/ac_adapter if ACPI_PROCFS is not defined. This eliminates duplicated power adapters in HAL and makes it consistent with battery module Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru> Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/ac.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index e03de37a750d..1461dc9944a3 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -27,8 +27,10 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef CONFIG_ACPI_PROCFS
30#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
31#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#endif
32#include <linux/power_supply.h> 34#include <linux/power_supply.h>
33#include <acpi/acpi_bus.h> 35#include <acpi/acpi_bus.h>
34#include <acpi/acpi_drivers.h> 36#include <acpi/acpi_drivers.h>
@@ -49,12 +51,14 @@ MODULE_AUTHOR("Paul Diefenbaugh");
49MODULE_DESCRIPTION("ACPI AC Adapter Driver"); 51MODULE_DESCRIPTION("ACPI AC Adapter Driver");
50MODULE_LICENSE("GPL"); 52MODULE_LICENSE("GPL");
51 53
54#ifdef CONFIG_ACPI_PROCFS
52extern struct proc_dir_entry *acpi_lock_ac_dir(void); 55extern struct proc_dir_entry *acpi_lock_ac_dir(void);
53extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 56extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
57static int acpi_ac_open_fs(struct inode *inode, struct file *file);
58#endif
54 59
55static int acpi_ac_add(struct acpi_device *device); 60static int acpi_ac_add(struct acpi_device *device);
56static int acpi_ac_remove(struct acpi_device *device, int type); 61static int acpi_ac_remove(struct acpi_device *device, int type);
57static int acpi_ac_open_fs(struct inode *inode, struct file *file);
58 62
59const static struct acpi_device_id ac_device_ids[] = { 63const static struct acpi_device_id ac_device_ids[] = {
60 {"ACPI0003", 0}, 64 {"ACPI0003", 0},
@@ -80,12 +84,15 @@ struct acpi_ac {
80 84
81#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); 85#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
82 86
87#ifdef CONFIG_ACPI_PROCFS
83static const struct file_operations acpi_ac_fops = { 88static const struct file_operations acpi_ac_fops = {
84 .open = acpi_ac_open_fs, 89 .open = acpi_ac_open_fs,
85 .read = seq_read, 90 .read = seq_read,
86 .llseek = seq_lseek, 91 .llseek = seq_lseek,
87 .release = single_release, 92 .release = single_release,
88}; 93};
94#endif
95
89static int get_ac_property(struct power_supply *psy, 96static int get_ac_property(struct power_supply *psy,
90 enum power_supply_property psp, 97 enum power_supply_property psp,
91 union power_supply_propval *val) 98 union power_supply_propval *val)
@@ -127,6 +134,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
127 return 0; 134 return 0;
128} 135}
129 136
137#ifdef CONFIG_ACPI_PROCFS
130/* -------------------------------------------------------------------------- 138/* --------------------------------------------------------------------------
131 FS Interface (/proc) 139 FS Interface (/proc)
132 -------------------------------------------------------------------------- */ 140 -------------------------------------------------------------------------- */
@@ -206,6 +214,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
206 214
207 return 0; 215 return 0;
208} 216}
217#endif
209 218
210/* -------------------------------------------------------------------------- 219/* --------------------------------------------------------------------------
211 Driver Model 220 Driver Model
@@ -264,7 +273,9 @@ static int acpi_ac_add(struct acpi_device *device)
264 if (result) 273 if (result)
265 goto end; 274 goto end;
266 275
276#ifdef CONFIG_ACPI_PROCFS
267 result = acpi_ac_add_fs(device); 277 result = acpi_ac_add_fs(device);
278#endif
268 if (result) 279 if (result)
269 goto end; 280 goto end;
270 ac->charger.name = acpi_device_bid(device); 281 ac->charger.name = acpi_device_bid(device);
@@ -287,7 +298,9 @@ static int acpi_ac_add(struct acpi_device *device)
287 298
288 end: 299 end:
289 if (result) { 300 if (result) {
301#ifdef CONFIG_ACPI_PROCFS
290 acpi_ac_remove_fs(device); 302 acpi_ac_remove_fs(device);
303#endif
291 kfree(ac); 304 kfree(ac);
292 } 305 }
293 306
@@ -309,7 +322,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
309 ACPI_ALL_NOTIFY, acpi_ac_notify); 322 ACPI_ALL_NOTIFY, acpi_ac_notify);
310 if (ac->charger.dev) 323 if (ac->charger.dev)
311 power_supply_unregister(&ac->charger); 324 power_supply_unregister(&ac->charger);
325#ifdef CONFIG_ACPI_PROCFS
312 acpi_ac_remove_fs(device); 326 acpi_ac_remove_fs(device);
327#endif
313 328
314 kfree(ac); 329 kfree(ac);
315 330
@@ -323,13 +338,17 @@ static int __init acpi_ac_init(void)
323 if (acpi_disabled) 338 if (acpi_disabled)
324 return -ENODEV; 339 return -ENODEV;
325 340
341#ifdef CONFIG_ACPI_PROCFS
326 acpi_ac_dir = acpi_lock_ac_dir(); 342 acpi_ac_dir = acpi_lock_ac_dir();
327 if (!acpi_ac_dir) 343 if (!acpi_ac_dir)
328 return -ENODEV; 344 return -ENODEV;
345#endif
329 346
330 result = acpi_bus_register_driver(&acpi_ac_driver); 347 result = acpi_bus_register_driver(&acpi_ac_driver);
331 if (result < 0) { 348 if (result < 0) {
349#ifdef CONFIG_ACPI_PROCFS
332 acpi_unlock_ac_dir(acpi_ac_dir); 350 acpi_unlock_ac_dir(acpi_ac_dir);
351#endif
333 return -ENODEV; 352 return -ENODEV;
334 } 353 }
335 354
@@ -341,7 +360,9 @@ static void __exit acpi_ac_exit(void)
341 360
342 acpi_bus_unregister_driver(&acpi_ac_driver); 361 acpi_bus_unregister_driver(&acpi_ac_driver);
343 362
363#ifdef CONFIG_ACPI_PROCFS
344 acpi_unlock_ac_dir(acpi_ac_dir); 364 acpi_unlock_ac_dir(acpi_ac_dir);
365#endif
345 366
346 return; 367 return;
347} 368}