platform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functions
Use the new hp_wmi_read_int() function and add a WARN_ONCE() to the TBD regarding passing the error through. These are used in a null return function unfortunately. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
This commit is contained in:
Родитель
ea621d9fe3
Коммит
c7ef144c12
|
@ -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)
|
static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
|
||||||
{
|
{
|
||||||
int mask = 0x200 << (r * 8);
|
int mask = 0x200 << (r * 8);
|
||||||
int wireless = 0;
|
|
||||||
|
|
||||||
hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, HPWMI_READ,
|
int wireless = hp_wmi_read_int(HPWMI_WIRELESS_QUERY);
|
||||||
&wireless, sizeof(wireless),
|
|
||||||
sizeof(wireless));
|
|
||||||
/* TBD: Pass error */
|
/* TBD: Pass error */
|
||||||
|
WARN_ONCE(wireless < 0, "error executing HPWMI_WIRELESS_QUERY");
|
||||||
|
|
||||||
if (wireless & mask)
|
return !(wireless & mask);
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hp_wmi_get_hw_state(enum hp_wmi_radio r)
|
static bool hp_wmi_get_hw_state(enum hp_wmi_radio r)
|
||||||
{
|
{
|
||||||
int mask = 0x800 << (r * 8);
|
int mask = 0x800 << (r * 8);
|
||||||
int wireless = 0;
|
|
||||||
|
|
||||||
hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, HPWMI_READ,
|
int wireless = hp_wmi_read_int(HPWMI_WIRELESS_QUERY);
|
||||||
&wireless, sizeof(wireless),
|
|
||||||
sizeof(wireless));
|
|
||||||
/* TBD: Pass error */
|
/* TBD: Pass error */
|
||||||
|
WARN_ONCE(wireless < 0, "error executing HPWMI_WIRELESS_QUERY");
|
||||||
|
|
||||||
if (wireless & mask)
|
return !(wireless & mask);
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hp_wmi_rfkill2_set_block(void *data, bool blocked)
|
static int hp_wmi_rfkill2_set_block(void *data, bool blocked)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче