public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Steffen Kühn" <sk@ammonit.com>
To: nicolas.ferre@atmel.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] solve deadlock problem in atmel-mci (kernel 3.2)
Date: Mon, 07 May 2012 13:27:00 +0200	[thread overview]
Message-ID: <4FA7B184.7080806@ammonit.com> (raw)

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;

                 reply	other threads:[~2012-05-07 11:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FA7B184.7080806@ammonit.com \
    --to=sk@ammonit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox