linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ACPI / EC: Cleanup EC GPE mask flag
@ 2017-07-27  7:55 Lv Zheng
  2017-07-27  7:55 ` [PATCH 2/3] ACPI: EC: Add IRQ polling support for noirq stages Lv Zheng
                   ` (5 more replies)
  0 siblings, 6 replies; 28+ messages in thread
From: Lv Zheng @ 2017-07-27  7:55 UTC (permalink / raw)
  To: Rafael J . Wysocki, Rafael J . Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

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>
---
 drivers/acpi/ec.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index ddb01e9..54879c7 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -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 */
@@ -421,19 +420,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");
 	}
@@ -460,7 +459,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)) {
@@ -476,7 +475,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)
@@ -688,7 +687,7 @@ static void advance_transaction(struct acpi_ec *ec)
 				++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:
@@ -786,7 +785,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) */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2017-11-27  8:56 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27  7:55 [PATCH 1/3] ACPI / EC: Cleanup EC GPE mask flag Lv Zheng
2017-07-27  7:55 ` [PATCH 2/3] ACPI: EC: Add IRQ polling support for noirq stages Lv Zheng
2017-07-27  7:55 ` [PATCH 3/3] ACPI: EC: Enable noirq stage GPE polling Lv Zheng
2017-07-31  5:47 ` [PATCH v2 0/4] ACPI / EC: Solve EC event handling issues Lv Zheng
2017-07-31  5:47   ` [PATCH v2 1/4] ACPI / EC: Cleanup EC GPE mask flag Lv Zheng
2017-07-31  5:47   ` [PATCH v2 2/4] ACPI / EC: Add IRQ polling support for noirq stages Lv Zheng
2017-07-31  5:48   ` [PATCH v2 3/4] ACPI / EC: Add support to handle EC events earlier Lv Zheng
2017-07-31  5:48   ` [PATCH v2 4/4] ACPI / EC: Enable noirq stage GPE polling Lv Zheng
2017-08-11  6:36 ` [PATCH v3 0/4] ACPI / EC: Poll more EC events during suspend/resume Lv Zheng
2017-08-11  6:36   ` [PATCH v3 1/4] ACPI / EC: Cleanup EC GPE mask flag Lv Zheng
2017-08-22 13:17     ` Rafael J. Wysocki
2017-08-23  4:19       ` Zheng, Lv
2017-08-11  6:36   ` [PATCH v3 2/4] ACPI / EC: Add IRQ polling support for noirq stages Lv Zheng
2017-08-11  6:36   ` [PATCH v3 3/4] ACPI / EC: Add support to handle EC events earlier Lv Zheng
2017-08-11  6:36   ` [PATCH v3 4/4] ACPI / EC: Enable noirq stage GPE polling Lv Zheng
2017-08-31  8:10 ` [PATCH v4 0/3] ACPI / EC: Fix EC event handling issues Lv Zheng
2017-08-31  8:10   ` [PATCH v4 1/3] ACPI / EC: Fix possible driver order issue by moving EC event handling earlier Lv Zheng
2017-08-31  8:10   ` [PATCH v4 2/3] ACPI / EC: Add event detection support for noirq stages Lv Zheng
2017-08-31  8:10   ` [PATCH v4 3/3] ACPI / EC: Enable noirq stage event detection Lv Zheng
2017-09-26  7:52   ` [PATCH v4 0/3] ACPI / EC: Fix EC event handling issues Zheng, Lv
2017-09-29  2:50 ` [RFC PATCH v6 0/3] ACPI / EC: Tune the timing of EC events arrival during S3-exit Lv Zheng
2017-09-29  2:50   ` [RFC PATCH v6 1/3] ACPI / EC: Fix possible driver order issue by moving EC event handling earlier Lv Zheng
2017-11-22 12:52     ` Zhang, Rui
2017-11-24  1:20       ` Zheng, Lv
2017-11-27  8:56         ` Benjamin Tissoires
2017-09-29  2:50   ` [RFC PATCH v6 2/3] ACPI / EC: Add event detection support for noirq stages Lv Zheng
2017-11-22 12:43     ` Zhang, Rui
2017-09-29  2:50   ` [RFC PATCH v6 3/3] ACPI / EC: Enable noirq stage event detection Lv Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).