diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d411017f8c06..63862dfe347b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -563,7 +563,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
563 | void *handler_context, void *region_context) | 563 | void *handler_context, void *region_context) |
564 | { | 564 | { |
565 | struct acpi_ec *ec = handler_context; | 565 | struct acpi_ec *ec = handler_context; |
566 | int result = 0, i = 0; | 566 | int result = 0, i; |
567 | u8 temp = 0; | 567 | u8 temp = 0; |
568 | 568 | ||
569 | if ((address > 0xFF) || !value || !handler_context) | 569 | if ((address > 0xFF) || !value || !handler_context) |
@@ -575,7 +575,16 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
575 | if (bits != 8 && acpi_strict) | 575 | if (bits != 8 && acpi_strict) |
576 | return AE_BAD_PARAMETER; | 576 | return AE_BAD_PARAMETER; |
577 | 577 | ||
578 | while (bits - i > 0) { | 578 | if (function == ACPI_READ) { |
579 | result = acpi_ec_read(ec, address, &temp); | ||
580 | *value = temp; | ||
581 | } else { | ||
582 | temp = 0xff & (*value); | ||
583 | result = acpi_ec_write(ec, address, temp); | ||
584 | } | ||
585 | |||
586 | for (i = 8; unlikely(bits - i > 0); i += 8) { | ||
587 | ++address; | ||
579 | if (function == ACPI_READ) { | 588 | if (function == ACPI_READ) { |
580 | result = acpi_ec_read(ec, address, &temp); | 589 | result = acpi_ec_read(ec, address, &temp); |
581 | (*value) |= ((acpi_integer)temp) << i; | 590 | (*value) |= ((acpi_integer)temp) << i; |
@@ -583,8 +592,6 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
583 | temp = 0xff & ((*value) >> i); | 592 | temp = 0xff & ((*value) >> i); |
584 | result = acpi_ec_write(ec, address, temp); | 593 | result = acpi_ec_write(ec, address, temp); |
585 | } | 594 | } |
586 | i += 8; | ||
587 | ++address; | ||
588 | } | 595 | } |
589 | 596 | ||
590 | switch (result) { | 597 | switch (result) { |