mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* MMC/SD: Write operation in invalid states by borken cards.
@ 2007-11-08  8:24 Roopesh
  2007-11-10 10:51 ` Pierre Ossman
  0 siblings, 1 reply; 3+ messages in thread
From: Roopesh @ 2007-11-08  8:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pierre Ossman

 Hi, 

 If a write operation fails, shouldnt we still check for the card 
 state to be 'ready to accept next data'?

 This question is because I have noticed that some (broken) cards 
 fail the write command, and the immediately issued subsequent 
 commands also fail since the card state was never checked before 
 sending these commands.
 (There was a discussion about these cards at the thread: "MMC: 
 CRC Errors with 2GB cards)

diff -a -u -p -r1.2 block.c
--- drivers/mmc/card/block.c	22 Oct 2007 10:39:44 -0000	1.2
+++ drivers/mmc/card/block.c	8 Nov 2007 06:55:37 -0000
@@ -206,6 +206,7 @@ static int mmc_blk_issue_rq(struct mmc_q
 	struct mmc_card *card = md->queue.card;
 	struct mmc_blk_request brq;
 	int ret = 1, sg_pos, data_size;
+	int data_error = 0;
 
 	mmc_claim_host(card->host);
 
@@ -282,19 +283,19 @@ static int mmc_blk_issue_rq(struct mmc_q
 		if (brq.cmd.error) {
 			printk(KERN_ERR "%s: error %d sending read/write command\n",
 			       req->rq_disk->disk_name, brq.cmd.error);
-			goto cmd_err;
+			data_error = 1;
 		}
 
 		if (brq.data.error) {
 			printk(KERN_ERR "%s: error %d transferring data\n",
 			       req->rq_disk->disk_name, brq.data.error);
-			goto cmd_err;
+			data_error = 1;
 		}
 
 		if (brq.stop.error) {
 			printk(KERN_ERR "%s: error %d sending stop command\n",
 			       req->rq_disk->disk_name, brq.stop.error);
-			goto cmd_err;
+			data_error = 1;
 		}
 
 		if (rq_data_dir(req) != READ) {
@@ -320,6 +321,9 @@ static int mmc_blk_issue_rq(struct mmc_q
 				goto cmd_err;
 #endif
 		}
+
+		if (data_error == 1)
+			goto cmd_err;
 
 		/*
 		 * A block was successfully transferred.
 

 Thanks,
 Roopesh.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MMC/SD: Write operation in invalid states by borken cards.
  2007-11-08  8:24 MMC/SD: Write operation in invalid states by borken cards Roopesh
@ 2007-11-10 10:51 ` Pierre Ossman
  2007-11-23 10:27   ` Roopesh
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre Ossman @ 2007-11-10 10:51 UTC (permalink / raw)
  To: Roopesh; +Cc: linux-kernel

On Thu, 8 Nov 2007 03:24:10 -0500
Roopesh <roopesh@cyberspace.org> wrote:

>  Hi, 
> 
>  If a write operation fails, shouldnt we still check for the card 
>  state to be 'ready to accept next data'?
> 
>  This question is because I have noticed that some (broken) cards 
>  fail the write command, and the immediately issued subsequent 
>  commands also fail since the card state was never checked before 
>  sending these commands.
>  (There was a discussion about these cards at the thread: "MMC: 
>  CRC Errors with 2GB cards)
> 

I'm confused. Didn't the previous fix solve your problems?

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MMC/SD: Write operation in invalid states by borken cards.
  2007-11-10 10:51 ` Pierre Ossman
@ 2007-11-23 10:27   ` Roopesh
  0 siblings, 0 replies; 3+ messages in thread
From: Roopesh @ 2007-11-23 10:27 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: Roopesh, linux-kernel

:---------- Original Message ----------
:
:From:  Pierre Ossman [drzeus-list@drzeus.cx]
:To  :  To Roopesh
:Sub :  Re: MMC/SD: Write operation in invalid states by borken cards.
:Sent:  Sat, Nov 10, 2007 at 05:51:19AM EST

:     On Thu, 8 Nov 2007 03:24:10 -0500
:     Roopesh <roopesh@cyberspace.org> wrote:
:     
:     >  Hi, 
:     > 
:     >  If a write operation fails, shouldnt we still check for the card 
:     >  state to be 'ready to accept next data'?
:     > 
:     >  This question is because I have noticed that some (broken) cards 
:     >  fail the write command, and the immediately issued subsequent 
:     >  commands also fail since the card state was never checked before 
:     >  sending these commands.
:     >  (There was a discussion about these cards at the thread: "MMC: 
:     >  CRC Errors with 2GB cards)
:     > 
:     
:     I'm confused. Didn't the previous fix solve your problems?

 I am sorry I couldnt respond in time, and also for creating the 
 confusion.  The previous fix did solve my problem.  However, if 
 for some other reason the card goes into an invalid state and a  
 write command fails, shouldnt we still check for the card state 
 before sending the next IO command?

:     Rgds
:     -- 
:          -- Pierre Ossman
:     
:       Linux kernel, MMC maintainer        http://www.kernel.org
:       PulseAudio, core developer          http://pulseaudio.org
:       rdesktop, core developer          http://www.rdesktop.org


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-23 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08  8:24 MMC/SD: Write operation in invalid states by borken cards Roopesh
2007-11-10 10:51 ` Pierre Ossman
2007-11-23 10:27   ` Roopesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®