ideapad: fix software rfkill setting
authorArnd Bergmann <arnd@arndb.de>
Sat, 13 Jun 2015 13:23:33 +0000 (15:23 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 12 Aug 2015 14:33:15 +0000 (16:33 +0200)
commit 4b200b4604bec3388426159f1656109d19fadf6e upstream.

This fixes a several year old regression that I found while trying
to get the Yoga 3 11 to work. The ideapad_rfk_set function is meant
to send a command to the embedded controller through ACPI, but
as of c1f73658ed, it sends the index of the rfkill device instead
of the command, and ignores the opcode field.

This changes it back to the original behavior, which indeed
flips the rfkill state as seen in the debugfs interface.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: c1f73658ed ("ideapad: pass ideapad_priv as argument (part 2)")
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
[bwh: Backported to 3.2: device private data is just the device index, not a
 pointer]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/platform/x86/ideapad-laptop.c

index a36addf..04a6928 100644 (file)
@@ -407,7 +407,8 @@ const struct ideapad_rfk_data ideapad_rfk_data[] = {
 
 static int ideapad_rfk_set(void *data, bool blocked)
 {
 
 static int ideapad_rfk_set(void *data, bool blocked)
 {
-       unsigned long opcode = (unsigned long)data;
+       unsigned long dev = (unsigned long)data;
+       int opcode = ideapad_rfk_data[dev].opcode;
 
        return write_ec_cmd(ideapad_handle, opcode, !blocked);
 }
 
        return write_ec_cmd(ideapad_handle, opcode, !blocked);
 }