diff mbox

[2/3] dell_wmi: Use a C99-style array for bios_to_linux_keycode

Message ID c97f6a3b8c48eef0312db51e06a266e3ffeca620.1447479930.git.luto@kernel.org (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Andy Lutomirski Nov. 14, 2015, 5:49 a.m. UTC
It's currently hard to follow what maps to what, and it's hard to edit
the array.  Redo it as a C99-style array.

I generated this using emacs regexes and a python one-liner.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 drivers/platform/x86/dell-wmi.c | 61 +++++++++++++++++++++++++++--------------
 1 file changed, 40 insertions(+), 21 deletions(-)

Comments

Pali Rohár Nov. 14, 2015, 9:30 a.m. UTC | #1
On Friday 13 November 2015 21:49:31 Andy Lutomirski wrote:
> It's currently hard to follow what maps to what, and it's hard to edit
> the array.  Redo it as a C99-style array.
> 
> I generated this using emacs regexes and a python one-liner.
> 
> Signed-off-by: Andy Lutomirski <luto@kernel.org>

There are no function changes in this patch, so

Acked-by: Pali Rohár <pali.rohar@gmail.com>
Darren Hart Nov. 21, 2015, 12:09 a.m. UTC | #2
On Fri, Nov 13, 2015 at 09:49:31PM -0800, Andy Lutomirski wrote:
> It's currently hard to follow what maps to what, and it's hard to edit
> the array.  Redo it as a C99-style array.
> 
> I generated this using emacs regexes and a python one-liner.
> 
> Signed-off-by: Andy Lutomirski <luto@kernel.org>

Indeed, this is much nicer.

Please include all the maintainers listed in MAINTAINERS in the future for a
faster response.

Pali or Matthew, do either of you care to comment? I'm queueing to testing, will
merge to next shortly if I don't hear from you.

Thanks,

> ---
>  drivers/platform/x86/dell-wmi.c | 61 +++++++++++++++++++++++++++--------------
>  1 file changed, 40 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
> index 5be1abec4f64..92b0149fa4a7 100644
> --- a/drivers/platform/x86/dell-wmi.c
> +++ b/drivers/platform/x86/dell-wmi.c
> @@ -119,27 +119,46 @@ struct dell_bios_hotkey_table {
>  static const struct dell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 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0, 0, KEY_PROG3
> +	[0]	= KEY_MEDIA,
> +	[1]	= KEY_NEXTSONG,
> +	[2]	= KEY_PLAYPAUSE,
> +	[3]	= KEY_PREVIOUSSONG,
> +	[4]	= KEY_STOPCD,
> +	[5]	= KEY_UNKNOWN,
> +	[6]	= KEY_UNKNOWN,
> +	[7]	= KEY_UNKNOWN,
> +	[8]	= KEY_WWW,
> +	[9]	= KEY_UNKNOWN,
> +	[10]	= KEY_VOLUMEDOWN,
> +	[11]	= KEY_MUTE,
> +	[12]	= KEY_VOLUMEUP,
> +	[13]	= KEY_UNKNOWN,
> +	[14]	= KEY_BATTERY,
> +	[15]	= KEY_EJECTCD,
> +	[16]	= KEY_UNKNOWN,
> +	[17]	= KEY_SLEEP,
> +	[18]	= KEY_PROG1,
> +	[19]	= KEY_BRIGHTNESSDOWN,
> +	[20]	= KEY_BRIGHTNESSUP,
> +	[21]	= KEY_UNKNOWN,
> +	[22]	= KEY_KBDILLUMTOGGLE,
> +	[23]	= KEY_UNKNOWN,
> +	[24]	= KEY_SWITCHVIDEOMODE,
> +	[25]	= KEY_UNKNOWN,
> +	[26]	= KEY_UNKNOWN,
> +	[27]	= KEY_SWITCHVIDEOMODE,
> +	[28]	= KEY_UNKNOWN,
> +	[29]	= KEY_UNKNOWN,
> +	[30]	= KEY_PROG2,
> +	[31]	= KEY_UNKNOWN,
> +	[32]	= KEY_UNKNOWN,
> +	[33]	= KEY_UNKNOWN,
> +	[34]	= KEY_UNKNOWN,
> +	[35]	= KEY_UNKNOWN,
> +	[36]	= KEY_UNKNOWN,
> +	[37]	= KEY_UNKNOWN,
> +	[38]	= KEY_MICMUTE,
> +	[255]	= KEY_PROG3,
>  };
>  
>  /* These are applied if the hk table is present and doesn't override them. */
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Pali Rohár Nov. 21, 2015, 12:20 a.m. UTC | #3
On Saturday 21 November 2015 01:09:39 Darren Hart wrote:
> Pali or Matthew, do either of you care to comment?

Already commented, email is in archive, see:

http://thread.gmane.org/gmane.linux.drivers.platform.x86.devel/7936/focus=7941
Darren Hart Nov. 21, 2015, 12:26 a.m. UTC | #4
On Sat, Nov 21, 2015 at 01:20:19AM +0100, Pali Rohár wrote:
> On Saturday 21 November 2015 01:09:39 Darren Hart wrote:
> > Pali or Matthew, do either of you care to comment?
> 
> Already commented, email is in archive, see:
> 
> http://thread.gmane.org/gmane.linux.drivers.platform.x86.devel/7936/focus=7941

Right, sorry, I picked this up from my procmail auto-populated patches mbox
since I wasn't Cc'd - missed your response.

This is queued to testing.
Andy Lutomirski Nov. 21, 2015, 12:28 a.m. UTC | #5
On Fri, Nov 20, 2015 at 4:26 PM, Darren Hart <dvhart@infradead.org> wrote:
> On Sat, Nov 21, 2015 at 01:20:19AM +0100, Pali Rohár wrote:
>> On Saturday 21 November 2015 01:09:39 Darren Hart wrote:
>> > Pali or Matthew, do either of you care to comment?
>>
>> Already commented, email is in archive, see:
>>
>> http://thread.gmane.org/gmane.linux.drivers.platform.x86.devel/7936/focus=7941
>
> Right, sorry, I picked this up from my procmail auto-populated patches mbox
> since I wasn't Cc'd - missed your response.

Sorry, I parsed MAINTAINERS by hand incorrectly.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 5be1abec4f64..92b0149fa4a7 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -119,27 +119,46 @@  struct dell_bios_hotkey_table {
 static const struct dell_bios_hotkey_table *dell_bios_hotkey_table;
 
 static const u16 bios_to_linux_keycode[256] __initconst = {
-
-	KEY_MEDIA,	KEY_NEXTSONG,	KEY_PLAYPAUSE, KEY_PREVIOUSSONG,
-	KEY_STOPCD,	KEY_UNKNOWN,	KEY_UNKNOWN,	KEY_UNKNOWN,
-	KEY_WWW,	KEY_UNKNOWN,	KEY_VOLUMEDOWN, KEY_MUTE,
-	KEY_VOLUMEUP,	KEY_UNKNOWN,	KEY_BATTERY,	KEY_EJECTCD,
-	KEY_UNKNOWN,	KEY_SLEEP,	KEY_PROG1, KEY_BRIGHTNESSDOWN,
-	KEY_BRIGHTNESSUP,	KEY_UNKNOWN,	KEY_KBDILLUMTOGGLE,
-	KEY_UNKNOWN,	KEY_SWITCHVIDEOMODE,	KEY_UNKNOWN, KEY_UNKNOWN,
-	KEY_SWITCHVIDEOMODE,	KEY_UNKNOWN,	KEY_UNKNOWN, KEY_PROG2,
-	KEY_UNKNOWN,	KEY_UNKNOWN,	KEY_UNKNOWN,	KEY_UNKNOWN,
-	KEY_UNKNOWN,	KEY_UNKNOWN,	KEY_UNKNOWN,	KEY_MICMUTE,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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	= KEY_PROG2,
+	[31]	= KEY_UNKNOWN,
+	[32]	= KEY_UNKNOWN,
+	[33]	= KEY_UNKNOWN,
+	[34]	= KEY_UNKNOWN,
+	[35]	= KEY_UNKNOWN,
+	[36]	= KEY_UNKNOWN,
+	[37]	= KEY_UNKNOWN,
+	[38]	= KEY_MICMUTE,
+	[255]	= KEY_PROG3,
 };
 
 /* These are applied if the hk table is present and doesn't override them. */