Skip to contentSkip to conversation

solve deadlock problem in atmel-mci (kernel 3.2)

PATCH New Steffen Kühn 1 participant 1 message May 7, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 solve deadlock problem in atmel-mci (kernel 3.2)

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

drivers/mmc/host/atmel-mci.c +3 -1
index 94c377d..407648f 100644
@@ -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;