From cb5acfbe936c5e63058f4355ed502fac2d29e65f Mon Sep 17 00:00:00 2001 From: Naveen Kumar Arepalli Date: Mon, 13 May 2013 09:51:40 +0530 Subject: [PATCH] mmc: tegra: Register carddetect_irq after add host Register carddetect_irq handler after sdhci_add_host as carddetect tasklet is initialised in sdhci_add_host function. Bug 1263268 Change-Id: Id2cf9b9ce86303de0d08ce611f6cec273bf0f3b0 Signed-off-by: Naveen Kumar Arepalli Reviewed-on: http://git-master/r/227789 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/mmc/host/sdhci-tegra.c | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 8efe1dba23f..084682da3a9 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -2238,21 +2238,6 @@ static int sdhci_tegra_probe(struct platform_device *pdev) tegra_host->card_present = (gpio_get_value_cansleep(plat->cd_gpio) == 0); - rc = request_threaded_irq(gpio_to_irq(plat->cd_gpio), NULL, - carddetect_irq, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT, - mmc_hostname(host->mmc), host); - - if (rc) { - dev_err(mmc_dev(host->mmc), "request irq error\n"); - goto err_cd_irq_req; - } - rc = enable_irq_wake(gpio_to_irq(plat->cd_gpio)); - if (rc < 0) - dev_err(mmc_dev(host->mmc), - "SD card wake-up event registration" - "failed with eroor: %d\n", rc); - } else if (plat->mmc_data.register_status_notify) { plat->mmc_data.register_status_notify(sdhci_status_notify_cb, host); } @@ -2415,11 +2400,26 @@ static int sdhci_tegra_probe(struct platform_device *pdev) host->edp_states[rc] = plat->edp_states[rc]; rc = sdhci_add_host(host); - - sdhci_tegra_error_stats_debugfs(host); if (rc) goto err_add_host; + if (gpio_is_valid(plat->cd_gpio)) { + rc = request_threaded_irq(gpio_to_irq(plat->cd_gpio), NULL, + carddetect_irq, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT, + mmc_hostname(host->mmc), host); + if (rc) { + dev_err(mmc_dev(host->mmc), "request irq error\n"); + goto err_cd_irq_req; + } + rc = enable_irq_wake(gpio_to_irq(plat->cd_gpio)); + if (rc < 0) + dev_err(mmc_dev(host->mmc), + "SD card wake-up event registration" + "failed with error: %d\n", rc); + } + sdhci_tegra_error_stats_debugfs(host); + /* Enable async suspend/resume to reduce LP0 latency */ device_enable_async_suspend(&pdev->dev); @@ -2430,6 +2430,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) } return 0; +err_cd_irq_req: + if (gpio_is_valid(plat->cd_gpio)) + gpio_free(plat->cd_gpio); err_add_host: clk_put(tegra_host->emc_clk); clk_disable_unprepare(pltfm_host->clk); @@ -2442,9 +2445,6 @@ err_clk_get: err_wp_req: if (gpio_is_valid(plat->cd_gpio)) free_irq(gpio_to_irq(plat->cd_gpio), host); -err_cd_irq_req: - if (gpio_is_valid(plat->cd_gpio)) - gpio_free(plat->cd_gpio); err_cd_req: if (gpio_is_valid(plat->power_gpio)) gpio_free(plat->power_gpio); -- 2.39.2