Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xo1-rfkill: only act when blocked state is changed

The XO-1 rfkill driver should only send EC commands when changing
between blocked/unblocked state.

The rfkill switch is asked to be unblocked on every resume (even when
the card was never blocked before) and sending a EC_WLAN_LEAVE_RESET
command here upsets the resume sequence of the libertas driver. Adding
the check to avoid the spurious EC_WLAN_LEAVE_RESET fixes the wifi resume
behaviour.

The rfkill state is maintained by the hardware over suspend/resume
so no extra consideration is needed here.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>

authored by

Daniel Drake and committed by
Matthew Garrett
bc7ab495 14b234b1

+12 -1
+12 -1
drivers/platform/x86/xo1-rfkill.c
··· 15 15 16 16 #include <asm/olpc.h> 17 17 18 + static bool card_blocked; 19 + 18 20 static int rfkill_set_block(void *data, bool blocked) 19 21 { 20 22 unsigned char cmd; 23 + int r; 24 + 25 + if (blocked == card_blocked) 26 + return 0; 27 + 21 28 if (blocked) 22 29 cmd = EC_WLAN_ENTER_RESET; 23 30 else 24 31 cmd = EC_WLAN_LEAVE_RESET; 25 32 26 - return olpc_ec_cmd(cmd, NULL, 0, NULL, 0); 33 + r = olpc_ec_cmd(cmd, NULL, 0, NULL, 0); 34 + if (r == 0) 35 + card_blocked = blocked; 36 + 37 + return r; 27 38 } 28 39 29 40 static const struct rfkill_ops rfkill_ops = {