diff mbox

mtd: introduce a macro for max NAND ID sequence length

Message ID 1363247938-2915-1-git-send-email-dedekind1@gmail.com
State Accepted
Commit 53552d22bfe1f83f69f18eddae2f1d96249440f3
Headers show

Commit Message

Artem Bityutskiy March 14, 2013, 7:58 a.m. UTC
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

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

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 include/linux/mtd/nand.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Huang Shijie March 15, 2013, 2:32 a.m. UTC | #1
于 2013年03月14日 03:58, Artem Bityutskiy 写道:
> From: Artem Bityutskiy<artem.bityutskiy@linux.intel.com>
>
> Introduce a helpful macro for the maximum NAND ID sequence length instead of
> using the "8" magic number.
>
> Signed-off-by: Artem Bityutskiy<artem.bityutskiy@linux.intel.com>
> ---
>   include/linux/mtd/nand.h |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index e2c7173..33516eb 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -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;
I also thought we should add a macro for the length of the id data.

Acked-by: Huang Shijie <shijie8@gmail.com>
diff mbox

Patch

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index e2c7173..33516eb 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -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;