From patchwork Tue Jan 31 17:56:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 6480 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CC2D823E0E for ; Tue, 31 Jan 2012 17:51:17 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id BC180A183AD for ; Tue, 31 Jan 2012 17:51:17 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id r19so301166bka.11 for ; Tue, 31 Jan 2012 09:51:17 -0800 (PST) Received: by 10.205.139.12 with SMTP id iu12mr10932879bkc.2.1328032277592; Tue, 31 Jan 2012 09:51:17 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.130.220 with SMTP id u28cs189020bks; Tue, 31 Jan 2012 09:51:17 -0800 (PST) Received: by 10.68.74.164 with SMTP id u4mr51905700pbv.85.1328032276030; Tue, 31 Jan 2012 09:51:16 -0800 (PST) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id h6si27274136pbn.119.2012.01.31.09.51.15; Tue, 31 Jan 2012 09:51:16 -0800 (PST) Received-SPF: neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LYO005WXC933HR0@mailout1.samsung.com> for patches@linaro.org; Wed, 01 Feb 2012 02:51:14 +0900 (KST) X-AuditID: cbfee61a-b7cd2ae000004fa5-56-4f282a1265ca Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id 3C.50.20389.21A282F4; Wed, 01 Feb 2012 02:51:14 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0LYO00JBQC8XW340@mmp2.samsung.com> for patches@linaro.org; Wed, 01 Feb 2012 02:51:14 +0900 (KST) From: Thomas Abraham To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org, cjb@laptop.org, grant.likely@secretlab.ca, rob.herring@calxeda.com, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, ben-linux@fluff.org, patches@linaro.org Subject: [PATCH v3 5/6] mmc: sdhci-s3c: Keep a copy of platform data and use it Date: Tue, 31 Jan 2012 23:26:15 +0530 Message-id: <1328032576-9269-6-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1328032576-9269-1-git-send-email-thomas.abraham@linaro.org> References: <1328032576-9269-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== The platform data is copied into driver's private data and the copy is used for all access to the platform data. This simpifies the addition of device tree support for the sdhci-s3c driver. Signed-off-by: Thomas Abraham --- drivers/mmc/host/sdhci-s3c.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index a57d7a0..1760ba8 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -424,7 +424,7 @@ static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data( static int __devinit sdhci_s3c_probe(struct platform_device *pdev) { - struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data; + struct s3c_sdhci_platdata *pdata; struct sdhci_s3c_drv_data *drv_data; struct device *dev = &pdev->dev; struct sdhci_host *host; @@ -432,7 +432,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) struct resource *res; int ret, irq, ptr, clks; - if (!pdata) { + if (!pdev->dev.platform_data) { dev_err(dev, "no device data specified\n"); return -ENOENT; } @@ -455,6 +455,13 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) return PTR_ERR(host); } + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + ret = -ENOMEM; + goto err_io_clk; + } + memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata)); + drv_data = sdhci_s3c_get_driver_data(pdev); sc = sdhci_priv(host);