Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1626927
| From | Darren Hart <dvhart@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 5/9] platform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functions |
| Date | 2017-04-20 04:30 +0200 |
| Message-ID | <tya14-38v-19@gated-at.bofh.it> (permalink) |
| References | <tya13-38v-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: "Darren Hart (VMware)" <dvhart@infradead.org>
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>
---
drivers/platform/x86/hp-wmi.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 758c229..e46b61c 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -337,33 +337,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)
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v1 0/9] platform/x86: hp-wmi: Driver refactoring and cleanups Darren Hart <dvhart@infradead.org> - 2017-04-20 04:30 +0200
[PATCH 9/9] platform/x86: hp-wmi: Cleanup exit paths Darren Hart <dvhart@infradead.org> - 2017-04-20 04:30 +0200
[PATCH 5/9] platform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functions Darren Hart <dvhart@infradead.org> - 2017-04-20 04:30 +0200
[PATCH 8/9] platform/x86: hp-wmi: Do not shadow errors in sysfs show functions Darren Hart <dvhart@infradead.org> - 2017-04-20 04:30 +0200
[PATCH 7/9] platform/x86: hp-wmi: Use DEVICE_ATTR_(RO|RW) helper macros Darren Hart <dvhart@infradead.org> - 2017-04-20 04:30 +0200
Re: [PATCH v1 0/9] platform/x86: hp-wmi: Driver refactoring and cleanups Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-20 09:40 +0200
Re: [PATCH v1 0/9] platform/x86: hp-wmi: Driver refactoring and cleanups Darren Hart <dvhart@infradead.org> - 2017-04-20 22:30 +0200
Re: [PATCH v1 0/9] platform/x86: hp-wmi: Driver refactoring and cleanups Carlo Caione <carlo@caione.org> - 2017-04-20 11:10 +0200
csiph-web