Skip to content

Commit 2b1ac5c

Browse files
lyakhcjb
authored andcommitted
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>
1 parent c9b0546 commit 2b1ac5c

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎drivers/mmc/host/tmio_mmc.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ struct tmio_mmc_host {
8686
spinlock_t lock; /* protect host private data */
8787
unsigned long last_req_ts;
8888
struct mutex ios_lock; /* protect set_ios() context */
89+
bool native_hotplug;
8990
};
9091

9192
int tmio_mmc_host_probe(struct tmio_mmc_host **host,

‎drivers/mmc/host/tmio_mmc_pio.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,10 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host,
916916
else
917917
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
918918

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+
919923
pdata->power = false;
920924
pm_runtime_enable(&pdev->dev);
921925
ret = pm_runtime_resume(&pdev->dev);
@@ -934,9 +938,7 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host,
934938
* additionally ensure that in case 2) the tmio mmc hardware stays
935939
* powered on during runtime for the card detection to work.
936940
*/
937-
if (!(pdata->flags & TMIO_MMC_HAS_COLD_CD
938-
|| mmc->caps & MMC_CAP_NEEDS_POLL
939-
|| mmc->caps & MMC_CAP_NONREMOVABLE))
941+
if (_host->native_hotplug)
940942
pm_runtime_get_noresume(&pdev->dev);
941943

942944
tmio_mmc_clk_stop(_host);
@@ -996,9 +998,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
996998
* the controller, the runtime PM is suspended and pdata->power == false,
997999
* so, our .runtime_resume() will not try to detect a card in the slot.
9981000
*/
999-
if (host->pdata->flags & TMIO_MMC_HAS_COLD_CD
1000-
|| host->mmc->caps & MMC_CAP_NEEDS_POLL
1001-
|| host->mmc->caps & MMC_CAP_NONREMOVABLE)
1001+
if (!host->native_hotplug)
10021002
pm_runtime_get_sync(&pdev->dev);
10031003

10041004
dev_pm_qos_hide_latency_limit(&pdev->dev);

0 commit comments

Comments
 (0)