All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Brian Norris" <computersforpeace@gmail.com>
To: "Artem Bityutskiy" <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org,
	Igor Grinberg <grinberg@compulab.co.il>
Subject: [PATCH 3/4] mtd: nand: replace DEBUG() with dev_dbg()
Date: Tue, 7 Jun 2011 16:01:56 -0700	[thread overview]
Message-ID: <1307487717-25402-4-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1307487717-25402-1-git-send-email-computersforpeace@gmail.com>

Start moving away from the MTD_DEBUG_LEVEL messages. The dynamic
debugging feature is a generic kernel feature that provides more
flexibility.

(See Documentation/dynamic-debug-howto.txt)

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/nand/nand_base.c |   46 +++++++++++++++++++++---------------------
 drivers/mtd/nand/nand_bbt.c  |    9 ++-----
 2 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 9a11eea..95a4e71 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -113,20 +113,20 @@ static int check_offs_len(struct mtd_info *mtd,
 
 	/* Start address must align on block boundary */
 	if (ofs & ((1 << chip->phys_erase_shift) - 1)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Unaligned address\n", __func__);
+		dev_dbg(&mtd->dev, "%s: Unaligned address\n", __func__);
 		ret = -EINVAL;
 	}
 
 	/* Length must align on block boundary */
 	if (len & ((1 << chip->phys_erase_shift) - 1)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Length not block aligned\n",
+		dev_dbg(&mtd->dev, "%s: Length not block aligned\n",
 					__func__);
 		ret = -EINVAL;
 	}
 
 	/* Do not allow past end of device */
 	if (ofs + len > mtd->size) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Past end of device\n",
+		dev_dbg(&mtd->dev, "%s: Past end of device\n",
 					__func__);
 		ret = -EINVAL;
 	}
@@ -912,7 +912,7 @@ static int __nand_unlock(struct mtd_info *mtd, loff_t ofs,
 	udelay(1000);
 	/* See if device thinks it succeeded */
 	if (status & 0x01) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Error status = 0x%08x\n",
+		dev_dbg(&mtd->dev, "%s: Error status = 0x%08x\n",
 					__func__, status);
 		ret = -EIO;
 	}
@@ -934,7 +934,7 @@ int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 	int chipnr;
 	struct nand_chip *chip = mtd->priv;
 
-	DEBUG(MTD_DEBUG_LEVEL3, "%s: start = 0x%012llx, len = %llu\n",
+	dev_dbg(&mtd->dev, "%s: start = 0x%012llx, len = %llu\n",
 			__func__, (unsigned long long)ofs, len);
 
 	if (check_offs_len(mtd, ofs, len))
@@ -953,7 +953,7 @@ int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 
 	/* Check, if it is write protected */
 	if (nand_check_wp(mtd)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Device is write protected!!!\n",
+		dev_dbg(&mtd->dev, "%s: Device is write protected!!!\n",
 					__func__);
 		ret = -EIO;
 		goto out;
@@ -987,7 +987,7 @@ int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 	int chipnr, status, page;
 	struct nand_chip *chip = mtd->priv;
 
-	DEBUG(MTD_DEBUG_LEVEL3, "%s: start = 0x%012llx, len = %llu\n",
+	dev_dbg(&mtd->dev, "%s: start = 0x%012llx, len = %llu\n",
 			__func__, (unsigned long long)ofs, len);
 
 	if (check_offs_len(mtd, ofs, len))
@@ -1002,7 +1002,7 @@ int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 
 	/* Check, if it is write protected */
 	if (nand_check_wp(mtd)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Device is write protected!!!\n",
+		dev_dbg(&mtd->dev, "%s: Device is write protected!!!\n",
 					__func__);
 		status = MTD_ERASE_FAILED;
 		ret = -EIO;
@@ -1018,7 +1018,7 @@ int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 	udelay(1000);
 	/* See if device thinks it succeeded */
 	if (status & 0x01) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Error status = 0x%08x\n",
+		dev_dbg(&mtd->dev, "%s: Error status = 0x%08x\n",
 					__func__, status);
 		ret = -EIO;
 		goto out;
@@ -1757,7 +1757,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
 	int len;
 	uint8_t *buf = ops->oobbuf;
 
-	DEBUG(MTD_DEBUG_LEVEL3, "%s: from = 0x%08Lx, len = %i\n",
+	dev_dbg(&mtd->dev, "%s: from = 0x%08Lx, len = %i\n",
 			__func__, (unsigned long long)from, readlen);
 
 	if (ops->mode == MTD_OOB_AUTO)
@@ -1766,7 +1766,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
 		len = mtd->oobsize;
 
 	if (unlikely(ops->ooboffs >= len)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read "
+		dev_dbg(&mtd->dev, "%s: Attempt to start read "
 					"outside oob\n", __func__);
 		return -EINVAL;
 	}
@@ -1775,7 +1775,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
 	if (unlikely(from >= mtd->size ||
 		     ops->ooboffs + readlen > ((mtd->size >> chip->page_shift) -
 					(from >> chip->page_shift)) * len)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt read beyond end "
+		dev_dbg(&mtd->dev, "%s: Attempt read beyond end "
 					"of device\n", __func__);
 		return -EINVAL;
 	}
@@ -1851,7 +1851,7 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
 
 	/* Do not allow reads past end of device */
 	if (ops->datbuf && (from + ops->len) > mtd->size) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt read "
+		dev_dbg(&mtd->dev, "%s: Attempt read "
 				"beyond end of device\n", __func__);
 		return -EINVAL;
 	}
@@ -2341,7 +2341,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
 	int chipnr, page, status, len;
 	struct nand_chip *chip = mtd->priv;
 
-	DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n",
+	dev_dbg(&mtd->dev, "%s: to = 0x%08x, len = %i\n",
 			 __func__, (unsigned int)to, (int)ops->ooblen);
 
 	if (ops->mode == MTD_OOB_AUTO)
@@ -2351,13 +2351,13 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
 
 	/* Do not allow write past end of page */
 	if ((ops->ooboffs + ops->ooblen) > len) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to write "
+		dev_dbg(&mtd->dev, "%s: Attempt to write "
 				"past end of page\n", __func__);
 		return -EINVAL;
 	}
 
 	if (unlikely(ops->ooboffs >= len)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start "
+		dev_dbg(&mtd->dev, "%s: Attempt to start "
 				"write outside oob\n", __func__);
 		return -EINVAL;
 	}
@@ -2367,7 +2367,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
 		     ops->ooboffs + ops->ooblen >
 			((mtd->size >> chip->page_shift) -
 			 (to >> chip->page_shift)) * len)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt write beyond "
+		dev_dbg(&mtd->dev, "%s: Attempt write beyond "
 				"end of device\n", __func__);
 		return -EINVAL;
 	}
@@ -2423,7 +2423,7 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
 
 	/* Do not allow writes past end of device */
 	if (ops->datbuf && (to + ops->len) > mtd->size) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt write beyond "
+		dev_dbg(&mtd->dev, "%s: Attempt write beyond "
 				"end of device\n", __func__);
 		return -EINVAL;
 	}
@@ -2513,7 +2513,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 	unsigned int bbt_masked_page = 0xffffffff;
 	loff_t len;
 
-	DEBUG(MTD_DEBUG_LEVEL3, "%s: start = 0x%012llx, len = %llu\n",
+	dev_dbg(&mtd->dev, "%s: start = 0x%012llx, len = %llu\n",
 				__func__, (unsigned long long)instr->addr,
 				(unsigned long long)instr->len);
 
@@ -2537,7 +2537,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 
 	/* Check, if it is write protected */
 	if (nand_check_wp(mtd)) {
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: Device is write protected!!!\n",
+		dev_dbg(&mtd->dev, "%s: Device is write protected!!!\n",
 					__func__);
 		instr->state = MTD_ERASE_FAILED;
 		goto erase_exit;
@@ -2589,7 +2589,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
 
 		/* See if block erase succeeded */
 		if (status & NAND_STATUS_FAIL) {
-			DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed erase, "
+			dev_dbg(&mtd->dev, "%s: Failed erase, "
 					"page 0x%08x\n", __func__, page);
 			instr->state = MTD_ERASE_FAILED;
 			instr->fail_addr =
@@ -2650,7 +2650,7 @@ erase_exit:
 		if (!rewrite_bbt[chipnr])
 			continue;
 		/* Update the BBT for chip */
-		DEBUG(MTD_DEBUG_LEVEL0, "%s: nand_update_bbt "
+		dev_dbg(&mtd->dev, "%s: nand_update_bbt "
 			"(%d:0x%0llx 0x%0x)\n", __func__, chipnr,
 			rewrite_bbt[chipnr], chip->bbt_td->pages[chipnr]);
 		nand_update_bbt(mtd, rewrite_bbt[chipnr]);
@@ -2670,7 +2670,7 @@ static void nand_sync(struct mtd_info *mtd)
 {
 	struct nand_chip *chip = mtd->priv;
 
-	DEBUG(MTD_DEBUG_LEVEL3, "%s: called\n", __func__);
+	dev_dbg(&mtd->dev, "%s: called\n", __func__);
 
 	/* Grab the lock and see if the device is available */
 	nand_get_device(chip, mtd, FL_SYNCING);
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index b8551e9..4d18098 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -225,10 +225,6 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
 					mtd->ecc_stats.bbtblocks++;
 					continue;
 				}
-				/*
-				 * Leave it for now, if it's matured we can
-				 * move this message to MTD_DEBUG_LEVEL0.
-				 */
 				pr_debug("nand_read_bbt: Bad block at 0x%012llx\n",
 				       (loff_t)((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
 				/* Factory marked bad or worn out? */
@@ -1378,8 +1374,9 @@ int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
 	block = (int)(offs >> (this->bbt_erase_shift - 1));
 	res = (this->bbt[block >> 3] >> (block & 0x06)) & 0x03;
 
-	DEBUG(MTD_DEBUG_LEVEL2, "nand_isbad_bbt(): bbt info for offs 0x%08x: (block %d) 0x%02x\n",
-	      (unsigned int)offs, block >> 1, res);
+	dev_dbg(&mtd->dev, "nand_isbad_bbt(): bbt info for offs 0x%08x: "
+			   "(block %d) 0x%02x\n",
+			   (unsigned int)offs, block >> 1, res);
 
 	switch ((int)res) {
 	case 0x00:
-- 
1.7.0.4

  parent reply	other threads:[~2011-06-07 23:02 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 23:01 [PATCH 0/4] debug, printk cleanup Brian Norris
2011-06-07 23:01 ` [PATCH 1/4] mtd: remove printk's for [kv][mz]alloc failures Brian Norris
2011-06-08 14:27   ` Artem Bityutskiy
2011-06-07 23:01 ` [PATCH 2/4] mtd: nand: convert printk() to pr_*() Brian Norris
2011-06-08 14:43   ` Artem Bityutskiy
2011-06-08 18:25     ` [PATCH v2 " Brian Norris
2011-06-09  6:40       ` Artem Bityutskiy
2011-06-09  6:53       ` Artem Bityutskiy
2011-06-09  6:59         ` Artem Bityutskiy
2011-06-09  7:44       ` Artem Bityutskiy
2011-06-09 16:00         ` Brian Norris
2011-06-09 16:03           ` Artem Bityutskiy
2011-06-13 18:24             ` Brian Norris
2011-06-22  4:40               ` Artem Bityutskiy
2011-06-22  9:12                 ` Dmitry Eremin-Solenikov
2011-07-06 18:51                   ` Brian Norris
2011-07-06 19:12                     ` Brian Norris
2011-07-06 19:47                       ` Dmitry Eremin-Solenikov
2011-07-06 19:59                         ` Brian Norris
2011-07-07  6:58                     ` Artem Bityutskiy
2011-07-07 17:00                       ` Brian Norris
2011-07-07 19:56                         ` Artem Bityutskiy
2011-07-08 16:06                           ` Brian Norris
2011-07-20  3:59                             ` Artem Bityutskiy
2011-07-07  7:01               ` Artem Bityutskiy
2011-07-07 17:01                 ` Brian Norris
2011-06-09  8:13       ` Artem Bityutskiy
2011-06-09 16:22         ` Brian Norris
2011-06-10 18:25           ` Brian Norris
2011-06-07 23:01 ` Brian Norris [this message]
2011-06-08 14:44   ` [PATCH 3/4] mtd: nand: replace DEBUG() with dev_dbg() Artem Bityutskiy
2011-06-08 18:27     ` [PATCH v2 " Brian Norris
2011-06-09  6:46       ` Artem Bityutskiy
2011-06-07 23:01 ` [PATCH 4/4] mtd: nand: define pr_fmt() to include __func__ in debug output Brian Norris
2011-06-08 14:47   ` Artem Bityutskiy
2011-06-08 18:23     ` Brian Norris
2011-06-08 18:28       ` [PATCH v2 " Brian Norris
2011-06-09  7:10         ` Artem Bityutskiy
2011-06-08 19:03       ` [PATCH " Mike Frysinger

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=1307487717-25402-4-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=grinberg@compulab.co.il \
    --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 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.