diff options
author | Kevin Hao <haokexin@gmail.com> | 2015-02-27 02:47:27 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-03-23 09:13:33 -0400 |
commit | e4f79d9ca21810a606ecce9067b8b037a5511413 (patch) | |
tree | af06ec67b7deda8d47d468ce4e339d34db0f307a | |
parent | 35daeede227051e7fe91aee33d57dd7b0077e660 (diff) |
mmc: tegra: use devm help functions to get the clk and gpio
Simplify the error and remove path.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/sdhci-tegra.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index f3778d58d1cd..0643f66b4e14 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c | |||
@@ -286,7 +286,8 @@ static int sdhci_tegra_probe(struct platform_device *pdev) | |||
286 | goto err_parse_dt; | 286 | goto err_parse_dt; |
287 | 287 | ||
288 | if (gpio_is_valid(tegra_host->power_gpio)) { | 288 | if (gpio_is_valid(tegra_host->power_gpio)) { |
289 | rc = gpio_request(tegra_host->power_gpio, "sdhci_power"); | 289 | rc = devm_gpio_request(&pdev->dev, tegra_host->power_gpio, |
290 | "sdhci_power"); | ||
290 | if (rc) { | 291 | if (rc) { |
291 | dev_err(mmc_dev(host->mmc), | 292 | dev_err(mmc_dev(host->mmc), |
292 | "failed to allocate power gpio\n"); | 293 | "failed to allocate power gpio\n"); |
@@ -295,7 +296,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev) | |||
295 | gpio_direction_output(tegra_host->power_gpio, 1); | 296 | gpio_direction_output(tegra_host->power_gpio, 1); |
296 | } | 297 | } |
297 | 298 | ||
298 | clk = clk_get(mmc_dev(host->mmc), NULL); | 299 | clk = devm_clk_get(mmc_dev(host->mmc), NULL); |
299 | if (IS_ERR(clk)) { | 300 | if (IS_ERR(clk)) { |
300 | dev_err(mmc_dev(host->mmc), "clk err\n"); | 301 | dev_err(mmc_dev(host->mmc), "clk err\n"); |
301 | rc = PTR_ERR(clk); | 302 | rc = PTR_ERR(clk); |
@@ -312,10 +313,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev) | |||
312 | 313 | ||
313 | err_add_host: | 314 | err_add_host: |
314 | clk_disable_unprepare(pltfm_host->clk); | 315 | clk_disable_unprepare(pltfm_host->clk); |
315 | clk_put(pltfm_host->clk); | ||
316 | err_clk_get: | 316 | err_clk_get: |
317 | if (gpio_is_valid(tegra_host->power_gpio)) | ||
318 | gpio_free(tegra_host->power_gpio); | ||
319 | err_power_req: | 317 | err_power_req: |
320 | err_parse_dt: | 318 | err_parse_dt: |
321 | err_alloc_tegra_host: | 319 | err_alloc_tegra_host: |
@@ -327,16 +325,11 @@ static int sdhci_tegra_remove(struct platform_device *pdev) | |||
327 | { | 325 | { |
328 | struct sdhci_host *host = platform_get_drvdata(pdev); | 326 | struct sdhci_host *host = platform_get_drvdata(pdev); |
329 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | 327 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
330 | struct sdhci_tegra *tegra_host = pltfm_host->priv; | ||
331 | int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); | 328 | int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); |
332 | 329 | ||
333 | sdhci_remove_host(host, dead); | 330 | sdhci_remove_host(host, dead); |
334 | 331 | ||
335 | if (gpio_is_valid(tegra_host->power_gpio)) | ||
336 | gpio_free(tegra_host->power_gpio); | ||
337 | |||
338 | clk_disable_unprepare(pltfm_host->clk); | 332 | clk_disable_unprepare(pltfm_host->clk); |
339 | clk_put(pltfm_host->clk); | ||
340 | 333 | ||
341 | sdhci_pltfm_free(pdev); | 334 | sdhci_pltfm_free(pdev); |
342 | 335 | ||