Commit fa9cd547 authored by Luming Yu's avatar Luming Yu Committed by Len Brown

[ACPI] fix EC access width

http://bugzilla.kernel.org/show_bug.cgi?id=4346

Written-by: David Shaohua Li and Luming Yu
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 451566f4
...@@ -600,7 +600,7 @@ acpi_ec_space_handler ( ...@@ -600,7 +600,7 @@ acpi_ec_space_handler (
{ {
int result = 0; int result = 0;
struct acpi_ec *ec = NULL; struct acpi_ec *ec = NULL;
u32 temp = 0; u64 temp = *value;
acpi_integer f_v = 0; acpi_integer f_v = 0;
int i = 0; int i = 0;
...@@ -609,9 +609,8 @@ acpi_ec_space_handler ( ...@@ -609,9 +609,8 @@ acpi_ec_space_handler (
if ((address > 0xFF) || !value || !handler_context) if ((address > 0xFF) || !value || !handler_context)
return_VALUE(AE_BAD_PARAMETER); return_VALUE(AE_BAD_PARAMETER);
if(bit_width != 8) { if (bit_width != 8 && acpi_strict) {
printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n");
if (acpi_strict)
return_VALUE(AE_BAD_PARAMETER); return_VALUE(AE_BAD_PARAMETER);
} }
...@@ -620,11 +619,11 @@ acpi_ec_space_handler ( ...@@ -620,11 +619,11 @@ acpi_ec_space_handler (
next_byte: next_byte:
switch (function) { switch (function) {
case ACPI_READ: case ACPI_READ:
result = acpi_ec_read(ec, (u8) address, &temp); temp = 0;
*value = (acpi_integer) temp; result = acpi_ec_read(ec, (u8) address, (u32 *)&temp);
break; break;
case ACPI_WRITE: case ACPI_WRITE:
result = acpi_ec_write(ec, (u8) address, (u8) *value); result = acpi_ec_write(ec, (u8) address, (u8) temp);
break; break;
default: default:
result = -EINVAL; result = -EINVAL;
...@@ -633,19 +632,18 @@ next_byte: ...@@ -633,19 +632,18 @@ next_byte:
} }
bit_width -= 8; bit_width -= 8;
if(bit_width){ if (bit_width) {
if (function == ACPI_READ)
if(function == ACPI_READ) f_v |= temp << 8 * i;
f_v |= (acpi_integer) (*value) << 8*i; if (function == ACPI_WRITE)
if(function == ACPI_WRITE) temp >>= 8;
(*value) >>=8;
i++; i++;
(u8)address ++;
goto next_byte; goto next_byte;
} }
if (function == ACPI_READ) {
if(function == ACPI_READ){ f_v |= temp << 8 * i;
f_v |= (acpi_integer) (*value) << 8*i;
*value = f_v; *value = f_v;
} }
...@@ -664,8 +662,6 @@ out: ...@@ -664,8 +662,6 @@ out:
default: default:
return_VALUE(AE_OK); return_VALUE(AE_OK);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment