diff options
| author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-07-14 12:39:10 -0400 |
|---|---|---|
| committer | Chris Ball <cjb@laptop.org> | 2011-07-21 10:35:07 -0400 |
| commit | 162f43e31c5a376ec16336e5d0ac973373d54c89 (patch) | |
| tree | 366ce758f78683291ca7db913276611ffaca00fb | |
| parent | 332bdb506f800d177f6657247347a253dd5b5be8 (diff) | |
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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
| -rw-r--r-- | drivers/mmc/host/tmio_mmc.h | 5 | ||||
| -rw-r--r-- | drivers/mmc/host/tmio_mmc_dma.c | 5 | ||||
| -rw-r--r-- | drivers/mmc/host/tmio_mmc_pio.c | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index ba0d8e66001d..087d88023ba1 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h | |||
| @@ -109,6 +109,7 @@ static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg, | |||
| 109 | 109 | ||
| 110 | #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) | 110 | #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) |
| 111 | void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data); | 111 | void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data); |
| 112 | void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable); | ||
| 112 | void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata); | 113 | void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata); |
| 113 | void tmio_mmc_release_dma(struct tmio_mmc_host *host); | 114 | void tmio_mmc_release_dma(struct tmio_mmc_host *host); |
| 114 | #else | 115 | #else |
| @@ -117,6 +118,10 @@ static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host, | |||
| 117 | { | 118 | { |
| 118 | } | 119 | } |
| 119 | 120 | ||
| 121 | static inline void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable) | ||
| 122 | { | ||
| 123 | } | ||
| 124 | |||
| 120 | static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host, | 125 | static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host, |
| 121 | struct tmio_mmc_data *pdata) | 126 | struct tmio_mmc_data *pdata) |
| 122 | { | 127 | { |
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index 7e86662717d6..2aa616dec32d 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c | |||
| @@ -22,8 +22,11 @@ | |||
| 22 | 22 | ||
| 23 | #define TMIO_MMC_MIN_DMA_LEN 8 | 23 | #define TMIO_MMC_MIN_DMA_LEN 8 |
| 24 | 24 | ||
| 25 | static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable) | 25 | void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable) |
| 26 | { | 26 | { |
| 27 | if (!host->chan_tx || !host->chan_rx) | ||
| 28 | return; | ||
| 29 | |||
| 27 | #if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE) | 30 | #if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE) |
| 28 | /* Switch DMA mode on or off - SuperH specific? */ | 31 | /* Switch DMA mode on or off - SuperH specific? */ |
| 29 | sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0); | 32 | sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0); |
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index 221ffb71c7a3..1f16357e7301 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c | |||
| @@ -984,7 +984,7 @@ int tmio_mmc_host_resume(struct device *dev) | |||
| 984 | if (host->pm_global) { | 984 | if (host->pm_global) { |
| 985 | /* Runtime PM resume callback didn't run */ | 985 | /* Runtime PM resume callback didn't run */ |
| 986 | tmio_mmc_reset(host); | 986 | tmio_mmc_reset(host); |
| 987 | tmio_mmc_request_dma(host, host->pdata); | 987 | tmio_mmc_enable_dma(host, true); |
| 988 | host->pm_global = false; | 988 | host->pm_global = false; |
| 989 | } | 989 | } |
| 990 | 990 | ||
| @@ -1007,7 +1007,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev) | |||
| 1007 | struct tmio_mmc_data *pdata = host->pdata; | 1007 | struct tmio_mmc_data *pdata = host->pdata; |
| 1008 | 1008 | ||
| 1009 | tmio_mmc_reset(host); | 1009 | tmio_mmc_reset(host); |
| 1010 | tmio_mmc_request_dma(host, host->pdata); | 1010 | tmio_mmc_enable_dma(host, true); |
| 1011 | 1011 | ||
| 1012 | if (pdata->power) { | 1012 | if (pdata->power) { |
| 1013 | /* Only entered after a card-insert interrupt */ | 1013 | /* Only entered after a card-insert interrupt */ |
