aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-23 05:10:28 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-23 05:10:30 -0400
commit70bce3ba77540ebe77b8c0e1ac38d281a23fbb5e (patch)
tree34b09a49228f0949ff49dce66a433b0dfd83a2dc /drivers/acpi/ec.c
parent6eca8cc35b50af1037bc919106dd6dd332c959c2 (diff)
parentd5a30458a90597915977f06e79406b664a41b8ac (diff)
Merge branch 'linus' into perf/core
Merge reason: merge the latest fixes, update to latest -rc. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 35ba2547f544..f2234db85da0 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -629,12 +629,12 @@ static u32 acpi_ec_gpe_handler(void *data)
629 629
630static acpi_status 630static acpi_status
631acpi_ec_space_handler(u32 function, acpi_physical_address address, 631acpi_ec_space_handler(u32 function, acpi_physical_address address,
632 u32 bits, u64 *value, 632 u32 bits, u64 *value64,
633 void *handler_context, void *region_context) 633 void *handler_context, void *region_context)
634{ 634{
635 struct acpi_ec *ec = handler_context; 635 struct acpi_ec *ec = handler_context;
636 int result = 0, i; 636 int result = 0, i, bytes = bits / 8;
637 u8 temp = 0; 637 u8 *value = (u8 *)value64;
638 638
639 if ((address > 0xFF) || !value || !handler_context) 639 if ((address > 0xFF) || !value || !handler_context)
640 return AE_BAD_PARAMETER; 640 return AE_BAD_PARAMETER;
@@ -642,32 +642,15 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
642 if (function != ACPI_READ && function != ACPI_WRITE) 642 if (function != ACPI_READ && function != ACPI_WRITE)
643 return AE_BAD_PARAMETER; 643 return AE_BAD_PARAMETER;
644 644
645 if (bits != 8 && acpi_strict) 645 if (EC_FLAGS_MSI || bits > 8)
646 return AE_BAD_PARAMETER;
647
648 if (EC_FLAGS_MSI)
649 acpi_ec_burst_enable(ec); 646 acpi_ec_burst_enable(ec);
650 647
651 if (function == ACPI_READ) { 648 for (i = 0; i < bytes; ++i, ++address, ++value)
652 result = acpi_ec_read(ec, address, &temp); 649 result = (function == ACPI_READ) ?
653 *value = temp; 650 acpi_ec_read(ec, address, value) :
654 } else { 651 acpi_ec_write(ec, address, *value);
655 temp = 0xff & (*value);
656 result = acpi_ec_write(ec, address, temp);
657 }
658
659 for (i = 8; unlikely(bits - i > 0); i += 8) {
660 ++address;
661 if (function == ACPI_READ) {
662 result = acpi_ec_read(ec, address, &temp);
663 (*value) |= ((u64)temp) << i;
664 } else {
665 temp = 0xff & ((*value) >> i);
666 result = acpi_ec_write(ec, address, temp);
667 }
668 }
669 652
670 if (EC_FLAGS_MSI) 653 if (EC_FLAGS_MSI || bits > 8)
671 acpi_ec_burst_disable(ec); 654 acpi_ec_burst_disable(ec);
672 655
673 switch (result) { 656 switch (result) {