From patchwork Fri Dec 5 17:37:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 5444951 Return-Path: X-Original-To: patchwork-linux-rockchip@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 CC132BEEA8 for ; Fri, 5 Dec 2014 17:37:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAAB8201F5 for ; Fri, 5 Dec 2014 17:37:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F31BF201EC for ; Fri, 5 Dec 2014 17:37:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XwwpG-0007Yo-F7; Fri, 05 Dec 2014 17:37:54 +0000 Received: from mail-bn1on0079.outbound.protection.outlook.com ([157.56.110.79] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xwwoz-0007H1-BR; Fri, 05 Dec 2014 17:37:38 +0000 Received: from BN1BFFO11FD003.protection.gbl (10.58.144.34) by BN1BFFO11HUB005.protection.gbl (10.58.144.152) with Microsoft SMTP Server (TLS) id 15.1.26.17; Fri, 5 Dec 2014 17:37:13 +0000 Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BN1BFFO11FD003.mail.protection.outlook.com (10.58.144.66) with Microsoft SMTP Server (TLS) id 15.1.26.17 via Frontend Transport; Fri, 5 Dec 2014 17:37:13 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1Xwwm2-0006tC-WA; Fri, 05 Dec 2014 09:34:35 -0800 Date: Fri, 5 Dec 2014 09:37:03 -0800 From: =?utf-8?B?U8O2cmVu?= Brinkmann To: "Ivan T. Ivanov" Subject: Re: [PATCH v2 7/7] pinctrl: qcom-spmi-gpio: Migrate to pinconf-generic References: <1417137993-8337-1-git-send-email-soren.brinkmann@xilinx.com> <1417137993-8337-8-git-send-email-soren.brinkmann@xilinx.com> <1417766393.22963.9.camel@mm-sol.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-7.5.0.1018-21152.001 X-TM-AS-User-Approved-Sender: Yes;Yes Message-ID: <40e6a2a0c9f54ba4805871cf33373561@BN1BFFO11FD003.protection.gbl> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.83; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(164054003)(24454002)(377424004)(189002)(199003)(51704005)(108616004)(76176999)(50986999)(106466001)(46102003)(4396001)(230783001)(77156002)(62966003)(104016003)(54356999)(74316001)(64706001)(92726002)(107046002)(20776003)(47776003)(85202003)(23676002)(86362001)(110136001)(31966008)(83506001)(92566001)(85182001)(87936001)(50466002)(21056001)(33646002)(99396003)(93886004)(120916001)(53416004)(6806004)(41533002)(107986001)(24736002)(23106004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1BFFO11HUB005; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; MLV:sfv; PTR:unknown-60-83.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB005; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:BN1BFFO11HUB005; X-Forefront-PRVS: 04163EF38A Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=soren.brinkmann@xilinx.com; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:BN1BFFO11HUB005; X-OriginatorOrg: xilinx.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141205_093737_584076_F9560DF5 X-CRM114-Status: GOOD ( 12.01 ) X-Spam-Score: -0.0 (/) Cc: Heiko Stuebner , linux-sh@vger.kernel.org, Linus Walleij , Michal Simek , linux-kernel@vger.kernel.org, Beniamino Galvani , linux-rockchip@lists.infradead.org, Laurent Pinchart , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, Alessandro Rubini X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Fri, 2014-12-05 at 09:08AM -0800, Sören Brinkmann wrote: > On Fri, 2014-12-05 at 09:59AM +0200, Ivan T. Ivanov wrote: > > > > On Thu, 2014-11-27 at 17:26 -0800, Soren Brinkmann wrote: > > > > > > static const struct pinconf_ops pmic_gpio_pinconf_ops = { > > > + .is_generic= true, > > > .pin_config_group_get= pmic_gpio_config_get, > > > .pin_config_group_set= pmic_gpio_config_set, > > > .pin_config_group_dbg_show= pmic_gpio_config_dbg_show, > > > @@ -848,6 +742,9 @@ static int pmic_gpio_probe(struct platform_device *pdev) > > > pctrldesc->name = dev_name(dev); > > > pctrldesc->pins = pindesc; > > > pctrldesc->npins = npins; > > > + pctrldesc->num_dt_params = ARRAY_SIZE(pmic_gpio_bindings); > > > + pctrldesc->params = pmic_gpio_bindings; > > > + pctrldesc->conf_items = pmic_conf_items; > > > > > > > What will happen if number of conf_items is less than number of params? > > I suppose bad things :) You're right, that should probably be checked > somewhere. Let me see whether I find a good place to put such a check. Looking at it, it's not that straight forward. We only pass one size to the core, so the core cannot really check that the number of entries in both arrays are equal. And passing the size of both looks a little redundant to me. That would put the driver in charge of making sure these arrays are aligned. With the change given below, it would at least trigger a compiler warning. I'll add that to the next iteration of this series. Longer term, merging those arrays, as you suggested, may be a better solution. Thanks, Sören -------------8<-------------8<-------------------8<------------------------8<--- diff --git a/drivers/pinctrl/pinctrl-zynq.c b/drivers/pinctrl/pinctrl-zynq.c index 29b75134771f..5942af4c2e67 100644 --- a/drivers/pinctrl/pinctrl-zynq.c +++ b/drivers/pinctrl/pinctrl-zynq.c @@ -924,7 +924,7 @@ static const struct pinconf_generic_dt_params zynq_dt_params[] = { { "io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18}, }; -static const struct pin_config_item zynq_conf_items[] = { +static const struct pin_config_item zynq_conf_items[ARRAY_SIZE(zynq_dt_params)] = { PCONFDUMP(PIN_CONFIG_IOSTANDARD, "IO-standard", NULL, true), }; diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index c612aaa653d5..17f811c9c2c0 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -136,7 +136,7 @@ static const struct pinconf_generic_dt_params pmic_gpio_bindings[] = { {"qcom,drive-strength", PMIC_GPIO_CONF_STRENGTH, 0}, }; -static const struct pin_config_item pmic_conf_items[] = { +static const struct pin_config_item pmic_conf_items[ARRAY_SIZE(pmic_gpio_bindings)] = { PCONFDUMP(PMIC_GPIO_CONF_PULL_UP, "pull up strength", NULL, true), PCONFDUMP(PMIC_GPIO_CONF_STRENGTH, "drive-strength", NULL, true), };