aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2017-08-11 02:36:28 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-19 12:12:04 -0400
commit56f77eeb6bcae29871d33b8328c6834340ee8a41 (patch)
treebe4bdd05d53fb43412a8bdf45eeb0dafdd236861
parent69b957c26b32c3407d1b8cc0d2390b271728db8a (diff)
ACPI / EC: Clean up EC GPE mask flag
EC_FLAGS_COMMAND_STORM is actually used to mask GPE during IRQ processing. This patch cleans it up using more readable flag/function names. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Tested-by: Tomislav Ivek <tomislav.ivek@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/ec.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 7ea7aa9701e3..fdfae6f3c0b1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -112,8 +112,7 @@ enum {
112 EC_FLAGS_EVT_HANDLER_INSTALLED, /* _Qxx handlers installed */ 112 EC_FLAGS_EVT_HANDLER_INSTALLED, /* _Qxx handlers installed */
113 EC_FLAGS_STARTED, /* Driver is started */ 113 EC_FLAGS_STARTED, /* Driver is started */
114 EC_FLAGS_STOPPED, /* Driver is stopped */ 114 EC_FLAGS_STOPPED, /* Driver is stopped */
115 EC_FLAGS_COMMAND_STORM, /* GPE storms occurred to the 115 EC_FLAGS_GPE_MASKED, /* GPE masked */
116 * current command processing */
117}; 116};
118 117
119#define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */ 118#define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */
@@ -425,19 +424,19 @@ static void acpi_ec_complete_request(struct acpi_ec *ec)
425 wake_up(&ec->wait); 424 wake_up(&ec->wait);
426} 425}
427 426
428static void acpi_ec_set_storm(struct acpi_ec *ec, u8 flag) 427static void acpi_ec_mask_gpe(struct acpi_ec *ec)
429{ 428{
430 if (!test_bit(flag, &ec->flags)) { 429 if (!test_bit(EC_FLAGS_GPE_MASKED, &ec->flags)) {
431 acpi_ec_disable_gpe(ec, false); 430 acpi_ec_disable_gpe(ec, false);
432 ec_dbg_drv("Polling enabled"); 431 ec_dbg_drv("Polling enabled");
433 set_bit(flag, &ec->flags); 432 set_bit(EC_FLAGS_GPE_MASKED, &ec->flags);
434 } 433 }
435} 434}
436 435
437static void acpi_ec_clear_storm(struct acpi_ec *ec, u8 flag) 436static void acpi_ec_unmask_gpe(struct acpi_ec *ec)
438{ 437{
439 if (test_bit(flag, &ec->flags)) { 438 if (test_bit(EC_FLAGS_GPE_MASKED, &ec->flags)) {
440 clear_bit(flag, &ec->flags); 439 clear_bit(EC_FLAGS_GPE_MASKED, &ec->flags);
441 acpi_ec_enable_gpe(ec, false); 440 acpi_ec_enable_gpe(ec, false);
442 ec_dbg_drv("Polling disabled"); 441 ec_dbg_drv("Polling disabled");
443 } 442 }
@@ -464,7 +463,7 @@ static bool acpi_ec_submit_flushable_request(struct acpi_ec *ec)
464 463
465static void acpi_ec_submit_query(struct acpi_ec *ec) 464static void acpi_ec_submit_query(struct acpi_ec *ec)
466{ 465{
467 acpi_ec_set_storm(ec, EC_FLAGS_COMMAND_STORM); 466 acpi_ec_mask_gpe(ec);
468 if (!acpi_ec_event_enabled(ec)) 467 if (!acpi_ec_event_enabled(ec))
469 return; 468 return;
470 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { 469 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) {
@@ -480,7 +479,7 @@ static void acpi_ec_complete_query(struct acpi_ec *ec)
480 if (test_and_clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) 479 if (test_and_clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
481 ec_dbg_evt("Command(%s) unblocked", 480 ec_dbg_evt("Command(%s) unblocked",
482 acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); 481 acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY));
483 acpi_ec_clear_storm(ec, EC_FLAGS_COMMAND_STORM); 482 acpi_ec_unmask_gpe(ec);
484} 483}
485 484
486static inline void __acpi_ec_enable_event(struct acpi_ec *ec) 485static inline void __acpi_ec_enable_event(struct acpi_ec *ec)
@@ -700,7 +699,7 @@ err:
700 ++t->irq_count; 699 ++t->irq_count;
701 /* Allow triggering on 0 threshold */ 700 /* Allow triggering on 0 threshold */
702 if (t->irq_count == ec_storm_threshold) 701 if (t->irq_count == ec_storm_threshold)
703 acpi_ec_set_storm(ec, EC_FLAGS_COMMAND_STORM); 702 acpi_ec_mask_gpe(ec);
704 } 703 }
705 } 704 }
706out: 705out:
@@ -798,7 +797,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
798 797
799 spin_lock_irqsave(&ec->lock, tmp); 798 spin_lock_irqsave(&ec->lock, tmp);
800 if (t->irq_count == ec_storm_threshold) 799 if (t->irq_count == ec_storm_threshold)
801 acpi_ec_clear_storm(ec, EC_FLAGS_COMMAND_STORM); 800 acpi_ec_unmask_gpe(ec);
802 ec_dbg_req("Command(%s) stopped", acpi_ec_cmd_string(t->command)); 801 ec_dbg_req("Command(%s) stopped", acpi_ec_cmd_string(t->command));
803 ec->curr = NULL; 802 ec->curr = NULL;
804 /* Disable GPE for command processing (IBF=0/OBF=1) */ 803 /* Disable GPE for command processing (IBF=0/OBF=1) */