diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-03 12:24:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-03 12:24:44 -0400 |
commit | 9a6cd4b45a1372b04bb4c3307f1ce79a0a2e2fa9 (patch) | |
tree | d4672f9b0388ab49f8e279e9fd69b682549e002c /drivers | |
parent | bab0dcc717e28f76f10337a26ed5a14adcd786ce (diff) | |
parent | 0c9c99a765321104cc5f9c97f949382a9ba4927e (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc:
mmc: sdhci: Check mrq != NULL in sdhci_tasklet_finish
mmc: sdhci: Check mrq->cmd in sdhci_tasklet_finish
mmc: tmio: fix .set_ios(MMC_POWER_UP) handling
mmc: fix a race between card-detect rescan and clock-gate work instances
mmc: omap: Fix possible NULL pointer deref
mmc: core: mmc_add_card(): fix missing break in switch statement
mmc: sdhci-pci: Fix error case in sdhci_pci_probe_slot()
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/core/bus.c | 1 | ||||
-rw-r--r-- | drivers/mmc/core/host.c | 9 | ||||
-rw-r--r-- | drivers/mmc/host/omap.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-pci.c | 1 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.c | 9 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc_pio.c | 10 |
6 files changed, 20 insertions, 12 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 63667a8f140..d6d62fd07ee 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -284,6 +284,7 @@ int mmc_add_card(struct mmc_card *card) | |||
284 | type = "SD-combo"; | 284 | type = "SD-combo"; |
285 | if (mmc_card_blockaddr(card)) | 285 | if (mmc_card_blockaddr(card)) |
286 | type = "SDHC-combo"; | 286 | type = "SDHC-combo"; |
287 | break; | ||
287 | default: | 288 | default: |
288 | type = "?"; | 289 | type = "?"; |
289 | break; | 290 | break; |
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 461e6a17fb9..2b200c1cfbb 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -94,7 +94,7 @@ static void mmc_host_clk_gate_delayed(struct mmc_host *host) | |||
94 | spin_unlock_irqrestore(&host->clk_lock, flags); | 94 | spin_unlock_irqrestore(&host->clk_lock, flags); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | mutex_lock(&host->clk_gate_mutex); | 97 | mmc_claim_host(host); |
98 | spin_lock_irqsave(&host->clk_lock, flags); | 98 | spin_lock_irqsave(&host->clk_lock, flags); |
99 | if (!host->clk_requests) { | 99 | if (!host->clk_requests) { |
100 | spin_unlock_irqrestore(&host->clk_lock, flags); | 100 | spin_unlock_irqrestore(&host->clk_lock, flags); |
@@ -104,7 +104,7 @@ static void mmc_host_clk_gate_delayed(struct mmc_host *host) | |||
104 | pr_debug("%s: gated MCI clock\n", mmc_hostname(host)); | 104 | pr_debug("%s: gated MCI clock\n", mmc_hostname(host)); |
105 | } | 105 | } |
106 | spin_unlock_irqrestore(&host->clk_lock, flags); | 106 | spin_unlock_irqrestore(&host->clk_lock, flags); |
107 | mutex_unlock(&host->clk_gate_mutex); | 107 | mmc_release_host(host); |
108 | } | 108 | } |
109 | 109 | ||
110 | /* | 110 | /* |
@@ -130,7 +130,7 @@ void mmc_host_clk_ungate(struct mmc_host *host) | |||
130 | { | 130 | { |
131 | unsigned long flags; | 131 | unsigned long flags; |
132 | 132 | ||
133 | mutex_lock(&host->clk_gate_mutex); | 133 | mmc_claim_host(host); |
134 | spin_lock_irqsave(&host->clk_lock, flags); | 134 | spin_lock_irqsave(&host->clk_lock, flags); |
135 | if (host->clk_gated) { | 135 | if (host->clk_gated) { |
136 | spin_unlock_irqrestore(&host->clk_lock, flags); | 136 | spin_unlock_irqrestore(&host->clk_lock, flags); |
@@ -140,7 +140,7 @@ void mmc_host_clk_ungate(struct mmc_host *host) | |||
140 | } | 140 | } |
141 | host->clk_requests++; | 141 | host->clk_requests++; |
142 | spin_unlock_irqrestore(&host->clk_lock, flags); | 142 | spin_unlock_irqrestore(&host->clk_lock, flags); |
143 | mutex_unlock(&host->clk_gate_mutex); | 143 | mmc_release_host(host); |
144 | } | 144 | } |
145 | 145 | ||
146 | /** | 146 | /** |
@@ -215,7 +215,6 @@ static inline void mmc_host_clk_init(struct mmc_host *host) | |||
215 | host->clk_gated = false; | 215 | host->clk_gated = false; |
216 | INIT_WORK(&host->clk_gate_work, mmc_host_clk_gate_work); | 216 | INIT_WORK(&host->clk_gate_work, mmc_host_clk_gate_work); |
217 | spin_lock_init(&host->clk_lock); | 217 | spin_lock_init(&host->clk_lock); |
218 | mutex_init(&host->clk_gate_mutex); | ||
219 | } | 218 | } |
220 | 219 | ||
221 | /** | 220 | /** |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 2e032f0e8cf..a6c32904014 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -832,7 +832,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
832 | return IRQ_HANDLED; | 832 | return IRQ_HANDLED; |
833 | } | 833 | } |
834 | 834 | ||
835 | if (end_command) | 835 | if (end_command && host->cmd) |
836 | mmc_omap_cmd_done(host, host->cmd); | 836 | mmc_omap_cmd_done(host, host->cmd); |
837 | if (host->data != NULL) { | 837 | if (host->data != NULL) { |
838 | if (transfer_error) | 838 | if (transfer_error) |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index a136be70634..f8b5f37007b 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
@@ -957,6 +957,7 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( | |||
957 | host->ioaddr = pci_ioremap_bar(pdev, bar); | 957 | host->ioaddr = pci_ioremap_bar(pdev, bar); |
958 | if (!host->ioaddr) { | 958 | if (!host->ioaddr) { |
959 | dev_err(&pdev->dev, "failed to remap registers\n"); | 959 | dev_err(&pdev->dev, "failed to remap registers\n"); |
960 | ret = -ENOMEM; | ||
960 | goto release; | 961 | goto release; |
961 | } | 962 | } |
962 | 963 | ||
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9e15f41f87b..5d20661bc35 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1334,6 +1334,13 @@ static void sdhci_tasklet_finish(unsigned long param) | |||
1334 | 1334 | ||
1335 | host = (struct sdhci_host*)param; | 1335 | host = (struct sdhci_host*)param; |
1336 | 1336 | ||
1337 | /* | ||
1338 | * If this tasklet gets rescheduled while running, it will | ||
1339 | * be run again afterwards but without any active request. | ||
1340 | */ | ||
1341 | if (!host->mrq) | ||
1342 | return; | ||
1343 | |||
1337 | spin_lock_irqsave(&host->lock, flags); | 1344 | spin_lock_irqsave(&host->lock, flags); |
1338 | 1345 | ||
1339 | del_timer(&host->timer); | 1346 | del_timer(&host->timer); |
@@ -1345,7 +1352,7 @@ static void sdhci_tasklet_finish(unsigned long param) | |||
1345 | * upon error conditions. | 1352 | * upon error conditions. |
1346 | */ | 1353 | */ |
1347 | if (!(host->flags & SDHCI_DEVICE_DEAD) && | 1354 | if (!(host->flags & SDHCI_DEVICE_DEAD) && |
1348 | (mrq->cmd->error || | 1355 | ((mrq->cmd && mrq->cmd->error) || |
1349 | (mrq->data && (mrq->data->error || | 1356 | (mrq->data && (mrq->data->error || |
1350 | (mrq->data->stop && mrq->data->stop->error))) || | 1357 | (mrq->data->stop && mrq->data->stop->error))) || |
1351 | (host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) { | 1358 | (host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) { |
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index 62d37de6de7..710339a85c8 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c | |||
@@ -728,15 +728,15 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
728 | tmio_mmc_set_clock(host, ios->clock); | 728 | tmio_mmc_set_clock(host, ios->clock); |
729 | 729 | ||
730 | /* Power sequence - OFF -> UP -> ON */ | 730 | /* Power sequence - OFF -> UP -> ON */ |
731 | if (ios->power_mode == MMC_POWER_OFF || !ios->clock) { | 731 | if (ios->power_mode == MMC_POWER_UP) { |
732 | /* power up SD bus */ | ||
733 | if (host->set_pwr) | ||
734 | host->set_pwr(host->pdev, 1); | ||
735 | } else if (ios->power_mode == MMC_POWER_OFF || !ios->clock) { | ||
732 | /* power down SD bus */ | 736 | /* power down SD bus */ |
733 | if (ios->power_mode == MMC_POWER_OFF && host->set_pwr) | 737 | if (ios->power_mode == MMC_POWER_OFF && host->set_pwr) |
734 | host->set_pwr(host->pdev, 0); | 738 | host->set_pwr(host->pdev, 0); |
735 | tmio_mmc_clk_stop(host); | 739 | tmio_mmc_clk_stop(host); |
736 | } else if (ios->power_mode == MMC_POWER_UP) { | ||
737 | /* power up SD bus */ | ||
738 | if (host->set_pwr) | ||
739 | host->set_pwr(host->pdev, 1); | ||
740 | } else { | 740 | } else { |
741 | /* start bus clock */ | 741 | /* start bus clock */ |
742 | tmio_mmc_clk_start(host); | 742 | tmio_mmc_clk_start(host); |