diff mbox

[U-Boot] mtd: Add _LARGE to MTD_MAX_*_ENTRIES

Message ID 1384391405-32757-1-git-send-email-scottwood@freescale.com
State Superseded
Delegated to: Scott Wood
Headers show

Commit Message

Scott Wood Nov. 14, 2013, 1:10 a.m. UTC
This makes the names match current Linux source, and resolves
a conflict between
http://patchwork.ozlabs.org/patch/280488/
and
http://patchwork.ozlabs.org/patch/284513/

The former was posted first and is closer to matching Linux, but unlike
Linux it does not add _LARGE to the names.  The second adds _LARGE to
one of the names, and depends on it in a subsequent patch
(http://patchwork.ozlabs.org/patch/284512/).

I do wish this just used ARRAY_SIZE(), though. :-P

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Prabhakar Kushwaha <prabhakar@freescale.com>
Cc: Josh Wu <josh.wu@atmel.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
---
Depends on http://patchwork.ozlabs.org/patch/280488/
---
 drivers/mtd/onenand/onenand_base.c | 15 ++++++++++-----
 include/linux/mtd/mtd.h            |  8 ++++----
 2 files changed, 14 insertions(+), 9 deletions(-)

Comments

Ɓukasz Majewski Nov. 27, 2013, 1:44 p.m. UTC | #1
Hi Scott,

> This makes the names match current Linux source, and resolves
> a conflict between
> http://patchwork.ozlabs.org/patch/280488/
> and
> http://patchwork.ozlabs.org/patch/284513/
> 
> The former was posted first and is closer to matching Linux, but
> unlike Linux it does not add _LARGE to the names.  The second adds
> _LARGE to one of the names, and depends on it in a subsequent patch
> (http://patchwork.ozlabs.org/patch/284512/).
> 
> I do wish this just used ARRAY_SIZE(), though. :-P

Despite that this patch is already in ML,

Tested-by: Lukasz Majewski <l.majewski@samsung.com>

Test HW: S5PC110 GONI

> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> Cc: Prabhakar Kushwaha <prabhakar@freescale.com>
> Cc: Josh Wu <josh.wu@atmel.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> ---
> Depends on http://patchwork.ozlabs.org/patch/280488/
> ---
>  drivers/mtd/onenand/onenand_base.c | 15 ++++++++++-----
>  include/linux/mtd/mtd.h            |  8 ++++----
>  2 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/onenand_base.c
> b/drivers/mtd/onenand/onenand_base.c index 067f8ef..979e4af 100644
> --- a/drivers/mtd/onenand/onenand_base.c
> +++ b/drivers/mtd/onenand/onenand_base.c
> @@ -761,7 +761,8 @@ static int onenand_transfer_auto_oob(struct
> mtd_info *mtd, uint8_t *buf, uint8_t *oob_buf = this->oob_buf;
>  
>  	free = this->ecclayout->oobfree;
> -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length;
> i++, free++) {
> +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE &&
> free->length;
> +	     i++, free++) {
>  		if (readcol >= lastgap)
>  			readcol += free->offset - lastgap;
>  		if (readend >= lastgap)
> @@ -770,7 +771,8 @@ static int onenand_transfer_auto_oob(struct
> mtd_info *mtd, uint8_t *buf, }
>  	this->read_bufferram(mtd, 0, ONENAND_SPARERAM, oob_buf, 0,
> mtd->oobsize); free = this->ecclayout->oobfree;
> -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length;
> i++, free++) {
> +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE &&
> free->length;
> +	     i++, free++) {
>  		int free_end = free->offset + free->length;
>  		if (free->offset < readend && free_end > readcol) {
>  			int st = max_t(int,free->offset,readcol);
> @@ -1356,7 +1358,8 @@ static int onenand_fill_auto_oob(struct
> mtd_info *mtd, u_char *oob_buf, unsigned int i;
>  
>  	free = this->ecclayout->oobfree;
> -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length;
> i++, free++) {
> +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE &&
> free->length;
> +	     i++, free++) {
>  		if (writecol >= lastgap)
>  			writecol += free->offset - lastgap;
>  		if (writeend >= lastgap)
> @@ -1364,7 +1367,8 @@ static int onenand_fill_auto_oob(struct
> mtd_info *mtd, u_char *oob_buf, lastgap = free->offset + free->length;
>  	}
>  	free = this->ecclayout->oobfree;
> -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length;
> i++, free++) {
> +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE &&
> free->length;
> +	     i++, free++) {
>  		int free_end = free->offset + free->length;
>  		if (free->offset < writeend && free_end > writecol) {
>  			int st = max_t(int,free->offset,writecol);
> @@ -2750,7 +2754,8 @@ int onenand_scan(struct mtd_info *mtd, int
> maxchips)
>  	 * the out of band area
>  	 */
>  	this->ecclayout->oobavail = 0;
> -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES &&
> +
> +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE &&
>  	    this->ecclayout->oobfree[i].length; i++)
>  		this->ecclayout->oobavail +=
>  			this->ecclayout->oobfree[i].length;
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index 3a18f8f..5004909 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -96,8 +96,8 @@ struct mtd_oob_ops {
>  	uint8_t		*oobbuf;
>  };
>  
> -#define MTD_MAX_OOBFREE_ENTRIES	32
> -#define MTD_MAX_ECCPOS_ENTRIES	640
> +#define MTD_MAX_OOBFREE_ENTRIES_LARGE	32
> +#define MTD_MAX_ECCPOS_ENTRIES_LARGE	640
>  
>  /*
>   * ECC layout control structure. Exported to userspace for
> @@ -105,9 +105,9 @@ struct mtd_oob_ops {
>   */
>  struct nand_ecclayout {
>  	uint32_t eccbytes;
> -	uint32_t eccpos[MTD_MAX_ECCPOS_ENTRIES];
> +	uint32_t eccpos[MTD_MAX_ECCPOS_ENTRIES_LARGE];
>  	uint32_t oobavail;
> -	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
> +	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE];
>  };
>  
>  struct mtd_info {
diff mbox

Patch

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 067f8ef..979e4af 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -761,7 +761,8 @@  static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf,
 	uint8_t *oob_buf = this->oob_buf;
 
 	free = this->ecclayout->oobfree;
-	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
+	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length;
+	     i++, free++) {
 		if (readcol >= lastgap)
 			readcol += free->offset - lastgap;
 		if (readend >= lastgap)
@@ -770,7 +771,8 @@  static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf,
 	}
 	this->read_bufferram(mtd, 0, ONENAND_SPARERAM, oob_buf, 0, mtd->oobsize);
 	free = this->ecclayout->oobfree;
-	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
+	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length;
+	     i++, free++) {
 		int free_end = free->offset + free->length;
 		if (free->offset < readend && free_end > readcol) {
 			int st = max_t(int,free->offset,readcol);
@@ -1356,7 +1358,8 @@  static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
 	unsigned int i;
 
 	free = this->ecclayout->oobfree;
-	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
+	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length;
+	     i++, free++) {
 		if (writecol >= lastgap)
 			writecol += free->offset - lastgap;
 		if (writeend >= lastgap)
@@ -1364,7 +1367,8 @@  static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
 		lastgap = free->offset + free->length;
 	}
 	free = this->ecclayout->oobfree;
-	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
+	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length;
+	     i++, free++) {
 		int free_end = free->offset + free->length;
 		if (free->offset < writeend && free_end > writecol) {
 			int st = max_t(int,free->offset,writecol);
@@ -2750,7 +2754,8 @@  int onenand_scan(struct mtd_info *mtd, int maxchips)
 	 * the out of band area
 	 */
 	this->ecclayout->oobavail = 0;
-	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES &&
+
+	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE &&
 	    this->ecclayout->oobfree[i].length; i++)
 		this->ecclayout->oobavail +=
 			this->ecclayout->oobfree[i].length;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 3a18f8f..5004909 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -96,8 +96,8 @@  struct mtd_oob_ops {
 	uint8_t		*oobbuf;
 };
 
-#define MTD_MAX_OOBFREE_ENTRIES	32
-#define MTD_MAX_ECCPOS_ENTRIES	640
+#define MTD_MAX_OOBFREE_ENTRIES_LARGE	32
+#define MTD_MAX_ECCPOS_ENTRIES_LARGE	640
 
 /*
  * ECC layout control structure. Exported to userspace for
@@ -105,9 +105,9 @@  struct mtd_oob_ops {
  */
 struct nand_ecclayout {
 	uint32_t eccbytes;
-	uint32_t eccpos[MTD_MAX_ECCPOS_ENTRIES];
+	uint32_t eccpos[MTD_MAX_ECCPOS_ENTRIES_LARGE];
 	uint32_t oobavail;
-	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
+	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE];
 };
 
 struct mtd_info {