From patchwork Thu Feb 13 19:12:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 3647241 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 92CD2BF13A for ; Thu, 13 Feb 2014 19:12:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 949D720145 for ; Thu, 13 Feb 2014 19:12:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E8122010E for ; Thu, 13 Feb 2014 19:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751692AbaBMTMU (ORCPT ); Thu, 13 Feb 2014 14:12:20 -0500 Received: from mail-pb0-f51.google.com ([209.85.160.51]:43331 "EHLO mail-pb0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751590AbaBMTMU (ORCPT ); Thu, 13 Feb 2014 14:12:20 -0500 Received: by mail-pb0-f51.google.com with SMTP id un15so11225408pbc.38 for ; Thu, 13 Feb 2014 11:12:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=nABMPjvxFx3GSsBOKQNvMrXvB7caDJq5Uc9GWqiSW/Y=; b=BsufPkqq5N00rM7HVGI+fr78bq7mLoNTtE6NT8VsziC2j+/jnrwaBM0Abp9EiERaki SF2qaUpDyDVmeyW2VGfEXq96zxULYkkYq3gO0LCc87AgcnXoJ7Ji95DKuP3KwdJcY/p9 lcfzWOjDXOofxqrQz0S1lknlP5zkSjT3kkapbXmFgt1J3HzVkdu0WIIeE8qSCyR2TsYm BXApmZBFvQoHVYJGJ9/dp4Ye5cwvcMh29yD5Ob5FOLIzPke6P5VR9nWkbZ2PrOxVLB0p 1PGDWARixr58wgFxg+d2tTAGQn/2JtHghVwH01U5lWi62kl6b+pvEcOndVo4ODST4FgG ZEvQ== X-Received: by 10.68.0.35 with SMTP id 3mr3721848pbb.52.1392318739556; Thu, 13 Feb 2014 11:12:19 -0800 (PST) Received: from mailhub.coreip.homeip.net (c-67-188-112-76.hsd1.ca.comcast.net. [67.188.112.76]) by mx.google.com with ESMTPSA id nm5sm9120041pbc.29.2014.02.13.11.12.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Feb 2014 11:12:18 -0800 (PST) Date: Thu, 13 Feb 2014 11:12:16 -0800 From: Dmitry Torokhov To: Christopher Heiny Cc: Courtney Cavin , linux-input@vger.kernel.org Subject: Re: [PATCH 01/15] Input: synaptics-rmi4 - fix checkpatch.pl, sparse and GCC warnings Message-ID: <20140213191216.GA3916@core.coreip.homeip.net> References: <1390521623-6491-1-git-send-email-courtney.cavin@sonymobile.com> <20140213063611.GB15260@core.coreip.homeip.net> <52FD1559.2040101@synaptics.com> <2278620.abrl2TfnmQ@dtor-d630.eng.vmware.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2278620.abrl2TfnmQ@dtor-d630.eng.vmware.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Feb 13, 2014 at 11:10:29AM -0800, Dmitry Torokhov wrote: > On Thursday, February 13, 2014 10:56:25 AM Christopher Heiny wrote: > > On 02/12/2014 10:36 PM, Dmitry Torokhov wrote: > > > On Wed, Feb 05, 2014 at 05:36:09PM -0800, Christopher Heiny wrote: > > >> >On 02/05/2014 05:09 PM, Dmitry Torokhov wrote: > > >>> > >On Tue, Feb 04, 2014 at 03:08:12PM -0800, Christopher Heiny wrote: > > >>>>> > >>>On 01/23/2014 04:00 PM, Courtney Cavin wrote: > > >>>>>>> > >>>> >Cc: Christopher Heiny > > >>>>>>> > >>>> >Cc: Dmitry Torokhov > > >>>>>>> > >>>> >Signed-off-by: Courtney Cavin > > >>>>>>> > >>>> >--- > > >>>>>>> > >>>> > > > >>>>>>> > >>>> > drivers/input/rmi4/rmi_bus.c | 4 ++-- > > >>>>>>> > >>>> > drivers/input/rmi4/rmi_bus.h | 2 +- > > >>>>>>> > >>>> > drivers/input/rmi4/rmi_driver.c | 17 ++++++++++++----- > > >>>>>>> > >>>> > drivers/input/rmi4/rmi_f11.c | 4 +++- > > >>>>>>> > >>>> > 4 files changed, 18 insertions(+), 9 deletions(-) > > >>>>>>> > >>>> > > > >>>>>>> > >>>> >diff --git a/drivers/input/rmi4/rmi_bus.c > > >>>>>>> > >>>> >b/drivers/input/rmi4/rmi_bus.c > > >>>>>>> > >>>> >index 96a76e7..8a939f3 100644 > > >>>>>>> > >>>> >--- a/drivers/input/rmi4/rmi_bus.c > > >>>>>>> > >>>> >+++ b/drivers/input/rmi4/rmi_bus.c > > >>>>>>> > >>>> >@@ -37,7 +37,7 @@ static void rmi_release_device(struct > > >>>>>>> > >>>> >device *dev) > > >>>>>>> > >>>> > > > >>>>>>> > >>>> > kfree(rmi_dev); > > >>>>>>> > >>>> > > > >>>>>>> > >>>> > } > > >>>>>>> > >>>> > > > >>>>>>> > >>>> >-struct device_type rmi_device_type = { > > >>>>>>> > >>>> >+static struct device_type rmi_device_type = { > > >>>>>>> > >>>> > > > >>>>>>> > >>>> > .name = "rmi_sensor", > > >>>>>>> > >>>> > .release = rmi_release_device, > > >>>>>>> > >>>> > > > >>>>>>> > >>>> > }; > > >>>>> > >>> > > >>>>> > >>>This struct is used by diagnostic modules to identify sensor > > >>>>> > >>>devices, so it cannot be static. > > >>> > > > > >>> > >Then we need to declare it somewhere or provide an accessor function. > > >> > > > >> >Currently it's in a header not included in the patches. We'll move > > >> >it to rmi_bus.h. > > > > > > Hmm, we do have rmi_is_physical_device() to identify whether it is a > > > sensor or a function, so I believe we should mark all structures static > > > to avoid anyone poking at them. > > > > I was poking around in the dependent code late last night and came to > > the same conclusion. I'll send a micropatch later today to get it out > > of the way. > > No need, I untangled relevant bits from the one Courtney sent. > > Thanks. Here it is by the way. Input: synaptics-rmi4 - make device types module-private From: Courtney Cavin Nobody outside of RMI bus core should be accessing rmi_device_type, rmi_function_type or rmi_physical_driver structures so let's limit their scope. We provide rmi_is_physical_device() and rmi_is_function_device() to allow determining whether one is dealing with sensor or function device. Signed-off-by: Courtney Cavin Signed-off-by: Dmitry Torokhov Signed-off-by: Christopher Heiny --- drivers/input/rmi4/rmi_bus.c | 4 ++-- drivers/input/rmi4/rmi_driver.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index 7efe7ed..6e0454a 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -38,7 +38,7 @@ static void rmi_release_device(struct device *dev) kfree(rmi_dev); } -struct device_type rmi_device_type = { +static struct device_type rmi_device_type = { .name = "rmi_sensor", .release = rmi_release_device, }; @@ -154,7 +154,7 @@ static void rmi_release_function(struct device *dev) kfree(fn); } -struct device_type rmi_function_type = { +static struct device_type rmi_function_type = { .name = "rmi_function", .release = rmi_release_function, }; diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 788343a..4406a7f 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -946,7 +946,7 @@ err_free_mem: return retval < 0 ? retval : 0; } -struct rmi_driver rmi_physical_driver = { +static struct rmi_driver rmi_physical_driver = { .driver = { .owner = THIS_MODULE, .name = "rmi_physical",