From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751772AbbHGIsc (ORCPT ); Fri, 7 Aug 2015 04:48:32 -0400 Received: from mga03.intel.com ([134.134.136.65]:57639 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108AbbHGIsa (ORCPT ); Fri, 7 Aug 2015 04:48:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,629,1432623600"; d="scan'208";a="621054276" From: "Chen, Yu C" To: "joe@perches.com" CC: "linux-kernel@vger.kernel.org" , "Zhang, Rui" , "jslaby@suse.com" , "dvhart@infradead.org" , "platform-driver-x86@vger.kernel.org" , "akpm@linux-foundation.org" , "Wysocki, Rafael J" , "Westerberg, Mika" , "gregkh@linuxfoundation.org" , "mchehab@osg.samsung.com" , "arnd@arndb.de" Subject: Re: [PATCH] [v2] surface pro 3: Add support driver for Surface Pro 3 buttons Thread-Topic: [PATCH] [v2] surface pro 3: Add support driver for Surface Pro 3 buttons Thread-Index: AQHQ0OZPxArnD09L20CrXCPTswHLT53/rgUAgAAGroA= Date: Fri, 7 Aug 2015 08:48:18 +0000 Message-ID: <1438937513.2723.10.camel@localhost> References: <1438934272-17959-1-git-send-email-yu.c.chen@intel.com> <1438936078.2322.29.camel@perches.com> In-Reply-To: <1438936078.2322.29.camel@perches.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.160.131] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t778mbgu021259 On Fri, 2015-08-07 at 01:27 -0700, Joe Perches wrote: > On Fri, 2015-08-07 at 15:57 +0800, Chen Yu wrote: \ > > + ret; \ > > +}) > > This seems a bit complicated. > > The else ret = 0 isn't necessary as it's initialized to 0. > bool might be better than int. > Got. > > +static void surface_button_notify(struct acpi_device *device, u32 event) > > +{ > > + struct surface_button *button = acpi_driver_data(device); > > + struct input_dev *input; > > + int key_code = KEY_RESERVED; > > + bool pressed = false; > > + > > + if (!handle_surface_button_notify(POWER, KEY_POWER) && > > + !handle_surface_button_notify(HOME, KEY_LEFTMETA) && > > + !handle_surface_button_notify(VOLUME_UP, KEY_VOLUMEUP) && > > + !handle_surface_button_notify(VOLUME_DOWN, KEY_VOLUMEDOWN)) > > + dev_info_ratelimited(&device->dev, > > + "Unsupported event [0x%x]\n", event); > > Some might prefer alignment to the open parenthesis: > > if (!handle_surface_button_notify(POWER, KEY_POWER) && > !handle_surface_button_notify(HOME, KEY_LEFTMETA) && > !handle_surface_button_notify(VOLUME_UP, KEY_VOLUMEUP) && > !handle_surface_button_notify(VOLUME_DOWN, KEY_VOLUMEDOWN)) > > I think the older switch/case was easier to understand. > OK, then let's keep the switch/case. thanks. Best Regards, Yu {.n++%ݶw{.n+{G{ayʇڙ,jfhz_(階ݢj"mG?&~iOzv^m ?I