Skip to contentSkip to conversation

mtd: introduce a macro for max NAND ID sequence length

PATCH In review Artem Bityutskiy 2 participants 2 messages Mar 14, 2013

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

PATCH 1/1 mtd: introduce a macro for max NAND ID sequence length

From: Artem Bityutskiy <[email protected]>

Introduce a helpful macro for the maximum NAND ID sequence length instead of using the "8" magic number.

---
 include/linux/mtd/nand.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/mtd/nand.h +4 -1
index e2c7173..33516eb 100644
@@ -542,6 +542,9 @@ struct nand_chip {
 #define NAND_MFR_MACRONIX	0xc2
 #define NAND_MFR_EON		0x92
 
+/* The maximum expected count of bytes in the NAND ID sequence */
+#define NAND_MAX_ID_LEN 8
+
 /*
  * A helper for defining older NAND chips where the second ID byte fully
  * defined the chip, including the geometry (chip size, eraseblock size, page
@@ -589,7 +592,7 @@ struct nand_flash_dev {
 			uint8_t mfr_id;
 			uint8_t dev_id;
 		};
-		uint8_t id[8];
+		uint8_t id[NAND_MAX_ID_LEN];
 	};
 	unsigned int pagesize;
 	unsigned int chipsize;
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 25 lines · Artem Bityutskiy

From: Artem Bityutskiy<[email protected]>

Introduce a helpful macro for the maximum NAND ID sequence length instead of using the "8" magic number.

---
  include/linux/mtd/nand.h |    5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/mtd/nand.h +3 -0
index e2c7173..33516eb 100644
@@ -542,6 +542,9 @@ struct nand_chip {
  #define NAND_MFR_MACRONIX	0xc2
  #define NAND_MFR_EON		0x92
 
+/* The maximum expected count of bytes in the NAND ID sequence */
+#define NAND_MAX_ID_LEN 8
+
  /*
   * A helper for defining older NAND chips where the second ID byte fully
   * defined the chip, including the geometry (chip size, eraseblock size, page

include/linux/mtd/nand.h struct nand_flash_dev { · line 598

Quoted 8 lines
include/linux/mtd/nand.h +1 -1
@@ -589,7 +592,7 @@ struct nand_flash_dev {
  			uint8_t mfr_id;
  			uint8_t dev_id;
  		};
-		uint8_t id[8];
+		uint8_t id[NAND_MAX_ID_LEN];
  	};
  	unsigned int pagesize;
  	unsigned int chipsize;

I also thought we should add a macro for the length of the id data.