diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 987b967c7467..7222a18a0319 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -573,7 +573,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
573 | void *handler_context, void *region_context) | 573 | void *handler_context, void *region_context) |
574 | { | 574 | { |
575 | struct acpi_ec *ec = handler_context; | 575 | struct acpi_ec *ec = handler_context; |
576 | int result = 0, i = 0; | 576 | int result = 0, i; |
577 | u8 temp = 0; | 577 | u8 temp = 0; |
578 | 578 | ||
579 | if ((address > 0xFF) || !value || !handler_context) | 579 | if ((address > 0xFF) || !value || !handler_context) |
@@ -585,7 +585,18 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
585 | if (bits != 8 && acpi_strict) | 585 | if (bits != 8 && acpi_strict) |
586 | return AE_BAD_PARAMETER; | 586 | return AE_BAD_PARAMETER; |
587 | 587 | ||
588 | while (bits - i > 0) { | 588 | acpi_ec_burst_enable(ec); |
589 | |||
590 | if (function == ACPI_READ) { | ||
591 | result = acpi_ec_read(ec, address, &temp); | ||
592 | *value = temp; | ||
593 | } else { | ||
594 | temp = 0xff & (*value); | ||
595 | result = acpi_ec_write(ec, address, temp); | ||
596 | } | ||
597 | |||
598 | for (i = 8; unlikely(bits - i > 0); i += 8) { | ||
599 | ++address; | ||
589 | if (function == ACPI_READ) { | 600 | if (function == ACPI_READ) { |
590 | result = acpi_ec_read(ec, address, &temp); | 601 | result = acpi_ec_read(ec, address, &temp); |
591 | (*value) |= ((acpi_integer)temp) << i; | 602 | (*value) |= ((acpi_integer)temp) << i; |
@@ -593,10 +604,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
593 | temp = 0xff & ((*value) >> i); | 604 | temp = 0xff & ((*value) >> i); |
594 | result = acpi_ec_write(ec, address, temp); | 605 | result = acpi_ec_write(ec, address, temp); |
595 | } | 606 | } |
596 | i += 8; | ||
597 | ++address; | ||
598 | } | 607 | } |
599 | 608 | ||
609 | acpi_ec_burst_disable(ec); | ||
610 | |||
600 | switch (result) { | 611 | switch (result) { |
601 | case -EINVAL: | 612 | case -EINVAL: |
602 | return AE_BAD_PARAMETER; | 613 | return AE_BAD_PARAMETER; |