Re: [PATCH v2] dell-wmi: Improve unknown hotkey handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 23, 2015 at 03:56:43PM +0100, Pali Rohár wrote:
> On Friday 20 November 2015 17:30:13 Andy Lutomirski wrote:
> > On Fri, Nov 20, 2015 at 5:27 PM, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
> > > If DMI lists a hotkey that we don't recognize, log and ignore it
> > > instead of trying to map it to keycode 0.  I haven't seen this happen,
> > > but it will help maintain the key map in the future and it will help
> > > avoid sending bogus events.
> > >
> > > This also improves the message that we log when we get an unknown key
> > > event.
> > >
> > > Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
> > > ---
> > >
> > > Changes from v1:
> > >  - Use KEY_RESERVED instead of zero and document why that's okay
> > >  - Fix scancode vs keycode confusion in the log message (whoops!)
> > >  - Switch from hardcoded 256 to ARRAY_SIZE
> > >
> > >  drivers/platform/x86/dell-wmi.c | 25 +++++++++++++++++++++----
> > >  1 file changed, 21 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
> > > index d2daf5417cd7..cb96ef03fa79 100644
> > > --- a/drivers/platform/x86/dell-wmi.c
> > > +++ b/drivers/platform/x86/dell-wmi.c
> > 
> > 
> > > +               /* Uninitialized entries are 0 aka KEY_RESERVED. */
> > > +               BUILD_BUG_ON(KEY_RESERVED != 0);
> > > +               u16 keycode = (bios_entry->keycode <
> > > +                              ARRAY_SIZE(bios_to_linux_keycode)) ?
> > > +                       bios_to_linux_keycode[bios_entry->keycode] :
> > > +                       KEY_RESERVED;
> > 
> > Oops.  BUILD_BUG_ON should be below u16 keycode = ... to avoid a
> > warning.  Feel free to fix it up.  I can also send a v3.
> 
> KEY_RESERVED is zero by definition and exported to user space. So this
> should not be redefined otherwise Linux ABI will be broken too.
> 
> So I think BUILD_BUG_ON is not needed there.

Queued to testing sans BUILD_BUG_ON. Pali, any further concerns? If not, please
provide a reviewed-by.

Thanks,

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux