ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / acpi / bus.c
1 /*
2  *  acpi_bus.c - ACPI Bus Driver ($Revision: 80 $)
3  *
4  *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
5  *
6  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or (at
11  *  your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful, but
14  *  WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License along
19  *  with this program; if not, write to the Free Software Foundation, Inc.,
20  *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21  *
22  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23  */
24
25 #include <linux/init.h>
26 #include <linux/ioport.h>
27 #include <linux/list.h>
28 #include <linux/sched.h>
29 #include <linux/pm.h>
30 #include <linux/device.h>
31 #include <linux/proc_fs.h>
32 #ifdef CONFIG_X86
33 #include <asm/mpspec.h>
34 #endif
35 #include <acpi/acpi_bus.h>
36 #include <acpi/acpi_drivers.h>
37
38
39 #define _COMPONENT              ACPI_BUS_COMPONENT
40 ACPI_MODULE_NAME                ("acpi_bus")
41
42 #ifdef  CONFIG_X86
43 extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
44 #endif
45
46 FADT_DESCRIPTOR                 acpi_fadt;
47 struct acpi_device              *acpi_root;
48 struct proc_dir_entry           *acpi_root_dir;
49
50 #define STRUCT_TO_INT(s)        (*((int*)&s))
51
52 /* --------------------------------------------------------------------------
53                                 Device Management
54    -------------------------------------------------------------------------- */
55
56 extern void acpi_bus_data_handler (
57         acpi_handle             handle,
58         u32                     function,
59         void                    *context);
60 int
61 acpi_bus_get_device (
62         acpi_handle             handle,
63         struct acpi_device      **device)
64 {
65         acpi_status             status = AE_OK;
66
67         ACPI_FUNCTION_TRACE("acpi_bus_get_device");
68
69         if (!device)
70                 return_VALUE(-EINVAL);
71
72         /* TBD: Support fixed-feature devices */
73
74         status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device);
75         if (ACPI_FAILURE(status) || !*device) {
76                 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context for object [%p]\n",
77                         handle));
78                 return_VALUE(-ENODEV);
79         }
80
81         return_VALUE(0);
82 }
83
84 int
85 acpi_bus_get_status (
86         struct acpi_device      *device)
87 {
88         acpi_status             status = AE_OK;
89         unsigned long           sta = 0;
90         
91         ACPI_FUNCTION_TRACE("acpi_bus_get_status");
92
93         if (!device)
94                 return_VALUE(-EINVAL);
95
96         /*
97          * Evaluate _STA if present.
98          */
99         if (device->flags.dynamic_status) {
100                 status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
101                 if (ACPI_FAILURE(status))
102                         return_VALUE(-ENODEV);
103                 STRUCT_TO_INT(device->status) = (int) sta;
104         }
105
106         /*
107          * Otherwise we assume the status of our parent (unless we don't
108          * have one, in which case status is implied).
109          */
110         else if (device->parent)
111                 device->status = device->parent->status;
112         else
113                 STRUCT_TO_INT(device->status) = 0x0F;
114
115         ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 
116                 device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
117
118         return_VALUE(0);
119 }
120
121
122 /* --------------------------------------------------------------------------
123                                  Power Management
124    -------------------------------------------------------------------------- */
125
126 int
127 acpi_bus_get_power (
128         acpi_handle             handle,
129         int                     *state)
130 {
131         int                     result = 0;
132         acpi_status             status = 0;
133         struct acpi_device      *device = NULL;
134         unsigned long           psc = 0;
135
136         ACPI_FUNCTION_TRACE("acpi_bus_get_power");
137
138         result = acpi_bus_get_device(handle, &device);
139         if (result)
140                 return_VALUE(result);
141
142         *state = ACPI_STATE_UNKNOWN;
143
144         if (!device->flags.power_manageable) {
145                 /* TBD: Non-recursive algorithm for walking up hierarchy */
146                 if (device->parent)
147                         *state = device->parent->power.state;
148                 else
149                         *state = ACPI_STATE_D0;
150         }
151         else {
152                 /*
153                  * Get the device's power state either directly (via _PSC) or 
154                  * indirectly (via power resources).
155                  */
156                 if (device->power.flags.explicit_get) {
157                         status = acpi_evaluate_integer(device->handle, "_PSC", 
158                                 NULL, &psc);
159                         if (ACPI_FAILURE(status))
160                                 return_VALUE(-ENODEV);
161                         device->power.state = (int) psc;
162                 }
163                 else if (device->power.flags.power_resources) {
164                         result = acpi_power_get_inferred_state(device);
165                         if (result)
166                                 return_VALUE(result);
167                 }
168
169                 *state = device->power.state;
170         }
171
172         ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
173                 device->pnp.bus_id, device->power.state));
174
175         return_VALUE(0);
176 }
177
178
179 int
180 acpi_bus_set_power (
181         acpi_handle             handle,
182         int                     state)
183 {
184         int                     result = 0;
185         acpi_status             status = AE_OK;
186         struct acpi_device      *device = NULL;
187         char                    object_name[5] = {'_','P','S','0'+state,'\0'};
188
189         ACPI_FUNCTION_TRACE("acpi_bus_set_power");
190
191         result = acpi_bus_get_device(handle, &device);
192         if (result)
193                 return_VALUE(result);
194
195         if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
196                 return_VALUE(-EINVAL);
197
198         /* Make sure this is a valid target state */
199
200         if (!device->flags.power_manageable) {
201                 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
202                 return_VALUE(-ENODEV);
203         }
204         if (state == device->power.state) {
205                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
206                 return_VALUE(0);
207         }
208         if (!device->power.states[state].flags.valid) {
209                 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state));
210                 return_VALUE(-ENODEV);
211         }
212         if (device->parent && (state < device->parent->power.state)) {
213                 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n"));
214                 return_VALUE(-ENODEV);
215         }
216
217         /*
218          * Transition Power
219          * ----------------
220          * On transitions to a high-powered state we first apply power (via
221          * power resources) then evalute _PSx.  Conversly for transitions to
222          * a lower-powered state.
223          */ 
224         if (state < device->power.state) {
225                 if (device->power.flags.power_resources) {
226                         result = acpi_power_transition(device, state);
227                         if (result)
228                                 goto end;
229                 }
230                 if (device->power.states[state].flags.explicit_set) {
231                         status = acpi_evaluate_object(device->handle, 
232                                 object_name, NULL, NULL);
233                         if (ACPI_FAILURE(status)) {
234                                 result = -ENODEV;
235                                 goto end;
236                         }
237                 }
238         }
239         else {
240                 if (device->power.states[state].flags.explicit_set) {
241                         status = acpi_evaluate_object(device->handle, 
242                                 object_name, NULL, NULL);
243                         if (ACPI_FAILURE(status)) {
244                                 result = -ENODEV;
245                                 goto end;
246                         }
247                 }
248                 if (device->power.flags.power_resources) {
249                         result = acpi_power_transition(device, state);
250                         if (result)
251                                 goto end;
252                 }
253         }
254
255 end:
256         if (result)
257                 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
258                         device->pnp.bus_id, state));
259         else
260                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n",
261                         device->pnp.bus_id, state));
262
263         return_VALUE(result);
264 }
265
266
267
268 /* --------------------------------------------------------------------------
269                                 Event Management
270    -------------------------------------------------------------------------- */
271
272 static spinlock_t               acpi_bus_event_lock = SPIN_LOCK_UNLOCKED;
273
274 LIST_HEAD(acpi_bus_event_list);
275 DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
276
277 extern int                      event_is_open;
278
279 int
280 acpi_bus_generate_event (
281         struct acpi_device      *device,
282         u8                      type,
283         int                     data)
284 {
285         struct acpi_bus_event   *event = NULL;
286         unsigned long           flags = 0;
287
288         ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
289
290         if (!device)
291                 return_VALUE(-EINVAL);
292
293         /* drop event on the floor if no one's listening */
294         if (!event_is_open)
295                 return_VALUE(0);
296
297         event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
298         if (!event)
299                 return_VALUE(-ENOMEM);
300
301         strcpy(event->device_class, device->pnp.device_class);
302         strcpy(event->bus_id, device->pnp.bus_id);
303         event->type = type;
304         event->data = data;
305
306         spin_lock_irqsave(&acpi_bus_event_lock, flags);
307         list_add_tail(&event->node, &acpi_bus_event_list);
308         spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
309
310         wake_up_interruptible(&acpi_bus_event_queue);
311
312         return_VALUE(0);
313 }
314
315 int
316 acpi_bus_receive_event (
317         struct acpi_bus_event   *event)
318 {
319         unsigned long           flags = 0;
320         struct acpi_bus_event   *entry = NULL;
321
322         DECLARE_WAITQUEUE(wait, current);
323
324         ACPI_FUNCTION_TRACE("acpi_bus_receive_event");
325
326         if (!event)
327                 return -EINVAL;
328
329         if (list_empty(&acpi_bus_event_list)) {
330
331                 set_current_state(TASK_INTERRUPTIBLE);
332                 add_wait_queue(&acpi_bus_event_queue, &wait);
333
334                 if (list_empty(&acpi_bus_event_list))
335                         schedule();
336
337                 remove_wait_queue(&acpi_bus_event_queue, &wait);
338                 set_current_state(TASK_RUNNING);
339
340                 if (signal_pending(current))
341                         return_VALUE(-ERESTARTSYS);
342         }
343
344         spin_lock_irqsave(&acpi_bus_event_lock, flags);
345         entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
346         if (entry)
347                 list_del(&entry->node);
348         spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
349
350         if (!entry)
351                 return_VALUE(-ENODEV);
352
353         memcpy(event, entry, sizeof(struct acpi_bus_event));
354
355         kfree(entry);
356
357         return_VALUE(0);
358 }
359
360
361 /* --------------------------------------------------------------------------
362                              Notification Handling
363    -------------------------------------------------------------------------- */
364
365 static int
366 acpi_bus_check_device (
367         struct acpi_device      *device,
368         int                     *status_changed)
369 {
370         acpi_status             status = 0;
371         struct acpi_device_status old_status;
372
373         ACPI_FUNCTION_TRACE("acpi_bus_check_device");
374
375         if (!device)
376                 return_VALUE(-EINVAL);
377
378         if (status_changed)
379                 *status_changed = 0;
380
381         old_status = device->status;
382
383         /*
384          * Make sure this device's parent is present before we go about
385          * messing with the device.
386          */
387         if (device->parent && !device->parent->status.present) {
388                 device->status = device->parent->status;
389                 if (STRUCT_TO_INT(old_status) != STRUCT_TO_INT(device->status)) {
390                         if (status_changed)
391                                 *status_changed = 1;
392                 }
393                 return_VALUE(0);
394         }
395
396         status = acpi_bus_get_status(device);
397         if (ACPI_FAILURE(status))
398                 return_VALUE(-ENODEV);
399
400         if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
401                 return_VALUE(0);
402
403         if (status_changed)
404                 *status_changed = 1;
405         
406         /*
407          * Device Insertion/Removal
408          */
409         if ((device->status.present) && !(old_status.present)) {
410                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
411                 /* TBD: Handle device insertion */
412         }
413         else if (!(device->status.present) && (old_status.present)) {
414                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
415                 /* TBD: Handle device removal */
416         }
417
418         return_VALUE(0);
419 }
420
421
422 static int
423 acpi_bus_check_scope (
424         struct acpi_device      *device)
425 {
426         int                     result = 0;
427         int                     status_changed = 0;
428
429         ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
430
431         if (!device)
432                 return_VALUE(-EINVAL);
433
434         /* Status Change? */
435         result = acpi_bus_check_device(device, &status_changed);
436         if (result)
437                 return_VALUE(result);
438
439         if (!status_changed)
440                 return_VALUE(0);
441
442         /*
443          * TBD: Enumerate child devices within this device's scope and
444          *       run acpi_bus_check_device()'s on them.
445          */
446
447         return_VALUE(0);
448 }
449
450
451 /**
452  * acpi_bus_notify
453  * ---------------
454  * Callback for all 'system-level' device notifications (values 0x00-0x7F).
455  */
456 static void 
457 acpi_bus_notify (
458         acpi_handle             handle,
459         u32                     type,
460         void                    *data)
461 {
462         int                     result = 0;
463         struct acpi_device      *device = NULL;
464
465         ACPI_FUNCTION_TRACE("acpi_bus_notify");
466
467         if (acpi_bus_get_device(handle, &device))
468                 return_VOID;
469
470         switch (type) {
471
472         case ACPI_NOTIFY_BUS_CHECK:
473                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n", 
474                         device->pnp.bus_id));
475                 result = acpi_bus_check_scope(device);
476                 /* 
477                  * TBD: We'll need to outsource certain events to non-ACPI
478                  *      drivers via the device manager (device.c).
479                  */
480                 break;
481
482         case ACPI_NOTIFY_DEVICE_CHECK:
483                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n", 
484                         device->pnp.bus_id));
485                 result = acpi_bus_check_device(device, NULL);
486                 /* 
487                  * TBD: We'll need to outsource certain events to non-ACPI
488                  *      drivers via the device manager (device.c).
489                  */
490                 break;
491
492         case ACPI_NOTIFY_DEVICE_WAKE:
493                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n", 
494                         device->pnp.bus_id));
495                 /* TBD */
496                 break;
497
498         case ACPI_NOTIFY_EJECT_REQUEST:
499                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n", 
500                         device->pnp.bus_id));
501                 /* TBD */
502                 break;
503
504         case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
505                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n", 
506                         device->pnp.bus_id));
507                 /* TBD: Exactly what does 'light' mean? */
508                 break;
509
510         case ACPI_NOTIFY_FREQUENCY_MISMATCH:
511                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n", 
512                         device->pnp.bus_id));
513                 /* TBD */
514                 break;
515
516         case ACPI_NOTIFY_BUS_MODE_MISMATCH:
517                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n", 
518                         device->pnp.bus_id));
519                 /* TBD */
520                 break;
521
522         case ACPI_NOTIFY_POWER_FAULT:
523                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n", 
524                         device->pnp.bus_id));
525                 /* TBD */
526                 break;
527
528         default:
529                 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n", 
530                         type));
531                 break;
532         }
533
534         return_VOID;
535 }
536
537 /* --------------------------------------------------------------------------
538                              Initialization/Cleanup
539    -------------------------------------------------------------------------- */
540
541 static int __init
542 acpi_bus_init_irq (void)
543 {
544         acpi_status             status = AE_OK;
545         union acpi_object       arg = {ACPI_TYPE_INTEGER};
546         struct acpi_object_list arg_list = {1, &arg};
547         char                    *message = NULL;
548
549         ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
550
551         /* 
552          * Let the system know what interrupt model we are using by
553          * evaluating the \_PIC object, if exists.
554          */
555
556         switch (acpi_irq_model) {
557         case ACPI_IRQ_MODEL_PIC:
558                 message = "PIC";
559                 break;
560         case ACPI_IRQ_MODEL_IOAPIC:
561                 message = "IOAPIC";
562                 break;
563         case ACPI_IRQ_MODEL_IOSAPIC:
564                 message = "IOSAPIC";
565                 break;
566         default:
567                 printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n");
568                 return_VALUE(-ENODEV);
569         }
570
571         printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message);
572
573         arg.integer.value = acpi_irq_model;
574
575         status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL);
576         if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
577                 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PIC\n"));
578                 return_VALUE(-ENODEV);
579         }
580
581         return_VALUE(0);
582 }
583
584
585 static int __init
586 acpi_bus_init (void)
587 {
588         int                     result = 0;
589         acpi_status             status = AE_OK;
590         struct acpi_buffer      buffer = {sizeof(acpi_fadt), &acpi_fadt};
591
592         ACPI_FUNCTION_TRACE("acpi_bus_init");
593
594         status = acpi_initialize_subsystem();
595         if (ACPI_FAILURE(status)) {
596                 printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
597                 goto error0;
598         }
599
600         status = acpi_load_tables();
601         if (ACPI_FAILURE(status)) {
602                 printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
603                 goto error0;
604         }
605
606         /*
607          * Get a separate copy of the FADT for use by other drivers.
608          */
609         status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer);
610         if (ACPI_FAILURE(status)) {
611                 printk(KERN_ERR PREFIX "Unable to get the FADT\n");
612                 goto error1;
613         }
614
615 #ifdef CONFIG_X86
616         if (!acpi_ioapic) {
617                 extern acpi_interrupt_flags acpi_sci_flags;
618
619                 /* compatible (0) means level (3) */
620                 if (acpi_sci_flags.trigger == 0)
621                         acpi_sci_flags.trigger = 3;
622
623                 /* Set PIC-mode SCI trigger type */
624                 acpi_pic_sci_set_trigger(acpi_fadt.sci_int, acpi_sci_flags.trigger);
625         } else {
626                 extern int acpi_sci_override_gsi;
627                 /*
628                  * now that acpi_fadt is initialized,
629                  * update it with result from INT_SRC_OVR parsing
630                  */
631                 acpi_fadt.sci_int = acpi_sci_override_gsi;
632         }
633 #endif
634
635         status = acpi_enable_subsystem(ACPI_FULL_INITIALIZATION);
636         if (ACPI_FAILURE(status)) {
637                 printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
638                 goto error1;
639         }
640
641 #ifdef CONFIG_ACPI_EC
642         /*
643          * ACPI 2.0 requires the EC driver to be loaded and work before
644          * the EC device is found in the namespace (i.e. before acpi_initialize_objects()
645          * is called).
646          *
647          * This is accomplished by looking for the ECDT table, and getting 
648          * the EC parameters out of that.
649          */
650         status = acpi_ec_ecdt_probe();
651         /* Ignore result. Not having an ECDT is not fatal. */
652 #endif
653
654         status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION);
655         if (ACPI_FAILURE(status)) {
656                 printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
657                 goto error1;
658         }
659
660         printk(KERN_INFO PREFIX "Interpreter enabled\n");
661
662         /*
663          * Get the system interrupt model and evaluate \_PIC.
664          */
665         result = acpi_bus_init_irq();
666         if (result)
667                 goto error1;
668
669         /*
670          * Register the for all standard device notifications.
671          */
672         status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
673         if (ACPI_FAILURE(status)) {
674                 printk(KERN_ERR PREFIX "Unable to register for device notifications\n");
675                 goto error1;
676         }
677
678         /*
679          * Create the top ACPI proc directory
680          */
681         acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL);
682
683         return_VALUE(0);
684
685         /* Mimic structured exception handling */
686 error1:
687         acpi_terminate();
688 error0:
689         return_VALUE(-ENODEV);
690 }
691
692 decl_subsys(acpi,NULL,NULL);
693
694 static int __init acpi_init (void)
695 {
696         int                     result = 0;
697
698         ACPI_FUNCTION_TRACE("acpi_init");
699
700         printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
701                 ACPI_CA_VERSION);
702
703         /* Initial core debug level excludes drivers, so include them now */
704         acpi_set_debug(ACPI_DEBUG_LOW);
705
706         if (acpi_disabled) {
707                 printk(KERN_INFO PREFIX "Interpreter disabled.\n");
708                 return -ENODEV;
709         }
710
711         firmware_register(&acpi_subsys);
712
713         result = acpi_bus_init();
714
715         if (!result) {
716 #ifdef CONFIG_PM
717                 if (!PM_IS_ACTIVE())
718                         pm_active = 1;
719                 else {
720                         printk(KERN_INFO PREFIX "APM is already active, exiting\n");
721                         disable_acpi();
722                         result = -ENODEV;
723                 }
724 #endif
725         } else
726                 disable_acpi();
727
728         return_VALUE(result);
729 }
730
731 subsys_initcall(acpi_init);