samsung-laptop: fix seclinux rfkill and us it as fallback
authorCorentin Chary <corentincj@iksaif.net>
Thu, 15 Dec 2011 07:27:39 +0000 (08:27 +0100)
committerMatthew Garrett <mjg@redhat.com>
Tue, 20 Mar 2012 16:02:19 +0000 (12:02 -0400)
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
drivers/platform/x86/samsung-laptop.c

index 5047642d166261c7e14db6c9b2039e1d4a0995b8..7d7109fdbd63914dd2a42837fa63b9e9ff50bfe2 100644 (file)
@@ -541,7 +541,8 @@ static const struct backlight_ops backlight_ops = {
 
 static int seclinux_rfkill_set(void *data, bool blocked)
 {
-       struct samsung_laptop *samsung = data;
+       struct samsung_rfkill *srfkill = data;
+       struct samsung_laptop *samsung = srfkill->samsung;
        const struct sabi_commands *commands = &samsung->config->commands;
 
        return sabi_set_commandb(samsung, commands->set_wireless_button,
@@ -889,8 +890,13 @@ static int __init samsung_rfkill_init_swsmi(struct samsung_laptop *samsung)
        int ret;
 
        ret = swsmi_wireless_status(samsung, &data);
-       if (ret)
+       if (ret) {
+               /* Some swsmi laptops use the old seclinux way to control
+                * wireless devices */
+               if (ret == -EINVAL)
+                       ret = samsung_rfkill_init_seclinux(samsung);
                return ret;
+       }
 
        /* 0x02 seems to mean that the device is no present/available */