Patchwork [5/8] mtd: nand: rename '_raw' BBT scan functions

login
register
mail settings
Submitter Brian Norris
Date June 22, 2012, 11:35 p.m.
Message ID <1340408145-24531-6-git-send-email-computersforpeace@gmail.com>
Download mbox | patch
Permalink /patch/166689/
State New
Headers show

Comments

Brian Norris - June 22, 2012, 11:35 p.m.
None of these scanning functions use MTD_OPS_RAW mode any more, so there's
really nothing 'raw' about them. Rename them to (hopefully) make the code
a little clearer.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/nand/nand_bbt.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Shmulik Ladkani - June 26, 2012, 12:39 p.m.
Hi Brian,

On Fri, 22 Jun 2012 16:35:42 -0700 Brian Norris <computersforpeace@gmail.com> wrote:
> None of these scanning functions use MTD_OPS_RAW mode any more, so there's
> really nothing 'raw' about them. Rename them to (hopefully) make the code
> a little clearer.

Minor nitpick: I guess this patch should be the last in your patchset.

This is since 'scan_read_raw_oob()' (renamed to 'scan_read_oob' by this
patch) still uses MTD_OPS_RAW; hence the statement "None of these
scanning functions use MTD_OPS_RAW mode any more" is incorrect at the
time this patch is introduced.

Regards,
Shmulik
Brian Norris - July 10, 2012, 2:13 a.m.
On Tue, Jun 26, 2012 at 5:39 AM, Shmulik Ladkani
<shmulik.ladkani@gmail.com> wrote:
> On Fri, 22 Jun 2012 16:35:42 -0700 Brian Norris <computersforpeace@gmail.com> wrote:
>> None of these scanning functions use MTD_OPS_RAW mode any more, so there's
>> really nothing 'raw' about them. Rename them to (hopefully) make the code
>> a little clearer.
>
> Minor nitpick: I guess this patch should be the last in your patchset.

You're correct. I think I somewhat-arbitrarily rearranged (rebased)
some of these patches before submission. Will fix if/when I resubmit.

Thanks,
Brian
Artem Bityutskiy - Aug. 15, 2012, 12:35 p.m.
On Fri, 2012-06-22 at 16:35 -0700, Brian Norris wrote:
> None of these scanning functions use MTD_OPS_RAW mode any more, so there's
> really nothing 'raw' about them. Rename them to (hopefully) make the code
> a little clearer.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Pushed this one as the last patch. I think now the entire patch-set is
in the l2 tree.

Patch

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 4123705..35e8cdf 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -288,7 +288,7 @@  static int read_abs_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
 }
 
 /* BBT marker is in the first page, no OOB */
-static int scan_read_raw_data(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
+static int scan_read_data(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
 			 struct nand_bbt_descr *td)
 {
 	size_t retlen;
@@ -301,8 +301,8 @@  static int scan_read_raw_data(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
 	return mtd_read(mtd, offs, len, &retlen, buf);
 }
 
-/* Scan read raw data from flash */
-static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
+/* Scan read data from flash */
+static int scan_read_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
 			 size_t len)
 {
 	struct mtd_oob_ops ops;
@@ -329,13 +329,13 @@  static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
 	return 0;
 }
 
-static int scan_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
+static int scan_read(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
 			 size_t len, struct nand_bbt_descr *td)
 {
 	if (td->options & NAND_BBT_NO_OOB)
-		return scan_read_raw_data(mtd, buf, offs, td);
+		return scan_read_data(mtd, buf, offs, td);
 	else
-		return scan_read_raw_oob(mtd, buf, offs, len);
+		return scan_read_oob(mtd, buf, offs, len);
 }
 
 /* Scan write data with oob to flash */
@@ -380,7 +380,7 @@  static void read_abs_bbts(struct mtd_info *mtd, uint8_t *buf,
 
 	/* Read the primary version, if available */
 	if (td->options & NAND_BBT_VERSION) {
-		scan_read_raw(mtd, buf, (loff_t)td->pages[0] << this->page_shift,
+		scan_read(mtd, buf, (loff_t)td->pages[0] << this->page_shift,
 			      mtd->writesize, td);
 		td->version[0] = buf[bbt_get_ver_offs(mtd, td)];
 		pr_info("Bad block table at page %d, version 0x%02X\n",
@@ -389,7 +389,7 @@  static void read_abs_bbts(struct mtd_info *mtd, uint8_t *buf,
 
 	/* Read the mirror version, if available */
 	if (md && (md->options & NAND_BBT_VERSION)) {
-		scan_read_raw(mtd, buf, (loff_t)md->pages[0] << this->page_shift,
+		scan_read(mtd, buf, (loff_t)md->pages[0] << this->page_shift,
 			      mtd->writesize, md);
 		md->version[0] = buf[bbt_get_ver_offs(mtd, md)];
 		pr_info("Bad block table at page %d, version 0x%02X\n",
@@ -404,7 +404,7 @@  static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd,
 {
 	int ret, j;
 
-	ret = scan_read_raw_oob(mtd, buf, offs, readlen);
+	ret = scan_read_oob(mtd, buf, offs, readlen);
 	/* Ignore ECC errors when checking for BBM */
 	if (ret && !mtd_is_bitflip_or_eccerr(ret))
 		return ret;
@@ -593,7 +593,7 @@  static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
 			loff_t offs = (loff_t)actblock << this->bbt_erase_shift;
 
 			/* Read first page */
-			scan_read_raw(mtd, buf, offs, mtd->writesize, td);
+			scan_read(mtd, buf, offs, mtd->writesize, td);
 			if (!check_pattern(buf, scanlen, mtd->writesize, td)) {
 				td->pages[i] = actblock << blocktopage;
 				if (td->options & NAND_BBT_VERSION) {