aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/power.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/power.c')
-rw-r--r--drivers/acpi/power.c271
1 files changed, 116 insertions, 155 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 373a3a95bb4e..62a5595ed8bc 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -44,10 +44,8 @@
44#include <acpi/acpi_bus.h> 44#include <acpi/acpi_bus.h>
45#include <acpi/acpi_drivers.h> 45#include <acpi/acpi_drivers.h>
46 46
47
48#define _COMPONENT ACPI_POWER_COMPONENT 47#define _COMPONENT ACPI_POWER_COMPONENT
49ACPI_MODULE_NAME ("acpi_power") 48ACPI_MODULE_NAME("acpi_power")
50
51#define ACPI_POWER_COMPONENT 0x00800000 49#define ACPI_POWER_COMPONENT 0x00800000
52#define ACPI_POWER_CLASS "power_resource" 50#define ACPI_POWER_CLASS "power_resource"
53#define ACPI_POWER_DRIVER_NAME "ACPI Power Resource Driver" 51#define ACPI_POWER_DRIVER_NAME "ACPI Power Resource Driver"
@@ -57,38 +55,36 @@ ACPI_MODULE_NAME ("acpi_power")
57#define ACPI_POWER_RESOURCE_STATE_OFF 0x00 55#define ACPI_POWER_RESOURCE_STATE_OFF 0x00
58#define ACPI_POWER_RESOURCE_STATE_ON 0x01 56#define ACPI_POWER_RESOURCE_STATE_ON 0x01
59#define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF 57#define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
60 58static int acpi_power_add(struct acpi_device *device);
61static int acpi_power_add (struct acpi_device *device); 59static int acpi_power_remove(struct acpi_device *device, int type);
62static int acpi_power_remove (struct acpi_device *device, int type);
63static int acpi_power_open_fs(struct inode *inode, struct file *file); 60static int acpi_power_open_fs(struct inode *inode, struct file *file);
64 61
65static struct acpi_driver acpi_power_driver = { 62static struct acpi_driver acpi_power_driver = {
66 .name = ACPI_POWER_DRIVER_NAME, 63 .name = ACPI_POWER_DRIVER_NAME,
67 .class = ACPI_POWER_CLASS, 64 .class = ACPI_POWER_CLASS,
68 .ids = ACPI_POWER_HID, 65 .ids = ACPI_POWER_HID,
69 .ops = { 66 .ops = {
70 .add = acpi_power_add, 67 .add = acpi_power_add,
71 .remove = acpi_power_remove, 68 .remove = acpi_power_remove,
72 }, 69 },
73}; 70};
74 71
75struct acpi_power_resource 72struct acpi_power_resource {
76{ 73 acpi_handle handle;
77 acpi_handle handle; 74 acpi_bus_id name;
78 acpi_bus_id name; 75 u32 system_level;
79 u32 system_level; 76 u32 order;
80 u32 order; 77 int state;
81 int state; 78 int references;
82 int references;
83}; 79};
84 80
85static struct list_head acpi_power_resource_list; 81static struct list_head acpi_power_resource_list;
86 82
87static struct file_operations acpi_power_fops = { 83static struct file_operations acpi_power_fops = {
88 .open = acpi_power_open_fs, 84 .open = acpi_power_open_fs,
89 .read = seq_read, 85 .read = seq_read,
90 .llseek = seq_lseek, 86 .llseek = seq_lseek,
91 .release = single_release, 87 .release = single_release,
92}; 88};
93 89
94/* -------------------------------------------------------------------------- 90/* --------------------------------------------------------------------------
@@ -96,12 +92,11 @@ static struct file_operations acpi_power_fops = {
96 -------------------------------------------------------------------------- */ 92 -------------------------------------------------------------------------- */
97 93
98static int 94static int
99acpi_power_get_context ( 95acpi_power_get_context(acpi_handle handle,
100 acpi_handle handle, 96 struct acpi_power_resource **resource)
101 struct acpi_power_resource **resource)
102{ 97{
103 int result = 0; 98 int result = 0;
104 struct acpi_device *device = NULL; 99 struct acpi_device *device = NULL;
105 100
106 ACPI_FUNCTION_TRACE("acpi_power_get_context"); 101 ACPI_FUNCTION_TRACE("acpi_power_get_context");
107 102
@@ -111,24 +106,21 @@ acpi_power_get_context (
111 result = acpi_bus_get_device(handle, &device); 106 result = acpi_bus_get_device(handle, &device);
112 if (result) { 107 if (result) {
113 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n", 108 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n",
114 handle)); 109 handle));
115 return_VALUE(result); 110 return_VALUE(result);
116 } 111 }
117 112
118 *resource = (struct acpi_power_resource *) acpi_driver_data(device); 113 *resource = (struct acpi_power_resource *)acpi_driver_data(device);
119 if (!resource) 114 if (!resource)
120 return_VALUE(-ENODEV); 115 return_VALUE(-ENODEV);
121 116
122 return_VALUE(0); 117 return_VALUE(0);
123} 118}
124 119
125 120static int acpi_power_get_state(struct acpi_power_resource *resource)
126static int
127acpi_power_get_state (
128 struct acpi_power_resource *resource)
129{ 121{
130 acpi_status status = AE_OK; 122 acpi_status status = AE_OK;
131 unsigned long sta = 0; 123 unsigned long sta = 0;
132 124
133 ACPI_FUNCTION_TRACE("acpi_power_get_state"); 125 ACPI_FUNCTION_TRACE("acpi_power_get_state");
134 126
@@ -145,20 +137,16 @@ acpi_power_get_state (
145 resource->state = ACPI_POWER_RESOURCE_STATE_OFF; 137 resource->state = ACPI_POWER_RESOURCE_STATE_OFF;
146 138
147 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", 139 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
148 resource->name, resource->state?"on":"off")); 140 resource->name, resource->state ? "on" : "off"));
149 141
150 return_VALUE(0); 142 return_VALUE(0);
151} 143}
152 144
153 145static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
154static int
155acpi_power_get_list_state (
156 struct acpi_handle_list *list,
157 int *state)
158{ 146{
159 int result = 0; 147 int result = 0;
160 struct acpi_power_resource *resource = NULL; 148 struct acpi_power_resource *resource = NULL;
161 u32 i = 0; 149 u32 i = 0;
162 150
163 ACPI_FUNCTION_TRACE("acpi_power_get_list_state"); 151 ACPI_FUNCTION_TRACE("acpi_power_get_list_state");
164 152
@@ -167,7 +155,7 @@ acpi_power_get_list_state (
167 155
168 /* The state of the list is 'on' IFF all resources are 'on'. */ 156 /* The state of the list is 'on' IFF all resources are 'on'. */
169 157
170 for (i=0; i<list->count; i++) { 158 for (i = 0; i < list->count; i++) {
171 result = acpi_power_get_context(list->handles[i], &resource); 159 result = acpi_power_get_context(list->handles[i], &resource);
172 if (result) 160 if (result)
173 return_VALUE(result); 161 return_VALUE(result);
@@ -182,19 +170,16 @@ acpi_power_get_list_state (
182 } 170 }
183 171
184 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", 172 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n",
185 *state?"on":"off")); 173 *state ? "on" : "off"));
186 174
187 return_VALUE(result); 175 return_VALUE(result);
188} 176}
189 177
190 178static int acpi_power_on(acpi_handle handle)
191static int
192acpi_power_on (
193 acpi_handle handle)
194{ 179{
195 int result = 0; 180 int result = 0;
196 acpi_status status = AE_OK; 181 acpi_status status = AE_OK;
197 struct acpi_device *device = NULL; 182 struct acpi_device *device = NULL;
198 struct acpi_power_resource *resource = NULL; 183 struct acpi_power_resource *resource = NULL;
199 184
200 ACPI_FUNCTION_TRACE("acpi_power_on"); 185 ACPI_FUNCTION_TRACE("acpi_power_on");
@@ -205,10 +190,10 @@ acpi_power_on (
205 190
206 resource->references++; 191 resource->references++;
207 192
208 if ((resource->references > 1) 193 if ((resource->references > 1)
209 || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { 194 || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) {
210 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", 195 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n",
211 resource->name)); 196 resource->name));
212 return_VALUE(0); 197 return_VALUE(0);
213 } 198 }
214 199
@@ -229,19 +214,16 @@ acpi_power_on (
229 device->power.state = ACPI_STATE_D0; 214 device->power.state = ACPI_STATE_D0;
230 215
231 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", 216 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
232 resource->name)); 217 resource->name));
233 218
234 return_VALUE(0); 219 return_VALUE(0);
235} 220}
236 221
237 222static int acpi_power_off_device(acpi_handle handle)
238static int
239acpi_power_off_device (
240 acpi_handle handle)
241{ 223{
242 int result = 0; 224 int result = 0;
243 acpi_status status = AE_OK; 225 acpi_status status = AE_OK;
244 struct acpi_device *device = NULL; 226 struct acpi_device *device = NULL;
245 struct acpi_power_resource *resource = NULL; 227 struct acpi_power_resource *resource = NULL;
246 228
247 ACPI_FUNCTION_TRACE("acpi_power_off_device"); 229 ACPI_FUNCTION_TRACE("acpi_power_off_device");
@@ -254,15 +236,15 @@ acpi_power_off_device (
254 resource->references--; 236 resource->references--;
255 237
256 if (resource->references) { 238 if (resource->references) {
257 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 239 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
258 "Resource [%s] is still in use, dereferencing\n", 240 "Resource [%s] is still in use, dereferencing\n",
259 device->pnp.bus_id)); 241 device->pnp.bus_id));
260 return_VALUE(0); 242 return_VALUE(0);
261 } 243 }
262 244
263 if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { 245 if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) {
264 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", 246 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n",
265 device->pnp.bus_id)); 247 device->pnp.bus_id));
266 return_VALUE(0); 248 return_VALUE(0);
267 } 249 }
268 250
@@ -283,7 +265,7 @@ acpi_power_off_device (
283 device->power.state = ACPI_STATE_D3; 265 device->power.state = ACPI_STATE_D3;
284 266
285 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", 267 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
286 resource->name)); 268 resource->name));
287 269
288 return_VALUE(0); 270 return_VALUE(0);
289} 271}
@@ -293,13 +275,13 @@ acpi_power_off_device (
293 * 1. Power on the power resources required for the wakeup device 275 * 1. Power on the power resources required for the wakeup device
294 * 2. Enable _PSW (power state wake) for the device if present 276 * 2. Enable _PSW (power state wake) for the device if present
295 */ 277 */
296int acpi_enable_wakeup_device_power (struct acpi_device *dev) 278int acpi_enable_wakeup_device_power(struct acpi_device *dev)
297{ 279{
298 union acpi_object arg = {ACPI_TYPE_INTEGER}; 280 union acpi_object arg = { ACPI_TYPE_INTEGER };
299 struct acpi_object_list arg_list = {1, &arg}; 281 struct acpi_object_list arg_list = { 1, &arg };
300 acpi_status status = AE_OK; 282 acpi_status status = AE_OK;
301 int i; 283 int i;
302 int ret = 0; 284 int ret = 0;
303 285
304 ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power"); 286 ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power");
305 if (!dev || !dev->wakeup.flags.valid) 287 if (!dev || !dev->wakeup.flags.valid)
@@ -310,8 +292,8 @@ int acpi_enable_wakeup_device_power (struct acpi_device *dev)
310 for (i = 0; i < dev->wakeup.resources.count; i++) { 292 for (i = 0; i < dev->wakeup.resources.count; i++) {
311 ret = acpi_power_on(dev->wakeup.resources.handles[i]); 293 ret = acpi_power_on(dev->wakeup.resources.handles[i]);
312 if (ret) { 294 if (ret) {
313 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 295 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
314 "Error transition power state\n")); 296 "Error transition power state\n"));
315 dev->wakeup.flags.valid = 0; 297 dev->wakeup.flags.valid = 0;
316 return_VALUE(-1); 298 return_VALUE(-1);
317 } 299 }
@@ -333,20 +315,20 @@ int acpi_enable_wakeup_device_power (struct acpi_device *dev)
333 * 1. Disable _PSW (power state wake) 315 * 1. Disable _PSW (power state wake)
334 * 2. Shutdown down the power resources 316 * 2. Shutdown down the power resources
335 */ 317 */
336int acpi_disable_wakeup_device_power (struct acpi_device *dev) 318int acpi_disable_wakeup_device_power(struct acpi_device *dev)
337{ 319{
338 union acpi_object arg = {ACPI_TYPE_INTEGER}; 320 union acpi_object arg = { ACPI_TYPE_INTEGER };
339 struct acpi_object_list arg_list = {1, &arg}; 321 struct acpi_object_list arg_list = { 1, &arg };
340 acpi_status status = AE_OK; 322 acpi_status status = AE_OK;
341 int i; 323 int i;
342 int ret = 0; 324 int ret = 0;
343 325
344 ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power"); 326 ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power");
345 327
346 if (!dev || !dev->wakeup.flags.valid) 328 if (!dev || !dev->wakeup.flags.valid)
347 return_VALUE(-1); 329 return_VALUE(-1);
348 330
349 arg.integer.value = 0; 331 arg.integer.value = 0;
350 /* Execute PSW */ 332 /* Execute PSW */
351 status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); 333 status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL);
352 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { 334 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
@@ -359,8 +341,8 @@ int acpi_disable_wakeup_device_power (struct acpi_device *dev)
359 for (i = 0; i < dev->wakeup.resources.count; i++) { 341 for (i = 0; i < dev->wakeup.resources.count; i++) {
360 ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); 342 ret = acpi_power_off_device(dev->wakeup.resources.handles[i]);
361 if (ret) { 343 if (ret) {
362 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 344 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
363 "Error transition power state\n")); 345 "Error transition power state\n"));
364 dev->wakeup.flags.valid = 0; 346 dev->wakeup.flags.valid = 0;
365 return_VALUE(-1); 347 return_VALUE(-1);
366 } 348 }
@@ -373,14 +355,12 @@ int acpi_disable_wakeup_device_power (struct acpi_device *dev)
373 Device Power Management 355 Device Power Management
374 -------------------------------------------------------------------------- */ 356 -------------------------------------------------------------------------- */
375 357
376int 358int acpi_power_get_inferred_state(struct acpi_device *device)
377acpi_power_get_inferred_state (
378 struct acpi_device *device)
379{ 359{
380 int result = 0; 360 int result = 0;
381 struct acpi_handle_list *list = NULL; 361 struct acpi_handle_list *list = NULL;
382 int list_state = 0; 362 int list_state = 0;
383 int i = 0; 363 int i = 0;
384 364
385 ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state"); 365 ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state");
386 366
@@ -393,7 +373,7 @@ acpi_power_get_inferred_state (
393 * We know a device's inferred power state when all the resources 373 * We know a device's inferred power state when all the resources
394 * required for a given D-state are 'on'. 374 * required for a given D-state are 'on'.
395 */ 375 */
396 for (i=ACPI_STATE_D0; i<ACPI_STATE_D3; i++) { 376 for (i = ACPI_STATE_D0; i < ACPI_STATE_D3; i++) {
397 list = &device->power.states[i].resources; 377 list = &device->power.states[i].resources;
398 if (list->count < 1) 378 if (list->count < 1)
399 continue; 379 continue;
@@ -413,23 +393,20 @@ acpi_power_get_inferred_state (
413 return_VALUE(0); 393 return_VALUE(0);
414} 394}
415 395
416 396int acpi_power_transition(struct acpi_device *device, int state)
417int
418acpi_power_transition (
419 struct acpi_device *device,
420 int state)
421{ 397{
422 int result = 0; 398 int result = 0;
423 struct acpi_handle_list *cl = NULL; /* Current Resources */ 399 struct acpi_handle_list *cl = NULL; /* Current Resources */
424 struct acpi_handle_list *tl = NULL; /* Target Resources */ 400 struct acpi_handle_list *tl = NULL; /* Target Resources */
425 int i = 0; 401 int i = 0;
426 402
427 ACPI_FUNCTION_TRACE("acpi_power_transition"); 403 ACPI_FUNCTION_TRACE("acpi_power_transition");
428 404
429 if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) 405 if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
430 return_VALUE(-EINVAL); 406 return_VALUE(-EINVAL);
431 407
432 if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3)) 408 if ((device->power.state < ACPI_STATE_D0)
409 || (device->power.state > ACPI_STATE_D3))
433 return_VALUE(-ENODEV); 410 return_VALUE(-ENODEV);
434 411
435 cl = &device->power.states[device->power.state].resources; 412 cl = &device->power.states[device->power.state].resources;
@@ -448,7 +425,7 @@ acpi_power_transition (
448 * First we reference all power resources required in the target list 425 * First we reference all power resources required in the target list
449 * (e.g. so the device doesn't lose power while transitioning). 426 * (e.g. so the device doesn't lose power while transitioning).
450 */ 427 */
451 for (i=0; i<tl->count; i++) { 428 for (i = 0; i < tl->count; i++) {
452 result = acpi_power_on(tl->handles[i]); 429 result = acpi_power_on(tl->handles[i]);
453 if (result) 430 if (result)
454 goto end; 431 goto end;
@@ -457,7 +434,7 @@ acpi_power_transition (
457 /* 434 /*
458 * Then we dereference all power resources used in the current list. 435 * Then we dereference all power resources used in the current list.
459 */ 436 */
460 for (i=0; i<cl->count; i++) { 437 for (i = 0; i < cl->count; i++) {
461 result = acpi_power_off_device(cl->handles[i]); 438 result = acpi_power_off_device(cl->handles[i]);
462 if (result) 439 if (result)
463 goto end; 440 goto end;
@@ -465,21 +442,20 @@ acpi_power_transition (
465 442
466 /* We shouldn't change the state till all above operations succeed */ 443 /* We shouldn't change the state till all above operations succeed */
467 device->power.state = state; 444 device->power.state = state;
468end: 445 end:
469 if (result) 446 if (result)
470 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 447 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
471 "Error transitioning device [%s] to D%d\n", 448 "Error transitioning device [%s] to D%d\n",
472 device->pnp.bus_id, state)); 449 device->pnp.bus_id, state));
473 450
474 return_VALUE(result); 451 return_VALUE(result);
475} 452}
476 453
477
478/* -------------------------------------------------------------------------- 454/* --------------------------------------------------------------------------
479 FS Interface (/proc) 455 FS Interface (/proc)
480 -------------------------------------------------------------------------- */ 456 -------------------------------------------------------------------------- */
481 457
482static struct proc_dir_entry *acpi_power_dir; 458static struct proc_dir_entry *acpi_power_dir;
483 459
484static int acpi_power_seq_show(struct seq_file *seq, void *offset) 460static int acpi_power_seq_show(struct seq_file *seq, void *offset)
485{ 461{
@@ -506,13 +482,12 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
506 } 482 }
507 483
508 seq_printf(seq, "system level: S%d\n" 484 seq_printf(seq, "system level: S%d\n"
509 "order: %d\n" 485 "order: %d\n"
510 "reference count: %d\n", 486 "reference count: %d\n",
511 resource->system_level, 487 resource->system_level,
512 resource->order, 488 resource->order, resource->references);
513 resource->references);
514 489
515end: 490 end:
516 return_VALUE(0); 491 return_VALUE(0);
517} 492}
518 493
@@ -521,11 +496,9 @@ static int acpi_power_open_fs(struct inode *inode, struct file *file)
521 return single_open(file, acpi_power_seq_show, PDE(inode)->data); 496 return single_open(file, acpi_power_seq_show, PDE(inode)->data);
522} 497}
523 498
524static int 499static int acpi_power_add_fs(struct acpi_device *device)
525acpi_power_add_fs (
526 struct acpi_device *device)
527{ 500{
528 struct proc_dir_entry *entry = NULL; 501 struct proc_dir_entry *entry = NULL;
529 502
530 ACPI_FUNCTION_TRACE("acpi_power_add_fs"); 503 ACPI_FUNCTION_TRACE("acpi_power_add_fs");
531 504
@@ -534,18 +507,18 @@ acpi_power_add_fs (
534 507
535 if (!acpi_device_dir(device)) { 508 if (!acpi_device_dir(device)) {
536 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 509 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
537 acpi_power_dir); 510 acpi_power_dir);
538 if (!acpi_device_dir(device)) 511 if (!acpi_device_dir(device))
539 return_VALUE(-ENODEV); 512 return_VALUE(-ENODEV);
540 } 513 }
541 514
542 /* 'status' [R] */ 515 /* 'status' [R] */
543 entry = create_proc_entry(ACPI_POWER_FILE_STATUS, 516 entry = create_proc_entry(ACPI_POWER_FILE_STATUS,
544 S_IRUGO, acpi_device_dir(device)); 517 S_IRUGO, acpi_device_dir(device));
545 if (!entry) 518 if (!entry)
546 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 519 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
547 "Unable to create '%s' fs entry\n", 520 "Unable to create '%s' fs entry\n",
548 ACPI_POWER_FILE_STATUS)); 521 ACPI_POWER_FILE_STATUS));
549 else { 522 else {
550 entry->proc_fops = &acpi_power_fops; 523 entry->proc_fops = &acpi_power_fops;
551 entry->data = acpi_driver_data(device); 524 entry->data = acpi_driver_data(device);
@@ -554,10 +527,7 @@ acpi_power_add_fs (
554 return_VALUE(0); 527 return_VALUE(0);
555} 528}
556 529
557 530static int acpi_power_remove_fs(struct acpi_device *device)
558static int
559acpi_power_remove_fs (
560 struct acpi_device *device)
561{ 531{
562 ACPI_FUNCTION_TRACE("acpi_power_remove_fs"); 532 ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
563 533
@@ -571,20 +541,17 @@ acpi_power_remove_fs (
571 return_VALUE(0); 541 return_VALUE(0);
572} 542}
573 543
574
575/* -------------------------------------------------------------------------- 544/* --------------------------------------------------------------------------
576 Driver Interface 545 Driver Interface
577 -------------------------------------------------------------------------- */ 546 -------------------------------------------------------------------------- */
578 547
579static int 548static int acpi_power_add(struct acpi_device *device)
580acpi_power_add (
581 struct acpi_device *device)
582{ 549{
583 int result = 0; 550 int result = 0;
584 acpi_status status = AE_OK; 551 acpi_status status = AE_OK;
585 struct acpi_power_resource *resource = NULL; 552 struct acpi_power_resource *resource = NULL;
586 union acpi_object acpi_object; 553 union acpi_object acpi_object;
587 struct acpi_buffer buffer = {sizeof(acpi_object), &acpi_object}; 554 struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object };
588 555
589 ACPI_FUNCTION_TRACE("acpi_power_add"); 556 ACPI_FUNCTION_TRACE("acpi_power_add");
590 557
@@ -630,22 +597,18 @@ acpi_power_add (
630 result = acpi_power_add_fs(device); 597 result = acpi_power_add_fs(device);
631 if (result) 598 if (result)
632 goto end; 599 goto end;
633 600
634 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), 601 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device),
635 acpi_device_bid(device), resource->state?"on":"off"); 602 acpi_device_bid(device), resource->state ? "on" : "off");
636 603
637end: 604 end:
638 if (result) 605 if (result)
639 kfree(resource); 606 kfree(resource);
640 607
641 return_VALUE(result); 608 return_VALUE(result);
642} 609}
643 610
644 611static int acpi_power_remove(struct acpi_device *device, int type)
645static int
646acpi_power_remove (
647 struct acpi_device *device,
648 int type)
649{ 612{
650 struct acpi_power_resource *resource = NULL; 613 struct acpi_power_resource *resource = NULL;
651 614
@@ -654,7 +617,7 @@ acpi_power_remove (
654 if (!device || !acpi_driver_data(device)) 617 if (!device || !acpi_driver_data(device))
655 return_VALUE(-EINVAL); 618 return_VALUE(-EINVAL);
656 619
657 resource = (struct acpi_power_resource *) acpi_driver_data(device); 620 resource = (struct acpi_power_resource *)acpi_driver_data(device);
658 621
659 acpi_power_remove_fs(device); 622 acpi_power_remove_fs(device);
660 623
@@ -663,10 +626,9 @@ acpi_power_remove (
663 return_VALUE(0); 626 return_VALUE(0);
664} 627}
665 628
666 629static int __init acpi_power_init(void)
667static int __init acpi_power_init (void)
668{ 630{
669 int result = 0; 631 int result = 0;
670 632
671 ACPI_FUNCTION_TRACE("acpi_power_init"); 633 ACPI_FUNCTION_TRACE("acpi_power_init");
672 634
@@ -689,4 +651,3 @@ static int __init acpi_power_init (void)
689} 651}
690 652
691subsys_initcall(acpi_power_init); 653subsys_initcall(acpi_power_init);
692