Skip to content

Commit

Permalink
tc1100-wmi: Fix state reporting
Browse files Browse the repository at this point in the history
The tc1100-wmi driver should print the current states of wireless LAN and
jogdial brightness control when "cat /sys/devices/platform/tc1100-wmi/wireless"
and "cat /sys/devices/platform/tc1100-wmi/jogdial" are executed, respectively.
What actually happens is that both of those commands print 0 regardless of the
hardware state. The cause is that wmi_query_block returns an ACPI_TYPE_INTEGER
rather than ACPI_TYPE_BUFFER as the driver assumes. Additionally, the driver
intends to return a jogdial state that is inverted with respect to the commands
required to set it (e.g. it intends to return 1 after the jogdial file was
written with 0).

This patch fixes both of those issues - the commands to query the
state now work, and should return the same state that was written.

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

Signed-off-by: Krzysztof Kosiński <tweenk.pl@gmail.com>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Krzysztof Kosiński authored and Len Brown committed Apr 3, 2009
1 parent a59d163 commit 07de5bd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/platform/x86/tc1100-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ static int get_state(u32 *out, u8 instance)
return -ENODEV;

obj = (union acpi_object *) result.pointer;
if (obj && obj->type == ACPI_TYPE_BUFFER &&
obj->buffer.length == sizeof(u32)) {
tmp = *((u32 *) obj->buffer.pointer);
if (obj && obj->type == ACPI_TYPE_INTEGER) {
tmp = obj->integer.value;
} else {
tmp = 0;
}
Expand All @@ -109,7 +108,7 @@ static int get_state(u32 *out, u8 instance)
*out = (tmp == 3) ? 1 : 0;
return 0;
case TC1100_INSTANCE_JOGDIAL:
*out = (tmp == 1) ? 1 : 0;
*out = (tmp == 1) ? 0 : 1;
return 0;
default:
return -ENODEV;
Expand Down

0 comments on commit 07de5bd

Please sign in to comment.