提交 012994f4 编写于 作者: W Wolfram Sang 提交者: Chris Ball

mmc: sdhci_pltfm: pass more data on custom init call

The custom init call may need more data to perform its job, so we pass
it a pointer to pdata, too. Also, always use the platform_id specific
data even if platform_data is present. Doing that, platform_data can
additionally be parsed by init() for board-specific information (via
sdhci->mmc->parent).

(Note: the old behaviour was that you could override the platform_id
specific data with your own. However, one can still do this by using the
"sdhci" id instead of "sdhci-<something>".)
Signed-off-by: NWolfram Sang <w.sang@pengutronix.de>
Tested-by: NEric Bénard <eric@eukrea.com>
Signed-off-by: NChris Ball <cjb@laptop.org>
上级 2dfb579c
...@@ -52,15 +52,17 @@ static struct sdhci_ops sdhci_pltfm_ops = { ...@@ -52,15 +52,17 @@ static struct sdhci_ops sdhci_pltfm_ops = {
static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
{ {
struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
const struct platform_device_id *platid = platform_get_device_id(pdev); const struct platform_device_id *platid = platform_get_device_id(pdev);
struct sdhci_pltfm_data *pdata;
struct sdhci_host *host; struct sdhci_host *host;
struct sdhci_pltfm_host *pltfm_host; struct sdhci_pltfm_host *pltfm_host;
struct resource *iomem; struct resource *iomem;
int ret; int ret;
if (!pdata && platid && platid->driver_data) if (platid && platid->driver_data)
pdata = (void *)platid->driver_data; pdata = (void *)platid->driver_data;
else
pdata = pdev->dev.platform_data;
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!iomem) { if (!iomem) {
...@@ -109,7 +111,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) ...@@ -109,7 +111,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
} }
if (pdata && pdata->init) { if (pdata && pdata->init) {
ret = pdata->init(host); ret = pdata->init(host, pdata);
if (ret) if (ret)
goto err_plat_init; goto err_plat_init;
} }
......
...@@ -28,7 +28,7 @@ struct sdhci_host; ...@@ -28,7 +28,7 @@ struct sdhci_host;
struct sdhci_pltfm_data { struct sdhci_pltfm_data {
struct sdhci_ops *ops; struct sdhci_ops *ops;
unsigned int quirks; unsigned int quirks;
int (*init)(struct sdhci_host *host); int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata);
void (*exit)(struct sdhci_host *host); void (*exit)(struct sdhci_host *host);
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册