All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Angus Clark <angus.clark@st.com>,
	Mike Dunn <mikedunn@newsguy.com>,
	Artem Bityutskiy <dedekind1@gmail.com>,
	Huang Shijie <b32955@freescale.com>,
	Shmulik Ladkani <shmulik.ladkani@gmail.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: [PATCH 2/9] mtd: nand: remove redundant ID read
Date: Mon, 24 Sep 2012 20:40:48 -0700	[thread overview]
Message-ID: <1348544455-17656-3-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1348544455-17656-1-git-send-email-computersforpeace@gmail.com>

Instead of reading 2 bytes then later 8 bytes, we can simply read all 8
bytes from the start.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/nand/nand_base.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 30588eb..f725247 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2898,7 +2898,8 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 
 	chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
 
-	for (i = 0; i < 2; i++)
+	/* Read entire ID string */
+	for (i = 0; i < 8; i++)
 		id_data[i] = chip->read_byte(mtd);
 
 	if (id_data[0] != *maf_id || id_data[1] != *dev_id) {
@@ -2922,13 +2923,6 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 			goto ident_done;
 	}
 
-	chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
-
-	/* Read entire ID string */
-
-	for (i = 0; i < 8; i++)
-		id_data[i] = chip->read_byte(mtd);
-
 	if (!type->name)
 		return ERR_PTR(-ENODEV);
 
-- 
1.7.11.3

  parent reply	other threads:[~2012-09-25  3:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25  3:40 [PATCH 0/9] mtd: nand: improve NAND ID detection Brian Norris
2012-09-25  3:40 ` [PATCH 1/9] mtd: nand: remove unnecessary variable Brian Norris
2012-09-25  3:40 ` Brian Norris [this message]
2012-09-25  3:40 ` [PATCH 3/9] mtd: nand: split BB marker options decoding into its own function Brian Norris
2012-09-25  3:40 ` [PATCH 4/9] mtd: nand: split extended ID " Brian Norris
2012-09-25  3:40 ` [PATCH 5/9] mtd: nand: split simple ID decode " Brian Norris
2012-09-25  3:40 ` [PATCH 6/9] mtd: nand: add generic READ ID length calculation functions Brian Norris
2012-09-25  3:40 ` [PATCH 7/9] mtd: nand: increase max OOB size to 640 Brian Norris
2012-09-25  3:40 ` [PATCH 8/9] mtd: nand: decode Hynix MLC, 6-byte ID length Brian Norris
2012-09-25  3:40 ` [PATCH 9/9] mtd: nand: detect Samsung K9GBG08U0A, K9GAG08U0F ID Brian Norris
2012-10-05  1:37   ` Marek Vasut
2012-10-06 20:24     ` Brian Norris
2012-10-07  3:29       ` Marek Vasut
2012-09-27 12:23 ` [PATCH 0/9] mtd: nand: improve NAND ID detection 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=1348544455-17656-3-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=angus.clark@st.com \
    --cc=b32955@freescale.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mikedunn@newsguy.com \
    --cc=shmulik.ladkani@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.