Skip to content

Commit c7ef144

Browse files
committed
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>
1 parent ea621d9 commit c7ef144

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

‎drivers/platform/x86/hp-wmi.c‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -343,33 +343,25 @@ static const struct rfkill_ops hp_wmi_rfkill_ops = {
343343
static bool hp_wmi_get_sw_state(enum hp_wmi_radio r)
344344
{
345345
int mask = 0x200 << (r * 8);
346-
int wireless = 0;
347346

348-
hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, HPWMI_READ,
349-
&wireless, sizeof(wireless),
350-
sizeof(wireless));
347+
int wireless = hp_wmi_read_int(HPWMI_WIRELESS_QUERY);
348+
351349
/* TBD: Pass error */
350+
WARN_ONCE(wireless < 0, "error executing HPWMI_WIRELESS_QUERY");
352351

353-
if (wireless & mask)
354-
return false;
355-
else
356-
return true;
352+
return !(wireless & mask);
357353
}
358354

359355
static bool hp_wmi_get_hw_state(enum hp_wmi_radio r)
360356
{
361357
int mask = 0x800 << (r * 8);
362-
int wireless = 0;
363358

364-
hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, HPWMI_READ,
365-
&wireless, sizeof(wireless),
366-
sizeof(wireless));
359+
int wireless = hp_wmi_read_int(HPWMI_WIRELESS_QUERY);
360+
367361
/* TBD: Pass error */
362+
WARN_ONCE(wireless < 0, "error executing HPWMI_WIRELESS_QUERY");
368363

369-
if (wireless & mask)
370-
return false;
371-
else
372-
return true;
364+
return !(wireless & mask);
373365
}
374366

375367
static int hp_wmi_rfkill2_set_block(void *data, bool blocked)

0 commit comments

Comments
 (0)