Merge branch 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / drivers / acpi / acpica / evgpeutil.c
index d3f5e1e2a2b14ba699fb78309c7c23e5f0949fab..4d764e847a08a7174202166ae5e360e0b2d2b811 100644 (file)
@@ -197,8 +197,9 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
  * FUNCTION:    acpi_ev_get_gpe_xrupt_block
  *
  * PARAMETERS:  interrupt_number            - Interrupt for a GPE block
+ *              gpe_xrupt_block             - Where the block is returned
  *
- * RETURN:      A GPE interrupt block
+ * RETURN:      Status
  *
  * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
  *              block per unique interrupt level used for GPEs. Should be
@@ -207,7 +208,9 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
  *
  ******************************************************************************/
 
-struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number)
+acpi_status
+acpi_ev_get_gpe_xrupt_block(u32 interrupt_number,
+                           struct acpi_gpe_xrupt_info ** gpe_xrupt_block)
 {
        struct acpi_gpe_xrupt_info *next_gpe_xrupt;
        struct acpi_gpe_xrupt_info *gpe_xrupt;
@@ -221,7 +224,8 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number)
        next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
        while (next_gpe_xrupt) {
                if (next_gpe_xrupt->interrupt_number == interrupt_number) {
-                       return_PTR(next_gpe_xrupt);
+                       *gpe_xrupt_block = next_gpe_xrupt;
+                       return_ACPI_STATUS(AE_OK);
                }
 
                next_gpe_xrupt = next_gpe_xrupt->next;
@@ -231,7 +235,7 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number)
 
        gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info));
        if (!gpe_xrupt) {
-               return_PTR(NULL);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        gpe_xrupt->interrupt_number = interrupt_number;
@@ -250,6 +254,7 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number)
        } else {
                acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
        }
+
        acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
        /* Install new interrupt handler if not SCI_INT */
@@ -259,14 +264,15 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number)
                                                           acpi_ev_gpe_xrupt_handler,
                                                           gpe_xrupt);
                if (ACPI_FAILURE(status)) {
-                       ACPI_ERROR((AE_INFO,
-                                   "Could not install GPE interrupt handler at level 0x%X",
-                                   interrupt_number));
-                       return_PTR(NULL);
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Could not install GPE interrupt handler at level 0x%X",
+                                       interrupt_number));
+                       return_ACPI_STATUS(status);
                }
        }
 
-       return_PTR(gpe_xrupt);
+       *gpe_xrupt_block = gpe_xrupt;
+       return_ACPI_STATUS(AE_OK);
 }
 
 /*******************************************************************************