linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bastian Hecht <hechtb@googlemail.com>
To: linux-mtd@lists.infradead.org
Cc: Bastian Hecht <hechtb@gmail.com>, Linux-SH <linux-sh@vger.kernel.org>
Subject: [PATCH 2/2] mtd: sh_flctl: Only copy OOB data if it is required
Date: Thu, 05 Jul 2012 10:41:02 +0000	[thread overview]
Message-ID: <1341484862-24033-2-git-send-email-hechtb@gmail.com> (raw)
In-Reply-To: <1341484862-24033-1-git-send-email-hechtb@gmail.com>

Check the new oob_required flag and only copy the OOB data to the internal
buffer if needed.

Signed-off-by: Bastian Hecht <hechtb@gmail.com>
---
I did this only for reading, as for writing the current code would write random data to the non-ECC OOB area when oob_required is false, so I preferred taking the data from the nand_base layer.

 drivers/mtd/nand/sh_flctl.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index e4f31ef..0b798fb 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -398,7 +398,8 @@ static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
 				uint8_t *buf, int oob_required, int page)
 {
 	chip->read_buf(mtd, buf, mtd->writesize);
-	chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
+	if (oob_required)
+		chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
 	return 0;
 }
 
-- 
1.7.9.5


  reply	other threads:[~2012-07-05 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 10:41 [PATCH 1/2] mtd: sh_flctl: Use memcpy() instead of using a loop Bastian Hecht
2012-07-05 10:41 ` Bastian Hecht [this message]
2012-07-06  0:10 ` Simon Horman
2012-07-18 12:03 ` Artem Bityutskiy

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=1341484862-24033-2-git-send-email-hechtb@gmail.com \
    --to=hechtb@googlemail.com \
    --cc=hechtb@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-sh@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).