提交 2b1ac5c2 编写于 作者: G Guennadi Liakhovetski 提交者: Chris Ball

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: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: NChris Ball <cjb@laptop.org>
上级 c9b0546a
...@@ -86,6 +86,7 @@ struct tmio_mmc_host { ...@@ -86,6 +86,7 @@ struct tmio_mmc_host {
spinlock_t lock; /* protect host private data */ spinlock_t lock; /* protect host private data */
unsigned long last_req_ts; unsigned long last_req_ts;
struct mutex ios_lock; /* protect set_ios() context */ struct mutex ios_lock; /* protect set_ios() context */
bool native_hotplug;
}; };
int tmio_mmc_host_probe(struct tmio_mmc_host **host, int tmio_mmc_host_probe(struct tmio_mmc_host **host,
......
...@@ -916,6 +916,10 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host, ...@@ -916,6 +916,10 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host,
else else
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
_host->native_hotplug = !(pdata->flags & TMIO_MMC_HAS_COLD_CD ||
mmc->caps & MMC_CAP_NEEDS_POLL ||
mmc->caps & MMC_CAP_NONREMOVABLE);
pdata->power = false; pdata->power = false;
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = pm_runtime_resume(&pdev->dev); ret = pm_runtime_resume(&pdev->dev);
...@@ -934,9 +938,7 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host, ...@@ -934,9 +938,7 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host,
* additionally ensure that in case 2) the tmio mmc hardware stays * additionally ensure that in case 2) the tmio mmc hardware stays
* powered on during runtime for the card detection to work. * powered on during runtime for the card detection to work.
*/ */
if (!(pdata->flags & TMIO_MMC_HAS_COLD_CD if (_host->native_hotplug)
|| mmc->caps & MMC_CAP_NEEDS_POLL
|| mmc->caps & MMC_CAP_NONREMOVABLE))
pm_runtime_get_noresume(&pdev->dev); pm_runtime_get_noresume(&pdev->dev);
tmio_mmc_clk_stop(_host); tmio_mmc_clk_stop(_host);
...@@ -996,9 +998,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host) ...@@ -996,9 +998,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
* the controller, the runtime PM is suspended and pdata->power == false, * the controller, the runtime PM is suspended and pdata->power == false,
* so, our .runtime_resume() will not try to detect a card in the slot. * so, our .runtime_resume() will not try to detect a card in the slot.
*/ */
if (host->pdata->flags & TMIO_MMC_HAS_COLD_CD if (!host->native_hotplug)
|| host->mmc->caps & MMC_CAP_NEEDS_POLL
|| host->mmc->caps & MMC_CAP_NONREMOVABLE)
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
dev_pm_qos_hide_latency_limit(&pdev->dev); dev_pm_qos_hide_latency_limit(&pdev->dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册