All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
	linux-acpi@vger.kernel.org
Subject: [PATCH 1/6] ACPI/EC: Cleanup transaction wakeup code
Date: Wed, 14 Jan 2015 19:28:22 +0800	[thread overview]
Message-ID: <22c0b29810135db8762604f216ca8ea1c66fbdf0.1421234254.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1421234254.git.lv.zheng@intel.com>

This patch moves transaction wakeup code into advance_transaction().
No functional changes.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/ec.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1b5853f..3e19123 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -200,7 +200,7 @@ static int ec_transaction_completed(struct acpi_ec *ec)
 	return ret;
 }
 
-static bool advance_transaction(struct acpi_ec *ec)
+static void advance_transaction(struct acpi_ec *ec)
 {
 	struct transaction *t;
 	u8 status;
@@ -235,7 +235,7 @@ static bool advance_transaction(struct acpi_ec *ec)
 			t->flags |= ACPI_EC_COMMAND_COMPLETE;
 			wakeup = true;
 		}
-		return wakeup;
+		goto out;
 	} else {
 		if (EC_FLAGS_QUERY_HANDSHAKE &&
 		    !(status & ACPI_EC_FLAG_SCI) &&
@@ -251,7 +251,7 @@ static bool advance_transaction(struct acpi_ec *ec)
 			t->flags |= ACPI_EC_COMMAND_POLL;
 		} else
 			goto err;
-		return wakeup;
+		goto out;
 	}
 err:
 	/*
@@ -262,14 +262,16 @@ err:
 		if (in_interrupt() && t)
 			++t->irq_count;
 	}
-	return wakeup;
+out:
+	if (wakeup && in_interrupt())
+		wake_up(&ec->wait);
 }
 
 static void start_transaction(struct acpi_ec *ec)
 {
 	ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
 	ec->curr->flags = 0;
-	(void)advance_transaction(ec);
+	advance_transaction(ec);
 }
 
 static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);
@@ -304,7 +306,7 @@ static int ec_poll(struct acpi_ec *ec)
 					return 0;
 			}
 			spin_lock_irqsave(&ec->lock, flags);
-			(void)advance_transaction(ec);
+			advance_transaction(ec);
 			spin_unlock_irqrestore(&ec->lock, flags);
 		} while (time_before(jiffies, delay));
 		pr_debug("controller reset, restart transaction\n");
@@ -688,8 +690,7 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	struct acpi_ec *ec = data;
 
 	spin_lock_irqsave(&ec->lock, flags);
-	if (advance_transaction(ec))
-		wake_up(&ec->wait);
+	advance_transaction(ec);
 	spin_unlock_irqrestore(&ec->lock, flags);
 	ec_check_sci(ec, acpi_ec_read_status(ec));
 	return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE;
-- 
1.7.10


  reply	other threads:[~2015-01-14  3:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19  5:59 [RFC PATCH 0/6] ACPI/EC: Enhance EC driver state machine Lv Zheng
2014-12-19  5:59 ` [RFC PATCH 1/6] ACPI/EC: Cleanup transaction wakeup code Lv Zheng
2014-12-19  5:59 ` [RFC PATCH 2/6] ACPI/EC: Add reference counting for query handlers Lv Zheng
2014-12-19  5:59 ` [RFC PATCH 3/6] ACPI/EC: Fix returning values in acpi_ec_sync_query() Lv Zheng
2014-12-19  5:59 ` [RFC PATCH 4/6] ACPI/EC: Fix a code path that global lock is not held Lv Zheng
2014-12-19  6:00 ` [RFC PATCH 5/6] ACPI/EC: Fix issues related to the SCI_EVT handling Lv Zheng
2014-12-19  6:00 ` [RFC PATCH 6/6] ACPI/EC: Cleanup QR_EC related code Lv Zheng
2014-12-19 22:28 ` [RFC PATCH 0/6] ACPI/EC: Enhance EC driver state machine Rafael J. Wysocki
2015-01-14 11:28 ` [PATCH " Lv Zheng
2015-01-14 11:28   ` Lv Zheng [this message]
2015-01-21 22:17     ` [PATCH 1/6] ACPI/EC: Cleanup transaction wakeup code Rafael J. Wysocki
2015-01-22  6:37       ` Zheng, Lv
2015-01-22 16:00         ` Rafael J. Wysocki
2015-01-23  2:18           ` Zheng, Lv
2015-01-23 15:22             ` Rafael J. Wysocki
2015-01-14 11:28   ` [PATCH 2/6] ACPI/EC: Add reference counting for query handlers Lv Zheng
2015-01-14 11:28   ` [PATCH 3/6] ACPI/EC: Fix returning values in acpi_ec_sync_query() Lv Zheng
2015-01-14 11:28   ` [PATCH 4/6] ACPI/EC: Fix a code path that global lock is not held Lv Zheng
2015-01-14 11:28   ` [PATCH 5/6] ACPI/EC: Fix issues related to the SCI_EVT handling Lv Zheng
2015-01-14 11:28   ` [PATCH 6/6] ACPI/EC: Cleanup QR_EC related code Lv Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22c0b29810135db8762604f216ca8ea1c66fbdf0.1421234254.git.lv.zheng@intel.com \
    --to=lv.zheng@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=zetalog@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.