提交 162f43e3 编写于 作者: G Guennadi Liakhovetski 提交者: Chris Ball

mmc: tmio: fix a deadlock

Currently the tmio-mmc driver contains a recursive runtime PM method
invocation, which leads to a deadlock on a mutex. Avoid it by taking
care not to request DMA too early.
Signed-off-by: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: NChris Ball <cjb@laptop.org>
上级 332bdb50
...@@ -109,6 +109,7 @@ static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg, ...@@ -109,6 +109,7 @@ static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg,
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data); void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data);
void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable);
void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata); void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata);
void tmio_mmc_release_dma(struct tmio_mmc_host *host); void tmio_mmc_release_dma(struct tmio_mmc_host *host);
#else #else
...@@ -117,6 +118,10 @@ static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host, ...@@ -117,6 +118,10 @@ static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host,
{ {
} }
static inline void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
{
}
static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host, static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host,
struct tmio_mmc_data *pdata) struct tmio_mmc_data *pdata)
{ {
......
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
#define TMIO_MMC_MIN_DMA_LEN 8 #define TMIO_MMC_MIN_DMA_LEN 8
static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable) void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
{ {
if (!host->chan_tx || !host->chan_rx)
return;
#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE) #if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)
/* Switch DMA mode on or off - SuperH specific? */ /* Switch DMA mode on or off - SuperH specific? */
sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0); sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
......
...@@ -984,7 +984,7 @@ int tmio_mmc_host_resume(struct device *dev) ...@@ -984,7 +984,7 @@ int tmio_mmc_host_resume(struct device *dev)
if (host->pm_global) { if (host->pm_global) {
/* Runtime PM resume callback didn't run */ /* Runtime PM resume callback didn't run */
tmio_mmc_reset(host); tmio_mmc_reset(host);
tmio_mmc_request_dma(host, host->pdata); tmio_mmc_enable_dma(host, true);
host->pm_global = false; host->pm_global = false;
} }
...@@ -1007,7 +1007,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev) ...@@ -1007,7 +1007,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
struct tmio_mmc_data *pdata = host->pdata; struct tmio_mmc_data *pdata = host->pdata;
tmio_mmc_reset(host); tmio_mmc_reset(host);
tmio_mmc_request_dma(host, host->pdata); tmio_mmc_enable_dma(host, true);
if (pdata->power) { if (pdata->power) {
/* Only entered after a card-insert interrupt */ /* Only entered after a card-insert interrupt */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册