aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
authorAlexey Starikovskiy <alexey.y.starikovskiy@intel.com>2006-12-07 10:42:17 -0500
committerLen Brown <len.brown@intel.com>2006-12-08 02:56:07 -0500
commit50c1e1138cb94f6aca0f8555777edbcefe0324e2 (patch)
treee61e0fa46221d8744b249897aaa7c461d01cf2ad /drivers/acpi/ec.c
parenta86e277259b08be0f00cfcb182922da3ffc50f04 (diff)
ACPI: ec: Drop udelay() from poll mode. Loop by reading status field instead.
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 722acafdf32e..8ef74e7b3b91 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -70,8 +70,6 @@ enum {
70 70
71#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 71#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
72#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 72#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
73#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */
74#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 100ms max. during EC ops */
75 73
76enum { 74enum {
77 EC_INTR = 1, /* Output buffer full */ 75 EC_INTR = 1, /* Output buffer full */
@@ -159,11 +157,10 @@ static int acpi_ec_check_status(struct acpi_ec *ec, u8 event)
159static int acpi_ec_wait(struct acpi_ec *ec, u8 event) 157static int acpi_ec_wait(struct acpi_ec *ec, u8 event)
160{ 158{
161 if (acpi_ec_mode == EC_POLL) { 159 if (acpi_ec_mode == EC_POLL) {
162 int i; 160 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
163 for (i = 0; i < ACPI_EC_UDELAY_COUNT; ++i) { 161 while (time_before(jiffies, delay)) {
164 if (acpi_ec_check_status(ec, event)) 162 if (acpi_ec_check_status(ec, event))
165 return 0; 163 return 0;
166 udelay(ACPI_EC_UDELAY);
167 } 164 }
168 } else { 165 } else {
169 if (wait_event_timeout(ec->wait, 166 if (wait_event_timeout(ec->wait,