@@ -261,14 +261,15 @@ static void tmio_mmc_reset_work(struct work_struct *work)
host->cmd = NULL;
host->data = NULL;
-
+ /* Ready for new calls */
+ host->mrq = NULL;
spin_unlock_irqrestore(&host->lock, flags);
tmio_mmc_reset(host, true);
- /* Ready for new calls */
- host->mrq = NULL;
+ spin_lock_irqsave(&host->lock, flags);
mmc_request_done(host->mmc, mrq);
+ spin_unlock_irqrestore(&host->lock, flags);
}
/* These are the bitmasks the tmio chip requires to implement the MMC response
@@ -812,9 +813,9 @@ static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
wmb();
host->mrq = mrq;
- spin_unlock_irqrestore(&host->lock, flags);
-
tmio_process_mrq(host, mrq);
+
+ spin_unlock_irqrestore(&host->lock, flags);
}
static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
@@ -841,8 +842,6 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
cancel_delayed_work(&host->delayed_reset_work);
- spin_unlock_irqrestore(&host->lock, flags);
-
if (mrq->cmd->error || (mrq->data && mrq->data->error)) {
tmio_mmc_ack_mmc_irqs(host, TMIO_MASK_IRQ); /* Clear all */
tmio_mmc_abort_dma(host);
@@ -855,6 +854,7 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
/* If SET_BLOCK_COUNT, continue with main command */
if (host->mrq && !mrq->cmd->error) {
tmio_process_mrq(host, mrq);
+ spin_unlock_irqrestore(&host->lock, flags);
return;
}
@@ -862,6 +862,7 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
host->fixup_request(host, mrq);
mmc_request_done(host->mmc, mrq);
+ spin_unlock_irqrestore(&host->lock, flags);
}
static void tmio_mmc_done_work(struct work_struct *work)