aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ec.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index acfe8830da14..a85f795ab4ec 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -104,6 +104,7 @@ struct acpi_ec {
104 unsigned long data_addr; 104 unsigned long data_addr;
105 unsigned long global_lock; 105 unsigned long global_lock;
106 struct semaphore sem; 106 struct semaphore sem;
107 atomic_t query_pending;
107 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ 108 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */
108 wait_queue_head_t wait; 109 wait_queue_head_t wait;
109} *ec_ecdt; 110} *ec_ecdt;
@@ -257,6 +258,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
257 command); 258 command);
258 goto end; 259 goto end;
259 } 260 }
261 } else if (command == ACPI_EC_COMMAND_QUERY) {
262 atomic_set(&ec->query_pending, 0);
260 } 263 }
261 264
262 for (; rdata_len > 0; rdata_len --) { 265 for (; rdata_len > 0; rdata_len --) {
@@ -425,17 +428,9 @@ static void acpi_ec_gpe_query(void *ec_cxt)
425{ 428{
426 struct acpi_ec *ec = (struct acpi_ec *)ec_cxt; 429 struct acpi_ec *ec = (struct acpi_ec *)ec_cxt;
427 u8 value = 0; 430 u8 value = 0;
428 static char object_name[8]; 431 char object_name[8];
429 432
430 if (!ec) 433 if (!ec || acpi_ec_query(ec, &value))
431 return;
432
433 value = acpi_ec_read_status(ec);
434
435 if (!(value & ACPI_EC_FLAG_SCI))
436 return;
437
438 if (acpi_ec_query(ec, &value))
439 return; 434 return;
440 435
441 snprintf(object_name, 8, "_Q%2.2X", value); 436 snprintf(object_name, 8, "_Q%2.2X", value);
@@ -457,7 +452,8 @@ static u32 acpi_ec_gpe_handler(void *data)
457 } 452 }
458 453
459 value = acpi_ec_read_status(ec); 454 value = acpi_ec_read_status(ec);
460 if (value & ACPI_EC_FLAG_SCI) { 455 if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) {
456 atomic_set(&ec->query_pending, 1);
461 status = acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); 457 status = acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec);
462 } 458 }
463 459
@@ -652,6 +648,7 @@ static int acpi_ec_add(struct acpi_device *device)
652 ec->handle = device->handle; 648 ec->handle = device->handle;
653 ec->uid = -1; 649 ec->uid = -1;
654 init_MUTEX(&ec->sem); 650 init_MUTEX(&ec->sem);
651 atomic_set(&ec->query_pending, 0);
655 if (acpi_ec_mode == EC_INTR) { 652 if (acpi_ec_mode == EC_INTR) {
656 atomic_set(&ec->leaving_burst, 1); 653 atomic_set(&ec->leaving_burst, 1);
657 init_waitqueue_head(&ec->wait); 654 init_waitqueue_head(&ec->wait);