From 1075916b41c02a6f6a4c4b9dab285b7f8a3358f0 Mon Sep 17 00:00:00 2001 From: Alexey Starikovskiy Date: Tue, 29 May 2007 16:42:52 +0400 Subject: [PATCH] --- yaml --- r: 62507 b: refs/heads/master c: 5b7734b440d29dab583a6c3f0ee49ff20f323332 h: refs/heads/master i: 62505: f593b0cb200b8c37e4a6c6878bbbca4b6fcc13f7 62503: aeca02ee0aa86e1e04b06e44ec6bd86fbd8e8bad v: v3 --- [refs] | 2 +- trunk/drivers/acpi/ec.c | 56 +++++++++++++---------------------------- 2 files changed, 18 insertions(+), 40 deletions(-) diff --git a/[refs] b/[refs] index ce594da5e926..143d6bcbead2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a4146557cdfcd1adf1a8e8c92493c2cebe1088a1 +refs/heads/master: 5b7734b440d29dab583a6c3f0ee49ff20f323332 diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index 82f496c07675..5534b234509b 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -454,57 +454,35 @@ acpi_ec_space_setup(acpi_handle region_handle, } static acpi_status -acpi_ec_space_handler(u32 function, - acpi_physical_address address, - u32 bit_width, - acpi_integer * value, +acpi_ec_space_handler(u32 function, acpi_physical_address address, + u32 bits, acpi_integer *value, void *handler_context, void *region_context) { - int result = 0; struct acpi_ec *ec = handler_context; - u64 temp = *value; - acpi_integer f_v = 0; - int i = 0; + int result = 0, i = 0; + u8 temp = 0; if ((address > 0xFF) || !value || !handler_context) return AE_BAD_PARAMETER; - if (bit_width != 8 && acpi_strict) { + if (function != ACPI_READ && function != ACPI_WRITE) return AE_BAD_PARAMETER; - } - - next_byte: - switch (function) { - case ACPI_READ: - temp = 0; - result = acpi_ec_read(ec, (u8) address, (u8 *) & temp); - break; - case ACPI_WRITE: - result = acpi_ec_write(ec, (u8) address, (u8) temp); - break; - default: - result = -EINVAL; - goto out; - break; - } - bit_width -= 8; - if (bit_width) { - if (function == ACPI_READ) - f_v |= temp << 8 * i; - if (function == ACPI_WRITE) - temp >>= 8; - i++; - address++; - goto next_byte; - } + if (bits != 8 && acpi_strict) + return AE_BAD_PARAMETER; - if (function == ACPI_READ) { - f_v |= temp << 8 * i; - *value = f_v; + while (bits - i > 0) { + if (function == ACPI_READ) { + result = acpi_ec_read(ec, address, &temp); + (*value) |= ((acpi_integer)temp) << i; + } else { + temp = 0xff & ((*value) >> i); + result = acpi_ec_write(ec, address, temp); + } + i += 8; + ++address; } - out: switch (result) { case -EINVAL: return AE_BAD_PARAMETER;