aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/xo1-rfkill.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/xo1-rfkill.c')
-rw-r--r--drivers/platform/x86/xo1-rfkill.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/platform/x86/xo1-rfkill.c b/drivers/platform/x86/xo1-rfkill.c
index 41781ed8301c..b57ad8641480 100644
--- a/drivers/platform/x86/xo1-rfkill.c
+++ b/drivers/platform/x86/xo1-rfkill.c
@@ -15,15 +15,26 @@
15 15
16#include <asm/olpc.h> 16#include <asm/olpc.h>
17 17
18static bool card_blocked;
19
18static int rfkill_set_block(void *data, bool blocked) 20static int rfkill_set_block(void *data, bool blocked)
19{ 21{
20 unsigned char cmd; 22 unsigned char cmd;
23 int r;
24
25 if (blocked == card_blocked)
26 return 0;
27
21 if (blocked) 28 if (blocked)
22 cmd = EC_WLAN_ENTER_RESET; 29 cmd = EC_WLAN_ENTER_RESET;
23 else 30 else
24 cmd = EC_WLAN_LEAVE_RESET; 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
29static const struct rfkill_ops rfkill_ops = { 40static const struct rfkill_ops rfkill_ops = {