From: joeyli <jlee@suse.com>
To: Maxim Mikityanskiy <maxtram95@gmail.com>
Cc: platform-driver-x86@vger.kernel.org, anisse@astier.eu
Subject: Re: [PATCH v3 09/12] msi-wmi: Use enums for scancodes
Date: Mon, 10 Dec 2012 14:01:30 +0800 [thread overview]
Message-ID: <1355119290.21227.1842.camel@linux-s257.site> (raw)
In-Reply-To: <1354888162-12109-10-git-send-email-maxtram95@gmail.com>
於 五,2012-12-07 於 15:49 +0200,Maxim Mikityanskiy 提到:
> Use enums for consecutive scancodes, rename key names from MSI_WMI_* to
> MSI_KEY_* and use tabs for whitespace in msi_wmi_keymap.
>
> Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Acked-by: Lee, Chun-Yi <jlee@suse.com>
Thanks
Joey Lee
> ---
> drivers/platform/x86/msi-wmi.c | 34 ++++++++++++++++++----------------
> 1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
> index 4db0c55..112ec14 100644
> --- a/drivers/platform/x86/msi-wmi.c
> +++ b/drivers/platform/x86/msi-wmi.c
> @@ -42,19 +42,21 @@ MODULE_LICENSE("GPL");
> MODULE_ALIAS("wmi:" MSIWMI_BIOS_GUID);
> MODULE_ALIAS("wmi:" MSIWMI_EVENT_GUID);
>
> -#define SCANCODE_BASE 0xD0
> -#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE
> -#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1)
> -#define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2)
> -#define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3)
> -#define MSI_WMI_MUTE (SCANCODE_BASE + 4)
> +enum msi_scancodes {
> + MSI_SCANCODE_BASE = 0xD0,
> + MSI_KEY_BRIGHTNESSUP = MSI_SCANCODE_BASE,
> + MSI_KEY_BRIGHTNESSDOWN,
> + MSI_KEY_VOLUMEUP,
> + MSI_KEY_VOLUMEDOWN,
> + MSI_KEY_MUTE,
> +};
> static struct key_entry msi_wmi_keymap[] = {
> - { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
> - { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
> - { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} },
> - { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
> - { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} },
> - { KE_END, 0}
> + { KE_KEY, MSI_KEY_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
> + { KE_KEY, MSI_KEY_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
> + { KE_KEY, MSI_KEY_VOLUMEUP, {KEY_VOLUMEUP} },
> + { KE_KEY, MSI_KEY_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
> + { KE_KEY, MSI_KEY_MUTE, {KEY_MUTE} },
> + { KE_END, 0 }
> };
> static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1];
>
> @@ -169,7 +171,7 @@ static void msi_wmi_notify(u32 value, void *context)
> ktime_t diff;
> cur = ktime_get_real();
> diff = ktime_sub(cur, last_pressed[key->code -
> - SCANCODE_BASE]);
> + MSI_SCANCODE_BASE]);
> /* Ignore event if the same event happened in a 50 ms
> timeframe -> Key press may result in 10-20 GPEs */
> if (ktime_to_us(diff) < 1000 * 50) {
> @@ -178,13 +180,13 @@ static void msi_wmi_notify(u32 value, void *context)
> key->code, ktime_to_us(diff));
> goto msi_wmi_notify_exit;
> }
> - last_pressed[key->code - SCANCODE_BASE] = cur;
> + last_pressed[key->code - MSI_SCANCODE_BASE] = cur;
>
> if (key->type == KE_KEY &&
> /* Brightness is served via acpi video driver */
> (!acpi_video_backlight_support() ||
> - (key->code != MSI_WMI_BRIGHTNESSUP &&
> - key->code != MSI_WMI_BRIGHTNESSDOWN))) {
> + (key->code != MSI_KEY_BRIGHTNESSUP &&
> + key->code != MSI_KEY_BRIGHTNESSDOWN))) {
> pr_debug("Send key: 0x%X - "
> "Input layer keycode: %d\n",
> key->code, key->keycode);
next prev parent reply other threads:[~2012-12-10 6:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 13:49 [PATCH v3 00/12] Add MSI Wind U90/U100 support Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 01/12] msi-laptop: Use proper return codes instead of -1 Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 02/12] msi-laptop: Work around gcc warning Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 03/12] msi-laptop: merge quirk tables to one Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 04/12] msi-laptop: Add MSI Wind U90/U100 support Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 05/12] msi-laptop: Add missing ABI documentation Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 06/12] msi-laptop: Disable brightness control for new EC Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 07/12] msi-wmi: Fix memory leak Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 08/12] msi-wmi: Avoid repeating constants Maxim Mikityanskiy
2012-12-10 5:52 ` joeyli
2012-12-07 13:49 ` [PATCH v3 09/12] msi-wmi: Use enums for scancodes Maxim Mikityanskiy
2012-12-10 6:01 ` joeyli [this message]
2012-12-07 13:49 ` [PATCH v3 10/12] msi-wmi: Make keys and backlight independent Maxim Mikityanskiy
2012-12-07 13:49 ` [PATCH v3 11/12] msi-wmi: Introduced quirk_last_pressed Maxim Mikityanskiy
2012-12-11 16:29 ` Anisse Astier
2012-12-11 17:07 ` Maxim Mikityanskiy
2012-12-11 17:39 ` Anisse Astier
2012-12-11 18:27 ` Maxim Mikityanskiy
2012-12-12 9:58 ` Anisse Astier
2012-12-12 18:58 ` Dmitry Torokhov
2012-12-13 17:10 ` Anisse Astier
2012-12-13 18:06 ` Maxim Mikityanskiy
2012-12-13 18:18 ` Dmitry Torokhov
2012-12-13 18:30 ` Maxim Mikityanskiy
2012-12-14 10:37 ` joeyli
2012-12-14 11:13 ` Thomas Renninger
2012-12-07 13:49 ` [PATCH v3 12/12] msi-wmi: Add MSI Wind support 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=1355119290.21227.1842.camel@linux-s257.site \
--to=jlee@suse.com \
--cc=anisse@astier.eu \
--cc=maxtram95@gmail.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