[PATCH] solve deadlock problem in atmel-mci (kernel 3.2)
From: Steffen Kühn
Date: Mon May 07 2012 - 07:27:01 EST
Dear Nicolas,
the appended patch solves a deadlock problem which appears when a SD
card is removing and a process is reading from the card at the same
time. The problem occurs not always but only when there are
error-messages like 'end_request: I/O error, dev mmcblk0, sector XXX'
(probably a timing thing).
When the error occurs, the autodetection for SD card insertion does not
work anymore and unloading of the driver with 'rmmod' is no longer possible.
The patch seems to work very well with our hardware. But I have to say,
that I have not understand the mechanisms in the driver entirely. Please
check, if the patch make sense.
Best regards,
Steffen
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 94c377d..407648f 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1480,8 +1480,10 @@ static void atmci_tasklet_func(unsigned long priv)
}
if (!atmci_test_and_clear_pending(host,
- EVENT_XFER_COMPLETE))
+ EVENT_XFER_COMPLETE)) {
+ host->stop_transfer(host);
break;
+ }
atmci_set_completed(host, EVENT_XFER_COMPLETE);
prev_state = state = STATE_DATA_BUSY;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/