ACPICA: Fail AcpiEnable if ACPI tables not loaded.
[pandora-kernel.git] / drivers / acpi / events / evxfevnt.c
1 /******************************************************************************
2  *
3  * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2006, R. Byron Moore
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43
44 #include <acpi/acpi.h>
45 #include <acpi/acevents.h>
46 #include <acpi/acnamesp.h>
47
48 #define _COMPONENT          ACPI_EVENTS
49 ACPI_MODULE_NAME("evxfevnt")
50
51 /*******************************************************************************
52  *
53  * FUNCTION:    acpi_enable
54  *
55  * PARAMETERS:  None
56  *
57  * RETURN:      Status
58  *
59  * DESCRIPTION: Transfers the system into ACPI mode.
60  *
61  ******************************************************************************/
62 acpi_status acpi_enable(void)
63 {
64         acpi_status status = AE_OK;
65
66         ACPI_FUNCTION_TRACE(acpi_enable);
67
68         /* ACPI tables must be present */
69
70         if (!acpi_tb_tables_loaded()) {
71                 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
72         }
73
74         /* Check current mode */
75
76         if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
77                 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
78                                   "System is already in ACPI mode\n"));
79         } else {
80                 /* Transition to ACPI mode */
81
82                 status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
83                 if (ACPI_FAILURE(status)) {
84                         ACPI_ERROR((AE_INFO,
85                                     "Could not transition to ACPI mode"));
86                         return_ACPI_STATUS(status);
87                 }
88
89                 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
90                                   "Transition to ACPI mode successful\n"));
91         }
92
93         return_ACPI_STATUS(status);
94 }
95
96 ACPI_EXPORT_SYMBOL(acpi_enable)
97
98 /*******************************************************************************
99  *
100  * FUNCTION:    acpi_disable
101  *
102  * PARAMETERS:  None
103  *
104  * RETURN:      Status
105  *
106  * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
107  *
108  ******************************************************************************/
109 acpi_status acpi_disable(void)
110 {
111         acpi_status status = AE_OK;
112
113         ACPI_FUNCTION_TRACE(acpi_disable);
114
115         if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
116                 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
117                                   "System is already in legacy (non-ACPI) mode\n"));
118         } else {
119                 /* Transition to LEGACY mode */
120
121                 status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
122
123                 if (ACPI_FAILURE(status)) {
124                         ACPI_ERROR((AE_INFO,
125                                     "Could not exit ACPI mode to legacy mode"));
126                         return_ACPI_STATUS(status);
127                 }
128
129                 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
130         }
131
132         return_ACPI_STATUS(status);
133 }
134
135 ACPI_EXPORT_SYMBOL(acpi_disable)
136
137 /*******************************************************************************
138  *
139  * FUNCTION:    acpi_enable_event
140  *
141  * PARAMETERS:  Event           - The fixed eventto be enabled
142  *              Flags           - Reserved
143  *
144  * RETURN:      Status
145  *
146  * DESCRIPTION: Enable an ACPI event (fixed)
147  *
148  ******************************************************************************/
149 acpi_status acpi_enable_event(u32 event, u32 flags)
150 {
151         acpi_status status = AE_OK;
152         u32 value;
153
154         ACPI_FUNCTION_TRACE(acpi_enable_event);
155
156         /* Decode the Fixed Event */
157
158         if (event > ACPI_EVENT_MAX) {
159                 return_ACPI_STATUS(AE_BAD_PARAMETER);
160         }
161
162         /*
163          * Enable the requested fixed event (by writing a one to the
164          * enable register bit)
165          */
166         status =
167             acpi_set_register(acpi_gbl_fixed_event_info[event].
168                               enable_register_id, 1);
169         if (ACPI_FAILURE(status)) {
170                 return_ACPI_STATUS(status);
171         }
172
173         /* Make sure that the hardware responded */
174
175         status =
176             acpi_get_register(acpi_gbl_fixed_event_info[event].
177                               enable_register_id, &value);
178         if (ACPI_FAILURE(status)) {
179                 return_ACPI_STATUS(status);
180         }
181
182         if (value != 1) {
183                 ACPI_ERROR((AE_INFO,
184                             "Could not enable %s event",
185                             acpi_ut_get_event_name(event)));
186                 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
187         }
188
189         return_ACPI_STATUS(status);
190 }
191
192 ACPI_EXPORT_SYMBOL(acpi_enable_event)
193
194 /*******************************************************************************
195  *
196  * FUNCTION:    acpi_set_gpe_type
197  *
198  * PARAMETERS:  gpe_device      - Parent GPE Device
199  *              gpe_number      - GPE level within the GPE block
200  *              Type            - New GPE type
201  *
202  * RETURN:      Status
203  *
204  * DESCRIPTION: Set the type of an individual GPE
205  *
206  ******************************************************************************/
207 acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
208 {
209         acpi_status status = AE_OK;
210         struct acpi_gpe_event_info *gpe_event_info;
211
212         ACPI_FUNCTION_TRACE(acpi_set_gpe_type);
213
214         /* Ensure that we have a valid GPE number */
215
216         gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
217         if (!gpe_event_info) {
218                 status = AE_BAD_PARAMETER;
219                 goto unlock_and_exit;
220         }
221
222         if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) {
223                 return_ACPI_STATUS(AE_OK);
224         }
225
226         /* Set the new type (will disable GPE if currently enabled) */
227
228         status = acpi_ev_set_gpe_type(gpe_event_info, type);
229
230       unlock_and_exit:
231         return_ACPI_STATUS(status);
232 }
233
234 ACPI_EXPORT_SYMBOL(acpi_set_gpe_type)
235
236 /*******************************************************************************
237  *
238  * FUNCTION:    acpi_enable_gpe
239  *
240  * PARAMETERS:  gpe_device      - Parent GPE Device
241  *              gpe_number      - GPE level within the GPE block
242  *              Flags           - Just enable, or also wake enable?
243  *                                Called from ISR or not
244  *
245  * RETURN:      Status
246  *
247  * DESCRIPTION: Enable an ACPI event (general purpose)
248  *
249  ******************************************************************************/
250 acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
251 {
252         acpi_status status = AE_OK;
253         struct acpi_gpe_event_info *gpe_event_info;
254
255         ACPI_FUNCTION_TRACE(acpi_enable_gpe);
256
257         /* Use semaphore lock if not executing at interrupt level */
258
259         if (flags & ACPI_NOT_ISR) {
260                 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
261                 if (ACPI_FAILURE(status)) {
262                         return_ACPI_STATUS(status);
263                 }
264         }
265
266         /* Ensure that we have a valid GPE number */
267
268         gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
269         if (!gpe_event_info) {
270                 status = AE_BAD_PARAMETER;
271                 goto unlock_and_exit;
272         }
273
274         /* Perform the enable */
275
276         status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
277
278       unlock_and_exit:
279         if (flags & ACPI_NOT_ISR) {
280                 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
281         }
282         return_ACPI_STATUS(status);
283 }
284
285 ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
286
287 /*******************************************************************************
288  *
289  * FUNCTION:    acpi_disable_gpe
290  *
291  * PARAMETERS:  gpe_device      - Parent GPE Device
292  *              gpe_number      - GPE level within the GPE block
293  *              Flags           - Just disable, or also wake disable?
294  *                                Called from ISR or not
295  *
296  * RETURN:      Status
297  *
298  * DESCRIPTION: Disable an ACPI event (general purpose)
299  *
300  ******************************************************************************/
301 acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
302 {
303         acpi_status status = AE_OK;
304         struct acpi_gpe_event_info *gpe_event_info;
305
306         ACPI_FUNCTION_TRACE(acpi_disable_gpe);
307
308         /* Use semaphore lock if not executing at interrupt level */
309
310         if (flags & ACPI_NOT_ISR) {
311                 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
312                 if (ACPI_FAILURE(status)) {
313                         return_ACPI_STATUS(status);
314                 }
315         }
316
317         /* Ensure that we have a valid GPE number */
318
319         gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
320         if (!gpe_event_info) {
321                 status = AE_BAD_PARAMETER;
322                 goto unlock_and_exit;
323         }
324
325         status = acpi_ev_disable_gpe(gpe_event_info);
326
327       unlock_and_exit:
328         if (flags & ACPI_NOT_ISR) {
329                 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
330         }
331         return_ACPI_STATUS(status);
332 }
333
334 ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
335
336 /*******************************************************************************
337  *
338  * FUNCTION:    acpi_disable_event
339  *
340  * PARAMETERS:  Event           - The fixed eventto be enabled
341  *              Flags           - Reserved
342  *
343  * RETURN:      Status
344  *
345  * DESCRIPTION: Disable an ACPI event (fixed)
346  *
347  ******************************************************************************/
348 acpi_status acpi_disable_event(u32 event, u32 flags)
349 {
350         acpi_status status = AE_OK;
351         u32 value;
352
353         ACPI_FUNCTION_TRACE(acpi_disable_event);
354
355         /* Decode the Fixed Event */
356
357         if (event > ACPI_EVENT_MAX) {
358                 return_ACPI_STATUS(AE_BAD_PARAMETER);
359         }
360
361         /*
362          * Disable the requested fixed event (by writing a zero to the
363          * enable register bit)
364          */
365         status =
366             acpi_set_register(acpi_gbl_fixed_event_info[event].
367                               enable_register_id, 0);
368         if (ACPI_FAILURE(status)) {
369                 return_ACPI_STATUS(status);
370         }
371
372         status =
373             acpi_get_register(acpi_gbl_fixed_event_info[event].
374                               enable_register_id, &value);
375         if (ACPI_FAILURE(status)) {
376                 return_ACPI_STATUS(status);
377         }
378
379         if (value != 0) {
380                 ACPI_ERROR((AE_INFO,
381                             "Could not disable %s events",
382                             acpi_ut_get_event_name(event)));
383                 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
384         }
385
386         return_ACPI_STATUS(status);
387 }
388
389 ACPI_EXPORT_SYMBOL(acpi_disable_event)
390
391 /*******************************************************************************
392  *
393  * FUNCTION:    acpi_clear_event
394  *
395  * PARAMETERS:  Event           - The fixed event to be cleared
396  *
397  * RETURN:      Status
398  *
399  * DESCRIPTION: Clear an ACPI event (fixed)
400  *
401  ******************************************************************************/
402 acpi_status acpi_clear_event(u32 event)
403 {
404         acpi_status status = AE_OK;
405
406         ACPI_FUNCTION_TRACE(acpi_clear_event);
407
408         /* Decode the Fixed Event */
409
410         if (event > ACPI_EVENT_MAX) {
411                 return_ACPI_STATUS(AE_BAD_PARAMETER);
412         }
413
414         /*
415          * Clear the requested fixed event (By writing a one to the
416          * status register bit)
417          */
418         status =
419             acpi_set_register(acpi_gbl_fixed_event_info[event].
420                               status_register_id, 1);
421
422         return_ACPI_STATUS(status);
423 }
424
425 ACPI_EXPORT_SYMBOL(acpi_clear_event)
426
427 /*******************************************************************************
428  *
429  * FUNCTION:    acpi_clear_gpe
430  *
431  * PARAMETERS:  gpe_device      - Parent GPE Device
432  *              gpe_number      - GPE level within the GPE block
433  *              Flags           - Called from an ISR or not
434  *
435  * RETURN:      Status
436  *
437  * DESCRIPTION: Clear an ACPI event (general purpose)
438  *
439  ******************************************************************************/
440 acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
441 {
442         acpi_status status = AE_OK;
443         struct acpi_gpe_event_info *gpe_event_info;
444
445         ACPI_FUNCTION_TRACE(acpi_clear_gpe);
446
447         /* Use semaphore lock if not executing at interrupt level */
448
449         if (flags & ACPI_NOT_ISR) {
450                 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
451                 if (ACPI_FAILURE(status)) {
452                         return_ACPI_STATUS(status);
453                 }
454         }
455
456         /* Ensure that we have a valid GPE number */
457
458         gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
459         if (!gpe_event_info) {
460                 status = AE_BAD_PARAMETER;
461                 goto unlock_and_exit;
462         }
463
464         status = acpi_hw_clear_gpe(gpe_event_info);
465
466       unlock_and_exit:
467         if (flags & ACPI_NOT_ISR) {
468                 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
469         }
470         return_ACPI_STATUS(status);
471 }
472
473 ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
474
475 #ifdef ACPI_FUTURE_USAGE
476 /*******************************************************************************
477  *
478  * FUNCTION:    acpi_get_event_status
479  *
480  * PARAMETERS:  Event           - The fixed event
481  *              event_status    - Where the current status of the event will
482  *                                be returned
483  *
484  * RETURN:      Status
485  *
486  * DESCRIPTION: Obtains and returns the current status of the event
487  *
488  ******************************************************************************/
489 acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
490 {
491         acpi_status status = AE_OK;
492
493         ACPI_FUNCTION_TRACE(acpi_get_event_status);
494
495         if (!event_status) {
496                 return_ACPI_STATUS(AE_BAD_PARAMETER);
497         }
498
499         /* Decode the Fixed Event */
500
501         if (event > ACPI_EVENT_MAX) {
502                 return_ACPI_STATUS(AE_BAD_PARAMETER);
503         }
504
505         /* Get the status of the requested fixed event */
506
507         status =
508             acpi_get_register(acpi_gbl_fixed_event_info[event].
509                               status_register_id, event_status);
510
511         return_ACPI_STATUS(status);
512 }
513
514 ACPI_EXPORT_SYMBOL(acpi_get_event_status)
515
516 /*******************************************************************************
517  *
518  * FUNCTION:    acpi_get_gpe_status
519  *
520  * PARAMETERS:  gpe_device      - Parent GPE Device
521  *              gpe_number      - GPE level within the GPE block
522  *              Flags           - Called from an ISR or not
523  *              event_status    - Where the current status of the event will
524  *                                be returned
525  *
526  * RETURN:      Status
527  *
528  * DESCRIPTION: Get status of an event (general purpose)
529  *
530  ******************************************************************************/
531 acpi_status
532 acpi_get_gpe_status(acpi_handle gpe_device,
533                     u32 gpe_number, u32 flags, acpi_event_status * event_status)
534 {
535         acpi_status status = AE_OK;
536         struct acpi_gpe_event_info *gpe_event_info;
537
538         ACPI_FUNCTION_TRACE(acpi_get_gpe_status);
539
540         /* Use semaphore lock if not executing at interrupt level */
541
542         if (flags & ACPI_NOT_ISR) {
543                 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
544                 if (ACPI_FAILURE(status)) {
545                         return_ACPI_STATUS(status);
546                 }
547         }
548
549         /* Ensure that we have a valid GPE number */
550
551         gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
552         if (!gpe_event_info) {
553                 status = AE_BAD_PARAMETER;
554                 goto unlock_and_exit;
555         }
556
557         /* Obtain status on the requested GPE number */
558
559         status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
560
561       unlock_and_exit:
562         if (flags & ACPI_NOT_ISR) {
563                 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
564         }
565         return_ACPI_STATUS(status);
566 }
567
568 ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
569 #endif                          /*  ACPI_FUTURE_USAGE  */
570
571 /*******************************************************************************
572  *
573  * FUNCTION:    acpi_install_gpe_block
574  *
575  * PARAMETERS:  gpe_device          - Handle to the parent GPE Block Device
576  *              gpe_block_address   - Address and space_iD
577  *              register_count      - Number of GPE register pairs in the block
578  *              interrupt_number    - H/W interrupt for the block
579  *
580  * RETURN:      Status
581  *
582  * DESCRIPTION: Create and Install a block of GPE registers
583  *
584  ******************************************************************************/
585 acpi_status
586 acpi_install_gpe_block(acpi_handle gpe_device,
587                        struct acpi_generic_address *gpe_block_address,
588                        u32 register_count, u32 interrupt_number)
589 {
590         acpi_status status;
591         union acpi_operand_object *obj_desc;
592         struct acpi_namespace_node *node;
593         struct acpi_gpe_block_info *gpe_block;
594
595         ACPI_FUNCTION_TRACE(acpi_install_gpe_block);
596
597         if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
598                 return_ACPI_STATUS(AE_BAD_PARAMETER);
599         }
600
601         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
602         if (ACPI_FAILURE(status)) {
603                 return (status);
604         }
605
606         node = acpi_ns_map_handle_to_node(gpe_device);
607         if (!node) {
608                 status = AE_BAD_PARAMETER;
609                 goto unlock_and_exit;
610         }
611
612         /*
613          * For user-installed GPE Block Devices, the gpe_block_base_number
614          * is always zero
615          */
616         status =
617             acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
618                                      interrupt_number, &gpe_block);
619         if (ACPI_FAILURE(status)) {
620                 goto unlock_and_exit;
621         }
622
623         /* Run the _PRW methods and enable the GPEs */
624
625         status = acpi_ev_initialize_gpe_block(node, gpe_block);
626         if (ACPI_FAILURE(status)) {
627                 goto unlock_and_exit;
628         }
629
630         /* Get the device_object attached to the node */
631
632         obj_desc = acpi_ns_get_attached_object(node);
633         if (!obj_desc) {
634
635                 /* No object, create a new one */
636
637                 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
638                 if (!obj_desc) {
639                         status = AE_NO_MEMORY;
640                         goto unlock_and_exit;
641                 }
642
643                 status =
644                     acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
645
646                 /* Remove local reference to the object */
647
648                 acpi_ut_remove_reference(obj_desc);
649
650                 if (ACPI_FAILURE(status)) {
651                         goto unlock_and_exit;
652                 }
653         }
654
655         /* Install the GPE block in the device_object */
656
657         obj_desc->device.gpe_block = gpe_block;
658
659       unlock_and_exit:
660         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
661         return_ACPI_STATUS(status);
662 }
663
664 ACPI_EXPORT_SYMBOL(acpi_install_gpe_block)
665
666 /*******************************************************************************
667  *
668  * FUNCTION:    acpi_remove_gpe_block
669  *
670  * PARAMETERS:  gpe_device          - Handle to the parent GPE Block Device
671  *
672  * RETURN:      Status
673  *
674  * DESCRIPTION: Remove a previously installed block of GPE registers
675  *
676  ******************************************************************************/
677 acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
678 {
679         union acpi_operand_object *obj_desc;
680         acpi_status status;
681         struct acpi_namespace_node *node;
682
683         ACPI_FUNCTION_TRACE(acpi_remove_gpe_block);
684
685         if (!gpe_device) {
686                 return_ACPI_STATUS(AE_BAD_PARAMETER);
687         }
688
689         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
690         if (ACPI_FAILURE(status)) {
691                 return (status);
692         }
693
694         node = acpi_ns_map_handle_to_node(gpe_device);
695         if (!node) {
696                 status = AE_BAD_PARAMETER;
697                 goto unlock_and_exit;
698         }
699
700         /* Get the device_object attached to the node */
701
702         obj_desc = acpi_ns_get_attached_object(node);
703         if (!obj_desc || !obj_desc->device.gpe_block) {
704                 return_ACPI_STATUS(AE_NULL_OBJECT);
705         }
706
707         /* Delete the GPE block (but not the device_object) */
708
709         status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
710         if (ACPI_SUCCESS(status)) {
711                 obj_desc->device.gpe_block = NULL;
712         }
713
714       unlock_and_exit:
715         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
716         return_ACPI_STATUS(status);
717 }
718
719 ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)