From: thomas.abraham@linaro.org (Thomas Abraham)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] mmc: sdhci-s3c: Keep a copy of platform data and use it
Date: Thu, 03 Nov 2011 02:06:01 +0530 [thread overview]
Message-ID: <1320266163-15292-5-git-send-email-thomas.abraham@linaro.org> (raw)
In-Reply-To: <1320266163-15292-1-git-send-email-thomas.abraham@linaro.org>
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 <thomas.abraham@linaro.org>
---
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 141fbbf..c77ec42 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);
--
1.6.6.rc2
next prev parent reply other threads:[~2011-11-02 20:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-02 20:35 [PATCH 0/6] mmc: sdhci-s3c: Rework platform data and add device tree support Thomas Abraham
2011-11-02 20:35 ` [PATCH 1/6] mmc: sdhci-s3c: Remove usage of clk_type member in platform data Thomas Abraham
2011-11-02 20:35 ` [PATCH 2/6] arm: exynos4: use 'exynos4-sdhci' as device name for sdhci controllers Thomas Abraham
2011-11-02 20:36 ` [PATCH 3/6] arm: samsung: remove all uses of clk_type member in sdhci platform data Thomas Abraham
2011-11-02 20:36 ` Thomas Abraham [this message]
2011-11-02 20:36 ` [PATCH 5/6] mmc: Add OF bindings support for mmc host controller capabilities Thomas Abraham
2011-11-04 19:57 ` Olof Johansson
2011-11-07 14:21 ` Thomas Abraham
2011-11-07 21:15 ` Grant Likely
2011-11-08 15:19 ` Thomas Abraham
2011-11-02 20:36 ` [PATCH 6/6] mmc: sdhci-s3c: Add device tree support Thomas Abraham
2011-11-07 21:17 ` Grant Likely
2011-11-08 15:23 ` Thomas Abraham
2012-01-04 15:37 ` Sylwester Nawrocki
2012-01-05 15:45 ` Thomas Abraham
2012-01-05 16:22 ` Sylwester Nawrocki
2012-01-05 16:43 ` Thomas Abraham
2012-01-30 9:51 ` Heiko Stübner
2012-01-30 19:01 ` Grant Likely
2012-01-31 6:13 ` Heiko Stübner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320266163-15292-5-git-send-email-thomas.abraham@linaro.org \
--to=thomas.abraham@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).