Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751806AbdC0AmH (ORCPT ); Sun, 26 Mar 2017 20:42:07 -0400 Received: from server.atrad.com.au ([150.101.241.2]:55010 "EHLO server.atrad.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751740AbdC0AmF (ORCPT ); Sun, 26 Mar 2017 20:42:05 -0400 Date: Mon, 27 Mar 2017 11:10:56 +1030 From: Jonathan Woithe To: Micha?? K??pie?? Cc: Darren Hart , Andy Shevchenko , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 7/8] platform/x86: fujitsu-laptop: model-dependent sparse keymap overrides Message-ID: <20170327004055.GI334@marvin.atrad.com.au> References: <20170320093224.18541-1-kernel@kempniu.pl> <20170320093224.18541-8-kernel@kempniu.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170320093224.18541-8-kernel@kempniu.pl> User-Agent: Mutt/1.5.23 (2014-03-12) X-MIMEDefang-action: accept Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1399 Lines: 36 On Mon, Mar 20, 2017 at 10:32:23AM +0100, Micha?? K??pie?? wrote: > Some laptop models need to have different keycodes assigned to hotkey > scancodes. Change the sparse keymap upon a DMI match, before the hotkey > input device is setup. > > Instead of using three different callbacks in the DMI match table, > simplify code by using the driver_data field of struct dmi_system_id to > supply the requested keymap to a common callback. Also merge keymaps > for S6410 and S6420 as they are identical. > > [cut] > > diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c > index 8f1c9c204110..1487eb2396c6 100644 > --- a/drivers/platform/x86/fujitsu-laptop.c > +++ b/drivers/platform/x86/fujitsu-laptop.c > @@ -766,8 +711,62 @@ static const struct key_entry keymap_default[] = { > { KE_END, 0 } > }; > > +static const struct key_entry keymap_s6400[] = { > + { KE_KEY, KEY1_CODE, { KEY_SCREENLOCK } }, /* "Lock" */ > + { KE_KEY, KEY2_CODE, { KEY_HELP } }, /* "Mobility Center */ > + { KE_KEY, KEY3_CODE, { KEY_PROG3 } }, > + { KE_KEY, KEY4_CODE, { KEY_PROG4 } }, > + { KE_END, 0 } > +}; Since this keymap applies to both the S6410 and S6420, referencing S6400 in its name might be slightly confusing in future. Calling this "keymap_s64x0" or (if it fits better with conventions used elsewhere) "keymap_s64X0" would avoid the confusion. Regards jonathan