]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/platform/x86/hp-wmi.c
platform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functions
[mirror_ubuntu-bionic-kernel.git] / drivers / platform / x86 / hp-wmi.c
index eb6d0a0e139219c13d18300b96e5cfeb09bcd5f1..577805987d355dc7c4ba6d32b3279e2393c53822 100644 (file)
@@ -343,33 +343,25 @@ static const struct rfkill_ops hp_wmi_rfkill_ops = {
 static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
 {
        int mask = 0x200 << (r * 8);
-       int wireless = 0;
 
-       hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, HPWMI_READ,
-                            &wireless, sizeof(wireless),
-                            sizeof(wireless));
+       int wireless = hp_wmi_read_int(HPWMI_WIRELESS_QUERY);
+
        /* TBD: Pass error */
+       WARN_ONCE(wireless < 0, "error executing HPWMI_WIRELESS_QUERY");
 
-       if (wireless & mask)
-               return false;
-       else
-               return true;
+       return !(wireless & mask);
 }
 
 static bool hp_wmi_get_hw_state(enum hp_wmi_radio r)
 {
        int mask = 0x800 << (r * 8);
-       int wireless = 0;
 
-       hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, HPWMI_READ,
-                            &wireless, sizeof(wireless),
-                            sizeof(wireless));
+       int wireless = hp_wmi_read_int(HPWMI_WIRELESS_QUERY);
+
        /* TBD: Pass error */
+       WARN_ONCE(wireless < 0, "error executing HPWMI_WIRELESS_QUERY");
 
-       if (wireless & mask)
-               return false;
-       else
-               return true;
+       return !(wireless & mask);
 }
 
 static int hp_wmi_rfkill2_set_block(void *data, bool blocked)