mtd: Add _LARGE to MTD_MAX_*_ENTRIES
PATCH 1/1 mtd: Add _LARGE to MTD_MAX_*_ENTRIES
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
---
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(-)
drivers/mtd/onenand/onenand_base.c +10 -5
@@ -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;
include/linux/mtd/mtd.h +4 -4
@@ -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 {
Signature · 1 line
1.8.1.2
PATCH 1/1 mtd: Add _LARGE to MTD_MAX_*_ENTRIES
Hi Scott,
Quoted 6 lines
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/
Quoted 6 lines
The former was posted first and is closer to matching Linux, but unlike Linux it does not add
_LARGEto the names. The second adds_LARGEto 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,
Test HW: S5PC110 GONI
Quoted 102 lines
Signed-off-by Scott Wood <[email protected]>Cc Prabhakar Kushwaha <[email protected]>Cc Josh Wu <[email protected]>Cc Lukasz Majewski <[email protected]>---
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(-)(quoted diff) +0
-0
b/drivers/mtd/onenand/onenand_base.cindex 067f8ef..979e4af 100644drivers/mtd/onenand/onenand_base.c +2
-1@@ -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)drivers/mtd/onenand/onenand_base.c +2
-1readcol += 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;drivers/mtd/onenand/onenand_base.c +2
-1if (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)drivers/mtd/onenand/onenand_base.c +2
-1writecol += 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;drivers/mtd/onenand/onenand_base.c +2
-1if (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, intmaxchips) * 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 +=drivers/mtd/onenand/onenand_base.c +0
-0this->ecclayout->oobfree[i].length;include/linux/mtd/mtd.h +4
-4@@ -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 {