From: Maxim Mikityanskiy <maxtram95@gmail.com>
To: platform-driver-x86@vger.kernel.org, jlee@novell.com, mjg@redhat.com
Cc: Maxim Mikityanskiy <maxtram95@gmail.com>
Subject: [PATCH 3/6] msi-laptop: Code cleanups
Date: Sun, 25 Nov 2012 00:28:58 +0200 [thread overview]
Message-ID: <1353796141-1470-4-git-send-email-maxtram95@gmail.com> (raw)
In-Reply-To: <1353796141-1470-1-git-send-email-maxtram95@gmail.com>
Replaced msi_init_rfkill() by msi_update_rfkill(), removed delays by
replacing delayed works by just works and made msi_laptop_i8042_filter()
filter out KEY_TOUCHPAD_TOGGLE when sending KEY_TOUCHPAD_ON and
KEY_TOUCHPAD_OFF.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
---
drivers/platform/x86/msi-laptop.c | 67 ++++++++++++++-------------------------
1 file changed, 24 insertions(+), 43 deletions(-)
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index 7ba107a..3b6f494 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -600,8 +600,23 @@ static const struct rfkill_ops rfkill_threeg_ops = {
.set_block = rfkill_threeg_set
};
+static void msi_update_rfkill(struct work_struct *ignored)
+{
+ get_wireless_state_ec_standard();
+
+ if (rfk_wlan)
+ rfkill_set_sw_state(rfk_wlan, !wlan_s);
+ if (rfk_bluetooth)
+ rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s);
+ if (rfk_threeg)
+ rfkill_set_sw_state(rfk_threeg, !threeg_s);
+}
+static DECLARE_WORK(msi_rfkill_work, msi_update_rfkill);
+
static void rfkill_cleanup(void)
{
+ cancel_work_sync(&msi_rfkill_work);
+
if (rfk_bluetooth) {
rfkill_unregister(rfk_bluetooth);
rfkill_destroy(rfk_bluetooth);
@@ -618,19 +633,6 @@ static void rfkill_cleanup(void)
}
}
-static void msi_update_rfkill(struct work_struct *ignored)
-{
- get_wireless_state_ec_standard();
-
- if (rfk_wlan)
- rfkill_set_sw_state(rfk_wlan, !wlan_s);
- if (rfk_bluetooth)
- rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s);
- if (rfk_threeg)
- rfkill_set_sw_state(rfk_threeg, !threeg_s);
-}
-static DECLARE_DELAYED_WORK(msi_rfkill_work, msi_update_rfkill);
-
static void msi_send_touchpad_key(struct work_struct *ignored)
{
u8 rdata;
@@ -644,7 +646,7 @@ static void msi_send_touchpad_key(struct work_struct *ignored)
(rdata & MSI_STANDARD_EC_TOUCHPAD_MASK) ?
KEY_TOUCHPAD_ON : KEY_TOUCHPAD_OFF, 1, true);
}
-static DECLARE_DELAYED_WORK(msi_touchpad_work, msi_send_touchpad_key);
+static DECLARE_WORK(msi_touchpad_work, msi_send_touchpad_key);
static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str,
struct serio *port)
@@ -662,14 +664,16 @@ static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str,
extended = false;
switch (data) {
case 0xE4:
- schedule_delayed_work(&msi_touchpad_work,
- round_jiffies_relative(0.5 * HZ));
- break;
+ schedule_work(&msi_touchpad_work);
+ case 0x64:
+ /* Filter out KEY_TOUCHPAD_TOGGLE and send only
+ * KEY_TOUCHPAD_ON and KEY_TOUCHPAD_OFF
+ */
+ return true;
case 0x54:
case 0x62:
case 0x76:
- schedule_delayed_work(&msi_rfkill_work,
- round_jiffies_relative(0.5 * HZ));
+ schedule_work(&msi_rfkill_work);
break;
}
}
@@ -677,31 +681,11 @@ static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str,
return false;
}
-static void msi_init_rfkill(struct work_struct *ignored)
-{
- if (rfk_wlan) {
- rfkill_set_sw_state(rfk_wlan, !wlan_s);
- rfkill_wlan_set(NULL, !wlan_s);
- }
- if (rfk_bluetooth) {
- rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s);
- rfkill_bluetooth_set(NULL, !bluetooth_s);
- }
- if (rfk_threeg) {
- rfkill_set_sw_state(rfk_threeg, !threeg_s);
- rfkill_threeg_set(NULL, !threeg_s);
- }
-}
-static DECLARE_DELAYED_WORK(msi_rfkill_init, msi_init_rfkill);
-
static int rfkill_init(struct platform_device *sdev)
{
/* add rfkill */
int retval;
- /* keep the hardware wireless state */
- get_wireless_state_ec_standard();
-
rfk_bluetooth = rfkill_alloc("msi-bluetooth", &sdev->dev,
RFKILL_TYPE_BLUETOOTH,
&rfkill_bluetooth_ops, NULL);
@@ -736,8 +720,7 @@ static int rfkill_init(struct platform_device *sdev)
}
/* schedule to run rfkill state initial */
- schedule_delayed_work(&msi_rfkill_init,
- round_jiffies_relative(1 * HZ));
+ schedule_work(&msi_rfkill_work);
return 0;
@@ -951,7 +934,6 @@ fail_platform_device2:
if (load_scm_model) {
i8042_remove_filter(msi_laptop_i8042_filter);
- cancel_delayed_work_sync(&msi_rfkill_work);
rfkill_cleanup();
}
platform_device_del(msipf_device);
@@ -976,7 +958,6 @@ static void __exit msi_cleanup(void)
if (load_scm_model) {
i8042_remove_filter(msi_laptop_i8042_filter);
msi_laptop_input_destroy();
- cancel_delayed_work_sync(&msi_rfkill_work);
rfkill_cleanup();
}
--
1.8.0
next prev parent reply other threads:[~2012-11-24 22:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-24 22:28 [PATCH 0/6] msi-laptop: Add MSI Wind U90/U100 support Maxim Mikityanskiy
2012-11-24 22:28 ` [PATCH 1/6] msi-laptop: Use proper return codes instead of -1 Maxim Mikityanskiy
2012-11-28 2:07 ` joeyli
2012-11-24 22:28 ` [PATCH 2/6] msi-laptop: Work around gcc warning Maxim Mikityanskiy
2012-11-28 2:47 ` joeyli
2012-11-24 22:28 ` Maxim Mikityanskiy [this message]
2012-11-28 3:11 ` [PATCH 3/6] msi-laptop: Code cleanups joeyli
2012-11-28 17:32 ` Maxim Mikityanskiy
2012-11-29 8:10 ` joeyli
2012-11-29 16:31 ` Maxim Mikityanskiy
2012-11-24 22:28 ` [PATCH 4/6] msi-laptop: Add MSI Wind U90/U100 support Maxim Mikityanskiy
2012-11-28 3:32 ` joeyli
2012-11-28 17:41 ` Maxim Mikityanskiy
2012-11-29 4:14 ` joeyli
2012-11-29 16:31 ` Maxim Mikityanskiy
2012-11-24 22:29 ` [PATCH 5/6] msi-laptop: Add missing ABI documentation Maxim Mikityanskiy
2012-11-28 3:36 ` joeyli
2012-11-24 22:29 ` [PATCH 6/6] Add MSI Wind WMI support Maxim Mikityanskiy
2012-11-27 8:14 ` joeyli
2012-11-27 8:50 ` Corentin Chary
2012-11-27 15:55 ` Maxim Mikityanskiy
2012-11-27 16:34 ` Corentin Chary
2012-11-27 16:49 ` Maxim Mikityanskiy
2012-11-27 23:20 ` joeyli
2012-11-28 18:03 ` Maxim Mikityanskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353796141-1470-4-git-send-email-maxtram95@gmail.com \
--to=maxtram95@gmail.com \
--cc=jlee@novell.com \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox