linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Eunbong Song <eunb.song@samsung.com>
To: computersforpeace@gmail.com, dwmw2@infradead.org
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mtd: nand: make more readable panic_nand_wait_ready() and nand_wait_ready()
Date: Tue, 07 Jan 2014 23:19:56 +0000 (GMT)	[thread overview]
Message-ID: <19226555.341201389136795005.JavaMail.weblogic@epml09> (raw)


panic_nand_wait_ready() and nand_wait_ready() calls dev_ready() without checking if it exists.
This patch add check routine dev_ready() before run dev_ready()
and this makes the code more readable

Signed-off-by: Eunbong Song <eunb.song@samsung.com>
---
 drivers/mtd/nand/nand_base.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index bd39f7b..110db78 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -473,8 +473,10 @@ static void panic_nand_wait_ready(struct mtd_info *mtd, unsigned long timeo)
 
 	/* Wait for the device to get ready */
 	for (i = 0; i < timeo; i++) {
-		if (chip->dev_ready(mtd))
-			break;
+		if(chip->dev_ready){
+			if (chip->dev_ready(mtd))
+				break;
+		}
 		touch_softlockup_watchdog();
 		mdelay(1);
 	}
@@ -493,8 +495,10 @@ void nand_wait_ready(struct mtd_info *mtd)
 	led_trigger_event(nand_led_trigger, LED_FULL);
 	/* Wait until command is processed or timeout occurs */
 	do {
-		if (chip->dev_ready(mtd))
-			break;
+		if(chip->dev_ready){
+			if (chip->dev_ready(mtd))
+				break;
+		}
 		touch_softlockup_watchdog();
 	} while (time_before(jiffies, timeo));
 	led_trigger_event(nand_led_trigger, LED_OFF);
-- 
1.7.0.4

             reply	other threads:[~2014-01-07 23:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 23:19 Eunbong Song [this message]
2014-01-20 19:19 ` [PATCH] mtd: nand: make more readable panic_nand_wait_ready() and nand_wait_ready() Brian Norris

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=19226555.341201389136795005.JavaMail.weblogic@epml09 \
    --to=eunb.song@samsung.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).