aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap_hsmmc.c
diff options
context:
space:
mode:
authorAndreas Fenkart <afenkart@gmail.com>2014-11-08 09:33:15 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2014-11-26 08:30:56 -0500
commit1e363e3b47bd9a0bddf1bfba8751240e0ecb3948 (patch)
treec0910f11a043b2cf60a1e4d1b0b63b1b64c019f1 /drivers/mmc/host/omap_hsmmc.c
parent326119c9923711d782e71e197429b1bab16125e1 (diff)
mmc: omap_hsmmc: pass mmc_priv struct to gpio init / free
this is needed when installing callbacks in the host struct and not in the platform data, e.g. cover detect irq should be stored in omap_hsmmc_host and not platform data Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Andreas Fenkart <afenkart@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 291b9e125d46..8a216c92c5a8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -449,7 +449,8 @@ static inline int omap_hsmmc_have_reg(void)
449 449
450#endif 450#endif
451 451
452static int omap_hsmmc_gpio_init(struct omap_hsmmc_platform_data *pdata) 452static int omap_hsmmc_gpio_init(struct omap_hsmmc_host *host,
453 struct omap_hsmmc_platform_data *pdata)
453{ 454{
454 int ret; 455 int ret;
455 456
@@ -494,7 +495,8 @@ err_free_sp:
494 return ret; 495 return ret;
495} 496}
496 497
497static void omap_hsmmc_gpio_free(struct omap_hsmmc_platform_data *pdata) 498static void omap_hsmmc_gpio_free(struct omap_hsmmc_host *host,
499 struct omap_hsmmc_platform_data *pdata)
498{ 500{
499 if (gpio_is_valid(pdata->gpio_wp)) 501 if (gpio_is_valid(pdata->gpio_wp))
500 gpio_free(pdata->gpio_wp); 502 gpio_free(pdata->gpio_wp);
@@ -2064,14 +2066,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2064 if (IS_ERR(base)) 2066 if (IS_ERR(base))
2065 return PTR_ERR(base); 2067 return PTR_ERR(base);
2066 2068
2067 ret = omap_hsmmc_gpio_init(pdata);
2068 if (ret)
2069 goto err;
2070
2071 mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev); 2069 mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev);
2072 if (!mmc) { 2070 if (!mmc) {
2073 ret = -ENOMEM; 2071 ret = -ENOMEM;
2074 goto err_alloc; 2072 goto err;
2075 } 2073 }
2076 2074
2077 host = mmc_priv(mmc); 2075 host = mmc_priv(mmc);
@@ -2088,6 +2086,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2088 host->next_data.cookie = 1; 2086 host->next_data.cookie = 1;
2089 host->pbias_enabled = 0; 2087 host->pbias_enabled = 0;
2090 2088
2089 ret = omap_hsmmc_gpio_init(host, pdata);
2090 if (ret)
2091 goto err_gpio;
2092
2091 platform_set_drvdata(pdev, host); 2093 platform_set_drvdata(pdev, host);
2092 2094
2093 if (pdev->dev.of_node) 2095 if (pdev->dev.of_node)
@@ -2283,9 +2285,9 @@ err_irq:
2283 if (host->dbclk) 2285 if (host->dbclk)
2284 clk_disable_unprepare(host->dbclk); 2286 clk_disable_unprepare(host->dbclk);
2285err1: 2287err1:
2288 omap_hsmmc_gpio_free(host, pdata);
2289err_gpio:
2286 mmc_free_host(mmc); 2290 mmc_free_host(mmc);
2287err_alloc:
2288 omap_hsmmc_gpio_free(pdata);
2289err: 2291err:
2290 return ret; 2292 return ret;
2291} 2293}
@@ -2309,7 +2311,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
2309 if (host->dbclk) 2311 if (host->dbclk)
2310 clk_disable_unprepare(host->dbclk); 2312 clk_disable_unprepare(host->dbclk);
2311 2313
2312 omap_hsmmc_gpio_free(host->pdata); 2314 omap_hsmmc_gpio_free(host, host->pdata);
2313 mmc_free_host(host->mmc); 2315 mmc_free_host(host->mmc);
2314 2316
2315 return 0; 2317 return 0;