Skip to contentSkip to conversation

mtd: nand: gpmi: remove duplicate 'nand-on-flash-bbt' property parse

PATCH In review Fugang Duan 2 participants 2 messages Apr 5, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: nand: gpmi: remove duplicate 'nand-on-flash-bbt' property parse

Remove duplicate 'nand-on-flash-bbt' property parse in driver. In fact, nand base driver has the common dts node parse in .nand_dt_init() like nand_scan_ident()->nand_dt_init()->of_get_nand_on_flash_bbt().

---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +10 -10
index 8122c69..0486bf2 100644
@@ -1914,16 +1914,6 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
 	/* Set up swap_block_mark, must be set before the gpmi_set_geometry() */
 	this->swap_block_mark = !GPMI_IS_MX23(this);
 
-	if (of_get_nand_on_flash_bbt(this->dev->of_node)) {
-		chip->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
-
-		if (of_property_read_bool(this->dev->of_node,
-						"fsl,no-blockmark-swap"))
-			this->swap_block_mark = false;
-	}
-	dev_dbg(this->dev, "Blockmark swapping %sabled\n",
-		this->swap_block_mark ? "en" : "dis");
-
 	/*
 	 * Allocate a temporary DMA buffer for reading ID in the
 	 * nand_scan_ident().
@@ -1938,6 +1928,16 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
 	if (ret)
 		goto err_out;
 
+	if (chip->bbt_options & NAND_BBT_USE_FLASH) {
+		chip->bbt_options |= NAND_BBT_NO_OOB;
+
+		if (of_property_read_bool(this->dev->of_node,
+						"fsl,no-blockmark-swap"))
+			this->swap_block_mark = false;
+	}
+	dev_dbg(this->dev, "Blockmark swapping %sabled\n",
+		this->swap_block_mark ? "en" : "dis");
+
 	ret = gpmi_init_last(this);
 	if (ret)
 		goto err_out;
Signature · 1 line
1.9.1
#1 lore raw

Pls drop review below patch, I see Boris.brezillon had sent the patch. Thanks.

From: Fugang Duan <[email protected]> Sent: Tuesday, April 05, 2016 12:49 PM

Quoted 61 lines

To: [email protected]; Han Xu <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Fugang Duan <[email protected]>
Subject: [PATCH] mtd: nand: gpmi: remove duplicate 'nand-on-flash-bbt' property parse

Remove duplicate 'nand-on-flash-bbt' property parse in driver. In fact, nand base driver has the common dts node parse in .nand_dt_init() like nand_scan_ident()->nand_dt_init()->of_get_nand_on_flash_bbt().

---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/mtd/nand/gpmi- renamed from drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -0

nand/gpmi-nand.c
index 8122c69..0486bf2 100644

drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -0
@@ -1914,16 +1914,6 @@ static int gpmi_nand_init(struct gpmi_nand_data
 *this)
 	/* Set up swap_block_mark, must be set before the

gpmi_set_geometry() */

drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -2
 	this->swap_block_mark = !GPMI_IS_MX23(this);
 
-	if (of_get_nand_on_flash_bbt(this->dev->of_node)) {
-		chip->bbt_options |= NAND_BBT_USE_FLASH |

NAND_BBT_NO_OOB;

drivers/mtd/nand/gpmi-nand/gpmi-nand.c +10 -8
-
-		if (of_property_read_bool(this->dev->of_node,
-						"fsl,no-blockmark-swap"))
-			this->swap_block_mark = false;
-	}
-	dev_dbg(this->dev, "Blockmark swapping %sabled\n",
-		this->swap_block_mark ? "en" : "dis");
-
 	/*
 	 * Allocate a temporary DMA buffer for reading ID in the
 	 * nand_scan_ident().
@@ -1938,6 +1928,16 @@ static int gpmi_nand_init(struct gpmi_nand_data
 *this)
 	if (ret)
 		goto err_out;
 
+	if (chip->bbt_options & NAND_BBT_USE_FLASH) {
+		chip->bbt_options |= NAND_BBT_NO_OOB;
+
+		if (of_property_read_bool(this->dev->of_node,
+						"fsl,no-blockmark-swap"))
+			this->swap_block_mark = false;
+	}
+	dev_dbg(this->dev, "Blockmark swapping %sabled\n",
+		this->swap_block_mark ? "en" : "dis");
+
 	ret = gpmi_init_last(this);
 	if (ret)

goto err_out;
--
1.9.1