Merge tag 'please-pull-mce' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras
[firefly-linux-kernel-4.4.55.git] / drivers / platform / x86 / xo1-rfkill.c
index 41781ed8301c737018494bb30a19677640cc9018..b57ad8641480424b660f4d447acebdcf9ec9a2b4 100644 (file)
 
 #include <asm/olpc.h>
 
+static bool card_blocked;
+
 static int rfkill_set_block(void *data, bool blocked)
 {
        unsigned char cmd;
+       int r;
+
+       if (blocked == card_blocked)
+               return 0;
+
        if (blocked)
                cmd = EC_WLAN_ENTER_RESET;
        else
                cmd = EC_WLAN_LEAVE_RESET;
 
-       return olpc_ec_cmd(cmd, NULL, 0, NULL, 0);
+       r = olpc_ec_cmd(cmd, NULL, 0, NULL, 0);
+       if (r == 0)
+               card_blocked = blocked;
+
+       return r;
 }
 
 static const struct rfkill_ops rfkill_ops = {