@@ -206,13 +206,13 @@ static void advance_transaction(struct acpi_ec *ec, u8 status)
206
206
spin_unlock_irqrestore (& ec -> lock , flags );
207
207
}
208
208
209
- static int acpi_ec_sync_query (struct acpi_ec * ec );
209
+ static int acpi_ec_sync_query (struct acpi_ec * ec , u8 * data );
210
210
211
211
static int ec_check_sci_sync (struct acpi_ec * ec , u8 state )
212
212
{
213
213
if (state & ACPI_EC_FLAG_SCI ) {
214
214
if (!test_and_set_bit (EC_FLAGS_QUERY_PENDING , & ec -> flags ))
215
- return acpi_ec_sync_query (ec );
215
+ return acpi_ec_sync_query (ec , NULL );
216
216
}
217
217
return 0 ;
218
218
}
@@ -443,10 +443,8 @@ acpi_handle ec_get_handle(void)
443
443
444
444
EXPORT_SYMBOL (ec_get_handle );
445
445
446
- static int acpi_ec_query_unlocked (struct acpi_ec * ec , u8 * data );
447
-
448
446
/*
449
- * Clears stale _Q events that might have accumulated in the EC.
447
+ * Process _Q events that might have accumulated in the EC.
450
448
* Run with locked ec mutex.
451
449
*/
452
450
static void acpi_ec_clear (struct acpi_ec * ec )
@@ -455,7 +453,7 @@ static void acpi_ec_clear(struct acpi_ec *ec)
455
453
u8 value = 0 ;
456
454
457
455
for (i = 0 ; i < ACPI_EC_CLEAR_MAX ; i ++ ) {
458
- status = acpi_ec_query_unlocked (ec , & value );
456
+ status = acpi_ec_sync_query (ec , & value );
459
457
if (status || !value )
460
458
break ;
461
459
}
@@ -582,13 +580,18 @@ static void acpi_ec_run(void *cxt)
582
580
kfree (handler );
583
581
}
584
582
585
- static int acpi_ec_sync_query (struct acpi_ec * ec )
583
+ static int acpi_ec_sync_query (struct acpi_ec * ec , u8 * data )
586
584
{
587
585
u8 value = 0 ;
588
586
int status ;
589
587
struct acpi_ec_query_handler * handler , * copy ;
590
- if ((status = acpi_ec_query_unlocked (ec , & value )))
588
+
589
+ status = acpi_ec_query_unlocked (ec , & value );
590
+ if (data )
591
+ * data = value ;
592
+ if (status )
591
593
return status ;
594
+
592
595
list_for_each_entry (handler , & ec -> list , node ) {
593
596
if (value == handler -> query_bit ) {
594
597
/* have custom handler for this bit */
@@ -612,7 +615,7 @@ static void acpi_ec_gpe_query(void *ec_cxt)
612
615
if (!ec )
613
616
return ;
614
617
mutex_lock (& ec -> mutex );
615
- acpi_ec_sync_query (ec );
618
+ acpi_ec_sync_query (ec , NULL );
616
619
mutex_unlock (& ec -> mutex );
617
620
}
618
621
0 commit comments