[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150805234715.GB34034@vmdeb7>
Date: Wed, 5 Aug 2015 16:47:15 -0700
From: Darren Hart <dvhart@...radead.org>
To: "Chen, Yu C" <yu.c.chen@...el.com>
Cc: "joe@...ches.com" <joe@...ches.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Zhang, Rui" <rui.zhang@...el.com>,
"jslaby@...e.com" <jslaby@...e.com>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
"Westerberg, Mika" <mika.westerberg@...el.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"mchehab@....samsung.com" <mchehab@....samsung.com>,
"arnd@...db.de" <arnd@...db.de>
Subject: Re: [PATCH] surface pro 3: Add support driver for Surface Pro 3
buttons
On Thu, Aug 06, 2015 at 11:20:44AM +0000, Chen, Yu C wrote:
> Thanks Joe,
> On Wed, 2015-08-05 at 22:30 -0700, Joe Perches wrote:
> > On Thu, 2015-08-06 at 13:16 +0800, Chen Yu wrote:
> > > Since Surface Pro 3 does not follow the specs of "Windows ACPI Design
> > > Guide for SoC Platform", code in drivers/input/misc/soc_array.c can
> > > not detect these buttons on it.
> >
> > style trivia:
> >
> > > diff --git a/drivers/platform/x86/surfacepro3_button.c b/drivers/platform/x86/surfacepro3_button.c
> > []
> > > +static void surface_button_notify(struct acpi_device *device, u32 event)
> > > +{
> > []
> > > + switch (event) {
> > > + case SURFACE_BUTTON_NOTIFY_PRESS_POWER:
> > > + pressed = true;
> > > + /*go through*/
> >
> > /* fall through */ is more common
> >
> OK.
> > > + case SURFACE_BUTTON_NOTIFY_PRESS_HOME:
> > > + pressed = true;
> > > + case SURFACE_BUTTON_NOTIFY_RELEASE_HOME:
> > > + key_code = KEY_LEFTMETA;
> > > + break;
> >
> > It may be better to add a comment about the style or
> > maybe add a macro like
> >
> > #define HANDLE_SURFACE_BUTTON_NOTIFY(type, code) \
> > case SURFACE_BUTTON_NOTIFY_PRESS_##type: \
> > pressed = true; /* and fall-through */ \
> > case SURFACE_BUTTON_NOTIFY_RELEASE_##type: \
> > key_code = code; \
> > break;
> >
> WRT macro HANDLE_SURFACE_BUTTON_NOTIFY, the checkpatch.pl
> complains that multi lines of codes should be wrapped in 'do
> while'state, but doing like this might lead to incorrect semantic.
> Is it ok to keep these codes and add comments like:
> /*
> * When a button(power button/volume button/home button) is
> * pressed down or released, different ACPI notification codes
> * will be generated. We can distinguish different event code
> * and value of buttons by these notification codes, then pass
> * (EV_KEY, event code(key_code), value(pressed)) to input layer.
> */
The commentary is useful regardless. However, I suspect Joe was
referring to the approach pairing the PRESS and RELEASE cases?
--
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists