diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2012-02-09 16:57:08 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-03-27 12:20:15 -0400 |
commit | 2b1ac5c2caccbfd43bd616321cbbe21eb33c7879 (patch) | |
tree | 79be0a594ee1bab7a43b630231fe219b0717bb01 | |
parent | c9b0546a59293cabf54c85e1218da595af3274ff (diff) |
mmc: tmio: calculate the native hotplug condition only once
The condition, whether we have to use the native TMIO card hotplug
detection interrupt, is rather complex, it is better to only calculate it
once and store in the private data.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/host/tmio_mmc.h | 1 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc_pio.c | 12 |
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index f96c536d130a..8531d8d44fc1 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h | |||
@@ -86,6 +86,7 @@ struct tmio_mmc_host { | |||
86 | spinlock_t lock; /* protect host private data */ | 86 | spinlock_t lock; /* protect host private data */ |
87 | unsigned long last_req_ts; | 87 | unsigned long last_req_ts; |
88 | struct mutex ios_lock; /* protect set_ios() context */ | 88 | struct mutex ios_lock; /* protect set_ios() context */ |
89 | bool native_hotplug; | ||
89 | }; | 90 | }; |
90 | 91 | ||
91 | int tmio_mmc_host_probe(struct tmio_mmc_host **host, | 92 | int tmio_mmc_host_probe(struct tmio_mmc_host **host, |
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index 5444d533322c..49f7f218cee1 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c | |||
@@ -916,6 +916,10 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host, | |||
916 | else | 916 | else |
917 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 917 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
918 | 918 | ||
919 | _host->native_hotplug = !(pdata->flags & TMIO_MMC_HAS_COLD_CD || | ||
920 | mmc->caps & MMC_CAP_NEEDS_POLL || | ||
921 | mmc->caps & MMC_CAP_NONREMOVABLE); | ||
922 | |||
919 | pdata->power = false; | 923 | pdata->power = false; |
920 | pm_runtime_enable(&pdev->dev); | 924 | pm_runtime_enable(&pdev->dev); |
921 | ret = pm_runtime_resume(&pdev->dev); | 925 | ret = pm_runtime_resume(&pdev->dev); |
@@ -934,9 +938,7 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host, | |||
934 | * additionally ensure that in case 2) the tmio mmc hardware stays | 938 | * additionally ensure that in case 2) the tmio mmc hardware stays |
935 | * powered on during runtime for the card detection to work. | 939 | * powered on during runtime for the card detection to work. |
936 | */ | 940 | */ |
937 | if (!(pdata->flags & TMIO_MMC_HAS_COLD_CD | 941 | if (_host->native_hotplug) |
938 | || mmc->caps & MMC_CAP_NEEDS_POLL | ||
939 | || mmc->caps & MMC_CAP_NONREMOVABLE)) | ||
940 | pm_runtime_get_noresume(&pdev->dev); | 942 | pm_runtime_get_noresume(&pdev->dev); |
941 | 943 | ||
942 | tmio_mmc_clk_stop(_host); | 944 | tmio_mmc_clk_stop(_host); |
@@ -996,9 +998,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host) | |||
996 | * the controller, the runtime PM is suspended and pdata->power == false, | 998 | * the controller, the runtime PM is suspended and pdata->power == false, |
997 | * so, our .runtime_resume() will not try to detect a card in the slot. | 999 | * so, our .runtime_resume() will not try to detect a card in the slot. |
998 | */ | 1000 | */ |
999 | if (host->pdata->flags & TMIO_MMC_HAS_COLD_CD | 1001 | if (!host->native_hotplug) |
1000 | || host->mmc->caps & MMC_CAP_NEEDS_POLL | ||
1001 | || host->mmc->caps & MMC_CAP_NONREMOVABLE) | ||
1002 | pm_runtime_get_sync(&pdev->dev); | 1002 | pm_runtime_get_sync(&pdev->dev); |
1003 | 1003 | ||
1004 | dev_pm_qos_hide_latency_limit(&pdev->dev); | 1004 | dev_pm_qos_hide_latency_limit(&pdev->dev); |