From patchwork Mon Oct 8 08:39:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1564501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 736B63FC1A for ; Mon, 8 Oct 2012 08:43:47 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TL8tj-00028t-NL; Mon, 08 Oct 2012 08:41:12 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TL8se-0001ht-TJ for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2012 08:40:06 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBK00J1IFZAC2S0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2012 17:40:03 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-ca-507291632539 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E7.21.03860.36192705; Mon, 08 Oct 2012 17:40:03 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBK0094QG1I1U90@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2012 17:40:03 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/16] pinctrl: samsung: Hold pointer to driver data in bank struct Date: Mon, 08 Oct 2012 10:39:08 +0200 Message-id: <1349685556-23718-9-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349685556-23718-1-git-send-email-t.figa@samsung.com> References: <1349685556-23718-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIJMWRmVeSWpSXmKPExsVy+t9jQd3kiUUBBk3TrS02Pb7G6sDosXlJ fQBjFJdNSmpOZllqkb5dAlfGu8kfWArOiFf8//KGvYFxqXAXIyeHhICJxJ9bXWwQtpjEhXvr gWwuDiGB6YwScy51MIEkhAQ2M0nMnswCYrMJqEl8bngE1iAioCExpesxO4jNLDCZSeLYgnQQ W1ggVOL35ulgcRYBVYm9zw4zgti8Ak4SBw/PZIZYJi/x9H4f2BxOAWeJkz/ns0LscpJYcuky ywRG3gWMDKsYRVMLkguKk9JzjfSKE3OLS/PS9ZLzczcxgj3+THoH46oGi0OMAhyMSjy8H/WK AoRYE8uKK3MPMUpwMCuJ8Kb2A4V4UxIrq1KL8uOLSnNSiw8xSnOwKInzNnukBAgJpCeWpGan phakFsFkmTg4pRoYK//tmRcTOnWianbzseMrF+/Z+658v+lU7v4FDybtvinGsWDBkvQVbWyf nghH/Tmj3ffpeg6TklLYt5nfrnB8j/3y/KGZWO3qwmgLdnnDD1L1lTfPTL2TaluW3veK8dL2 8kNclkbyohcUbZblTSx6/jxXxkVUpk2/6VDqrH/Wr362zeZa65/OrsRSnJFoqMVcVJwIAB7u uFT0AQAA X-Spam-Note: CRM114 invocation failed X-Spam-Score: -9.0 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.33 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.1 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; }; /**