public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: "Chen, Yu C" <yu.c.chen@intel.com>
Cc: "joe@perches.com" <joe@perches.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Zhang, Rui" <rui.zhang@intel.com>,
	"jslaby@suse.com" <jslaby@suse.com>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	"Westerberg, Mika" <mika.westerberg@intel.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"mchehab@osg.samsung.com" <mchehab@osg.samsung.com>,
	"arnd@arndb.de" <arnd@arndb.de>
Subject: Re: [PATCH] surface pro 3: Add support driver for Surface Pro 3 buttons
Date: Wed, 5 Aug 2015 16:47:15 -0700	[thread overview]
Message-ID: <20150805234715.GB34034@vmdeb7> (raw)
In-Reply-To: <1438860256.2127.37.camel@localhost>

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

  reply	other threads:[~2015-08-06 17:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06  5:16 [PATCH] surface pro 3: Add support driver for Surface Pro 3 buttons Chen Yu
2015-08-06  5:30 ` Joe Perches
2015-08-06 11:20   ` Chen, Yu C
2015-08-05 23:47     ` Darren Hart [this message]
2015-08-06 18:55       ` Joe Perches
2015-08-11  2:56         ` Darren Hart
2015-08-07  7:49       ` Chen, Yu C
2015-08-06 14:54     ` Joe Perches

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=20150805234715.GB34034@vmdeb7 \
    --to=dvhart@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=mika.westerberg@intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=yu.c.chen@intel.com \
    /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