ACPI / EC: Clean up EC GPE mask flag
authorLv Zheng <lv.zheng@intel.com>
Fri, 11 Aug 2017 06:36:28 +0000 (14:36 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 19 Aug 2017 16:12:04 +0000 (18:12 +0200)
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>
drivers/acpi/ec.c

index 7ea7aa9701e394c89909e87473a40ecacda4dd9c..fdfae6f3c0b1db36c8413fd14831fdfef751da30 100644 (file)
@@ -112,8 +112,7 @@ enum {
        EC_FLAGS_EVT_HANDLER_INSTALLED, /* _Qxx handlers installed */
        EC_FLAGS_STARTED,               /* Driver is started */
        EC_FLAGS_STOPPED,               /* Driver is stopped */
-       EC_FLAGS_COMMAND_STORM,         /* GPE storms occurred to the
-                                        * current command processing */
+       EC_FLAGS_GPE_MASKED,            /* GPE masked */
 };
 
 #define ACPI_EC_COMMAND_POLL           0x01 /* Available for command byte */
@@ -425,19 +424,19 @@ static void acpi_ec_complete_request(struct acpi_ec *ec)
                wake_up(&ec->wait);
 }
 
-static void acpi_ec_set_storm(struct acpi_ec *ec, u8 flag)
+static void acpi_ec_mask_gpe(struct acpi_ec *ec)
 {
-       if (!test_bit(flag, &ec->flags)) {
+       if (!test_bit(EC_FLAGS_GPE_MASKED, &ec->flags)) {
                acpi_ec_disable_gpe(ec, false);
                ec_dbg_drv("Polling enabled");
-               set_bit(flag, &ec->flags);
+               set_bit(EC_FLAGS_GPE_MASKED, &ec->flags);
        }
 }
 
-static void acpi_ec_clear_storm(struct acpi_ec *ec, u8 flag)
+static void acpi_ec_unmask_gpe(struct acpi_ec *ec)
 {
-       if (test_bit(flag, &ec->flags)) {
-               clear_bit(flag, &ec->flags);
+       if (test_bit(EC_FLAGS_GPE_MASKED, &ec->flags)) {
+               clear_bit(EC_FLAGS_GPE_MASKED, &ec->flags);
                acpi_ec_enable_gpe(ec, false);
                ec_dbg_drv("Polling disabled");
        }
@@ -464,7 +463,7 @@ static bool acpi_ec_submit_flushable_request(struct acpi_ec *ec)
 
 static void acpi_ec_submit_query(struct acpi_ec *ec)
 {
-       acpi_ec_set_storm(ec, EC_FLAGS_COMMAND_STORM);
+       acpi_ec_mask_gpe(ec);
        if (!acpi_ec_event_enabled(ec))
                return;
        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)
        if (test_and_clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
                ec_dbg_evt("Command(%s) unblocked",
                           acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY));
-       acpi_ec_clear_storm(ec, EC_FLAGS_COMMAND_STORM);
+       acpi_ec_unmask_gpe(ec);
 }
 
 static inline void __acpi_ec_enable_event(struct acpi_ec *ec)
@@ -700,7 +699,7 @@ err:
                                ++t->irq_count;
                        /* Allow triggering on 0 threshold */
                        if (t->irq_count == ec_storm_threshold)
-                               acpi_ec_set_storm(ec, EC_FLAGS_COMMAND_STORM);
+                               acpi_ec_mask_gpe(ec);
                }
        }
 out:
@@ -798,7 +797,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
 
        spin_lock_irqsave(&ec->lock, tmp);
        if (t->irq_count == ec_storm_threshold)
-               acpi_ec_clear_storm(ec, EC_FLAGS_COMMAND_STORM);
+               acpi_ec_unmask_gpe(ec);
        ec_dbg_req("Command(%s) stopped", acpi_ec_cmd_string(t->command));
        ec->curr = NULL;
        /* Disable GPE for command processing (IBF=0/OBF=1) */