From patchwork Fri Sep 28 14:28:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1519881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id DCA47DF283 for ; Fri, 28 Sep 2012 14:34:58 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1THbbj-0004T6-KO; Fri, 28 Sep 2012 14:32:01 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1THbZW-0003Xc-I5 for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2012 14:29:43 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MB200ISDDKYMT10@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2012 23:29:41 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-87-5065b4544bf1 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 27.8D.03860.454B5605; Fri, 28 Sep 2012 23:29:40 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MB200E7BDK3XB70@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2012 23:29:40 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 07/16] pinctrl: samsung: Hold pointer to driver data in bank struct Date: Fri, 28 Sep 2012 16:28:38 +0200 Message-id: <1348842527-22460-8-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1348842527-22460-1-git-send-email-t.figa@samsung.com> References: <1348842527-22460-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrAJMWRmVeSWpSXmKPExsVy+t9jAd2QLakBBlPW21hsenyN1YHRY/OS +gDGKC6blNSczLLUIn27BK6Md5M/sBScEa/4/+UNewPjUuEuRg4OCQETiY7//F2MnECmmMSF e+vZuhi5OIQEFjFKPFq8nhHC2cwk8eDXXzaQKjYBNYnPDY/AbBEBDYkpXY/ZQWxmgclMEscW pIPYwgKREj0v7zKC2CwCqhK3H55mArF5BZwkJv+ZyAKxTV7i6f0+NpAjOAWcJdbO0wAJCwGV 9P9pYJnAyLuAkWEVo2hqQXJBcVJ6rpFecWJucWleul5yfu4mRrC/n0nvYFzVYHGIUYCDUYmH 98b8lAAh1sSy4srcQ4wSHMxKIrwZxakBQrwpiZVVqUX58UWlOanFhxilOViUxHmbPYCqBdIT S1KzU1MLUotgskwcnFINjLwRSQlN6Y5xtzds2HJmV1tJcaVRzNLbHHLdc7XXrp+xkOHvd+H1 9kanyoTv6aSzK381c3VRKXxp9m7T5yvXHSO6Pnz00lnXWLvvd+J/5cWHWuP6u7MsLDoyv0me WL+gePeRNCXJlSYTzpnsYlhtbHfzWkLexAVCtcwGxVf2Hmb+fD0k4Vt0mRJLcUaioRZzUXEi AMUKDmHzAQAA X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.24 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.8 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, swarren@wwwdotorg.org, devicetree-discuss@lists.ozlabs.org, tomasz.figa@gmail.com, t.figa@samsung.com, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, thomas.abraham@linaro.org, linus.walleij@linaro.org, m.szyprowski@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The pointer will be used by further extensions added to the driver. Signed-off-by: Tomasz Figa --- drivers/pinctrl/pinctrl-samsung.c | 20 +++++++++++--------- drivers/pinctrl/pinctrl-samsung.h | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index c988a4e..63c76ec 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -870,11 +870,12 @@ static int samsung_pinctrl_parse_dt_bank(struct samsung_pin_bank *bank, /* retrieve the soc specific data */ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( - struct platform_device *pdev) + struct platform_device *pdev, + struct samsung_pinctrl_drv_data *d) { int id; const struct of_device_id *match; - const struct device_node *node = pdev->dev.of_node; + struct device_node *node = pdev->dev.of_node; struct device_node *bank_np; struct samsung_pin_ctrl *ctrl; struct samsung_pin_bank *banks, *b; @@ -884,7 +885,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( u32 val; int ret; - id = of_alias_get_id(pdev->dev.of_node, "pinctrl"); + id = of_alias_get_id(node, "pinctrl"); if (id < 0) { dev_err(&pdev->dev, "failed to get alias id\n"); return NULL; @@ -922,6 +923,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( continue; if (samsung_pinctrl_parse_dt_bank(b, bank_np)) return NULL; + b->drvdata = d; b->pin_base = ctrl->nr_pins; ctrl->nr_pins += b->nr_pins; if (b->eint_type == EINT_TYPE_GPIO) { @@ -979,18 +981,18 @@ static int __devinit samsung_pinctrl_probe(struct platform_device *pdev) return -ENODEV; } - ctrl = samsung_pinctrl_get_soc_data(pdev); - if (!ctrl) { - dev_err(&pdev->dev, "driver data not available\n"); - return -EINVAL; - } - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) { dev_err(dev, "failed to allocate memory for driver's " "private data\n"); return -ENOMEM; } + + ctrl = samsung_pinctrl_get_soc_data(pdev, drvdata); + if (!ctrl) { + dev_err(&pdev->dev, "driver data not available\n"); + return -EINVAL; + } drvdata->ctrl = ctrl; drvdata->dev = dev; diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h index b7b74cc..9e30081 100644 --- a/drivers/pinctrl/pinctrl-samsung.h +++ b/drivers/pinctrl/pinctrl-samsung.h @@ -112,6 +112,7 @@ struct samsung_pinctrl_drv_data; * @irq_base: starting controller local irq number of the bank. * @name: name to be prefixed for each pin in this pin bank. * @of_node: node of pin bank in device tree + * @drvdata: link to controller driver data */ struct samsung_pin_bank { u32 pctl_offset; @@ -128,6 +129,7 @@ struct samsung_pin_bank { const char *name; struct device_node *of_node; + struct samsung_pinctrl_drv_data *drvdata; }; /**