public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Savin Zlobec <savin@epico.si>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] NAND
Date: Wed, 21 Jun 2006 11:15:23 +0200	[thread overview]
Message-ID: <44990E2B.1030009@epico.si> (raw)

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

Hi,

this patch fixes nand status handling in nand_write_oob_std and
nand busy wait in nand_do_read_oob.

savin

[-- Attachment #2: nand_base.diff --]
[-- Type: text/x-patch, Size: 1212 bytes --]

--- drivers/mtd/nand/nand_base.c.orig	2006-06-21 10:48:00.000000000 +0200
+++ drivers/mtd/nand/nand_base.c	2006-06-21 11:10:38.000000000 +0200
@@ -1174,11 +1174,11 @@
 	/* Send command to program the OOB data */
 	chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
 
 	status = chip->waitfunc(mtd, chip);
 
-	return status;
+	return status & NAND_STATUS_FAIL ? -EIO : 0;
 }
 
 /**
  * nand_write_oob_syndrome - [REPLACABLE] OOB data write function for HW ECC
  *			     with syndrome - only for large page flash !
@@ -1269,14 +1269,10 @@
 
 	while(1) {
 		sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
 		buf = nand_transfer_oob(chip, buf, ops);
 
-		readlen -= ops->ooblen;
-		if (!readlen)
-			break;
-
 		if (!(chip->options & NAND_NO_READRDY)) {
 			/*
 			 * Apply delay or wait for ready/busy pin. Do this
 			 * before the AUTOINCR check, so no problems arise if a
 			 * chip which does auto increment is marked as
@@ -1286,10 +1282,14 @@
 				udelay(chip->chip_delay);
 			else
 				nand_wait_ready(mtd);
 		}
 
+		readlen -= ops->ooblen;
+		if (!readlen)
+			break;
+
 		/* Increment page address */
 		realpage++;
 
 		page = realpage & chip->pagemask;
 		/* Check, if we cross a chip boundary */

                 reply	other threads:[~2006-06-21  9:06 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=44990E2B.1030009@epico.si \
    --to=savin@epico.si \
    --cc=linux-mtd@lists.infradead.org \
    /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