summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-11-17 14:00:20 +0100
committerMatthew Garrett <matthew.garrett@nebula.com>2013-11-20 18:50:48 -0500
commit33f9359abb9f6ded3e7b6dc98b1468c83404af49 (patch)
tree44a4f50491278c06965e4f26b2731aba4d31e949 /drivers/platform/x86
parentd038880efd9dd222c67fd31fbfca3440d0db3a06 (diff)
downloadop-kernel-dev-33f9359abb9f6ded3e7b6dc98b1468c83404af49.zip
op-kernel-dev-33f9359abb9f6ded3e7b6dc98b1468c83404af49.tar.gz
dell-laptop: Don't set sw_state from the query callback
The query callback should only update the hw_state, see the comment in net/rfkill/core.c in rfkill_set_block, which is its only caller. rfkill_set_block will modify the sw_state directly after calling query so calling set_sw_state is an expensive NOP. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/dell-laptop.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 06f281b..7f47396 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -425,10 +425,15 @@ out:
return ret;
}
-static void dell_rfkill_update(struct rfkill *rfkill, int radio, int status)
+static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio,
+ int status)
{
rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16)));
+}
+static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio,
+ int status)
+{
if (hwswitch_state & (BIT(radio - 1)))
rfkill_set_hw_state(rfkill, !(status & BIT(16)));
}
@@ -442,7 +447,7 @@ static void dell_rfkill_query(struct rfkill *rfkill, void *data)
status = buffer->output[1];
release_buffer();
- dell_rfkill_update(rfkill, (unsigned long)data, status);
+ dell_rfkill_update_hw_state(rfkill, (unsigned long)data, status);
}
static const struct rfkill_ops dell_rfkill_ops = {
@@ -528,12 +533,18 @@ static void dell_update_rfkill(struct work_struct *ignored)
status = buffer->output[1];
release_buffer();
- if (wifi_rfkill)
- dell_rfkill_update(wifi_rfkill, 1, status);
- if (bluetooth_rfkill)
- dell_rfkill_update(bluetooth_rfkill, 2, status);
- if (wwan_rfkill)
- dell_rfkill_update(wwan_rfkill, 3, status);
+ if (wifi_rfkill) {
+ dell_rfkill_update_hw_state(wifi_rfkill, 1, status);
+ dell_rfkill_update_sw_state(wifi_rfkill, 1, status);
+ }
+ if (bluetooth_rfkill) {
+ dell_rfkill_update_hw_state(bluetooth_rfkill, 2, status);
+ dell_rfkill_update_sw_state(bluetooth_rfkill, 2, status);
+ }
+ if (wwan_rfkill) {
+ dell_rfkill_update_hw_state(wwan_rfkill, 3, status);
+ dell_rfkill_update_sw_state(wwan_rfkill, 3, status);
+ }
}
static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill);
OpenPOWER on IntegriCloud