ACPI: ec: Acquire Global Lock under EC mutex.
authorAlexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Thu, 7 Dec 2006 15:42:17 +0000 (18:42 +0300)
committerLen Brown <len.brown@intel.com>
Fri, 8 Dec 2006 07:56:07 +0000 (02:56 -0500)
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/ec.c

index 8ef74e7b3b9137259bce8c3dda7b747540d12848..4d17777110edbf7f16a0871d096ec2e0895409f5 100644 (file)
@@ -286,12 +286,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
         if (rdata)
                 memset(rdata, 0, rdata_len);
 
+       mutex_lock(&ec->lock);
        if (ec->global_lock) {
                status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
                if (ACPI_FAILURE(status))
                        return -ENODEV;
        }
-       mutex_lock(&ec->lock);
 
        /* Make sure GPE is enabled before doing transaction */
        acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
@@ -307,10 +307,10 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
                                               rdata, rdata_len);
 
 end:
-       mutex_unlock(&ec->lock);
 
        if (ec->global_lock)
                acpi_release_global_lock(glk);
+       mutex_unlock(&ec->lock);
 
        return status;
 }