 drivers/acpi/ec.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Index: linux-2.6.15-rc4-ck1/drivers/acpi/ec.c
===================================================================
--- linux-2.6.15-rc4-ck1.orig/drivers/acpi/ec.c	2005-10-28 13:03:02.000000000 +1000
+++ linux-2.6.15-rc4-ck1/drivers/acpi/ec.c	2005-12-02 01:19:13.000000000 +1100
@@ -165,14 +165,22 @@ static int acpi_ec_wait(union acpi_ec *e
 {
 	if (acpi_ec_polling_mode)
 		return acpi_ec_polling_wait(ec, event);
-	else
-		return acpi_ec_burst_wait(ec, event);
+	else {
+		unsigned long flags;
+		int ret;
+
+		spin_lock_irqsave(&ec->polling.lock, flags);
+		ret = acpi_ec_burst_wait(ec, event);
+		spin_unlock_irqrestore(&ec->polling.lock, flags);
+		return ret;
+	}
 }
 
 static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
 {
 	u32 acpi_ec_status = 0;
 	u32 i = ACPI_EC_UDELAY_COUNT;
+	unsigned long flags;
 
 	if (!ec)
 		return -EINVAL;
@@ -181,8 +189,10 @@ static int acpi_ec_polling_wait(union ac
 	switch (event) {
 	case ACPI_EC_EVENT_OBF:
 		do {
+			spin_lock_irqsave(&ec->polling.lock, flags);
 			acpi_hw_low_level_read(8, &acpi_ec_status,
 					       &ec->common.status_addr);
+			spin_unlock_irqrestore(&ec->polling.lock, flags);
 			if (acpi_ec_status & ACPI_EC_FLAG_OBF)
 				return 0;
 			udelay(ACPI_EC_UDELAY);
@@ -190,8 +200,10 @@ static int acpi_ec_polling_wait(union ac
 		break;
 	case ACPI_EC_EVENT_IBE:
 		do {
+			spin_lock_irqsave(&ec->polling.lock, flags);
 			acpi_hw_low_level_read(8, &acpi_ec_status,
 					       &ec->common.status_addr);
+			spin_unlock_irqrestore(&ec->polling.lock, flags);
 			if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
 				return 0;
 			udelay(ACPI_EC_UDELAY);
@@ -329,25 +341,30 @@ static int acpi_ec_polling_read(union ac
 	}
 
 	spin_lock_irqsave(&ec->polling.lock, flags);
-
 	acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
 				&ec->common.command_addr);
+	spin_unlock_irqrestore(&ec->polling.lock, flags);
+
 	result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
 	if (result)
 		goto end;
 
+	spin_lock_irqsave(&ec->polling.lock, flags);
 	acpi_hw_low_level_write(8, address, &ec->common.data_addr);
+	spin_unlock_irqrestore(&ec->polling.lock, flags);
+
 	result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
 	if (result)
 		goto end;
 
+	spin_lock_irqsave(&ec->polling.lock, flags);
 	acpi_hw_low_level_read(8, data, &ec->common.data_addr);
+	spin_unlock_irqrestore(&ec->polling.lock, flags);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
 			  *data, address));
 
       end:
-	spin_unlock_irqrestore(&ec->polling.lock, flags);
 
 	if (ec->common.global_lock)
 		acpi_release_global_lock(glk);
