public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] [MTD] [NAND] nandsim: suppress unnecessary warning
@ 2008-11-12 14:06 Adrian Hunter
  2008-11-13 12:27 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Hunter @ 2008-11-12 14:06 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

nand_base sometimes reads only 2 bytes of a 4 byte id.
It is OK.  Do not print a warning in that case.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
 drivers/mtd/nand/nandsim.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 1045de9..baa6f95 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -1973,13 +1973,17 @@ static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
 
 		/* Check if chip is expecting command */
 		if (NS_STATE(ns->nxstate) != STATE_UNKNOWN && !(ns->nxstate & STATE_CMD_MASK)) {
-			/*
-			 * We are in situation when something else (not command)
-			 * was expected but command was input. In this case ignore
-			 * previous command(s)/state(s) and accept the last one.
-			 */
-			NS_WARN("write_byte: command (%#x) wasn't expected, expected state is %s, "
-				"ignore previous states\n", (uint)byte, get_state_name(ns->nxstate));
+			/* Do not warn if only 2 id bytes are read */
+			if (!(ns->regs.command == NAND_CMD_READID &&
+			    NS_STATE(ns->state) == STATE_DATAOUT_ID && ns->regs.count == 2)) {
+				/*
+				 * We are in situation when something else (not command)
+				 * was expected but command was input. In this case ignore
+				 * previous command(s)/state(s) and accept the last one.
+				 */
+				NS_WARN("write_byte: command (%#x) wasn't expected, expected state is %s, "
+					"ignore previous states\n", (uint)byte, get_state_name(ns->nxstate));
+			}
 			switch_to_ready_state(ns, NS_STATUS_FAILED(ns));
 		}
 
-- 
1.5.4.3

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

* Re: [PATCH] [MTD] [NAND] nandsim: suppress unnecessary warning
  2008-11-12 14:06 [PATCH] [MTD] [NAND] nandsim: suppress unnecessary warning Adrian Hunter
@ 2008-11-13 12:27 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-11-13 12:27 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mtd@lists.infradead.org

On Wed, 2008-11-12 at 16:06 +0200, Adrian Hunter wrote:
> nand_base sometimes reads only 2 bytes of a 4 byte id.
> It is OK.  Do not print a warning in that case.
> 
> Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>

Acked-by: Artem Bityutskiy <dedekind@infradead.org>

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

end of thread, other threads:[~2008-11-13 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 14:06 [PATCH] [MTD] [NAND] nandsim: suppress unnecessary warning Adrian Hunter
2008-11-13 12:27 ` Artem Bityutskiy

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