Revert "ACPI: EC: Handle IRQ storm on Acer laptops"
[sfrench/cifs-2.6.git] / drivers / acpi / ec.c
index 8917d754020e73ac20c38b86a4a06e090f50b036..7222a18a03198d0bc70121d1246dc27af1d0629e 100644 (file)
@@ -26,6 +26,9 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
+/* Uncomment next line to get verbose print outs*/
+/* #define DEBUG */
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -47,9 +50,6 @@
 #undef PREFIX
 #define PREFIX                         "ACPI: EC: "
 
-/* Uncomment next line to get verbose print outs*/
-/* #define DEBUG */
-
 /* EC status register */
 #define ACPI_EC_FLAG_OBF       0x01    /* Output buffer full */
 #define ACPI_EC_FLAG_IBF       0x02    /* Input buffer full */
@@ -139,26 +139,26 @@ static struct acpi_ec {
 static inline u8 acpi_ec_read_status(struct acpi_ec *ec)
 {
        u8 x = inb(ec->command_addr);
-       pr_debug(PREFIX "---> status = 0x%2x\n", x);
+       pr_debug(PREFIX "---> status = 0x%2.2x\n", x);
        return x;
 }
 
 static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
 {
        u8 x = inb(ec->data_addr);
-       pr_debug(PREFIX "---> data = 0x%2x\n", x);
+       pr_debug(PREFIX "---> data = 0x%2.2x\n", x);
        return inb(ec->data_addr);
 }
 
 static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
 {
-       pr_debug(PREFIX "<--- command = 0x%2x\n", command);
+       pr_debug(PREFIX "<--- command = 0x%2.2x\n", command);
        outb(command, ec->command_addr);
 }
 
 static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
 {
-       pr_debug(PREFIX "<--- data = 0x%2x\n", data);
+       pr_debug(PREFIX "<--- data = 0x%2.2x\n", data);
        outb(data, ec->data_addr);
 }
 
@@ -573,7 +573,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
                      void *handler_context, void *region_context)
 {
        struct acpi_ec *ec = handler_context;
-       int result = 0, i = 0;
+       int result = 0, i;
        u8 temp = 0;
 
        if ((address > 0xFF) || !value || !handler_context)
@@ -585,7 +585,18 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
        if (bits != 8 && acpi_strict)
                return AE_BAD_PARAMETER;
 
-       while (bits - i > 0) {
+       acpi_ec_burst_enable(ec);
+
+       if (function == ACPI_READ) {
+               result = acpi_ec_read(ec, address, &temp);
+               *value = temp;
+       } else {
+               temp = 0xff & (*value);
+               result = acpi_ec_write(ec, address, temp);
+       }
+
+       for (i = 8; unlikely(bits - i > 0); i += 8) {
+               ++address;
                if (function == ACPI_READ) {
                        result = acpi_ec_read(ec, address, &temp);
                        (*value) |= ((acpi_integer)temp) << i;
@@ -593,10 +604,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
                        temp = 0xff & ((*value) >> i);
                        result = acpi_ec_write(ec, address, temp);
                }
-               i += 8;
-               ++address;
        }
 
+       acpi_ec_burst_disable(ec);
+
        switch (result) {
        case -EINVAL:
                return AE_BAD_PARAMETER;