public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mtd: Add _LARGE to MTD_MAX_*_ENTRIES
Date: Wed, 27 Nov 2013 14:44:53 +0100	[thread overview]
Message-ID: <20131127144453.60620381@amdc2363> (raw)
In-Reply-To: <1384391405-32757-1-git-send-email-scottwood@freescale.com>

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 {

      reply	other threads:[~2013-11-27 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14  1:10 [U-Boot] [PATCH] mtd: Add _LARGE to MTD_MAX_*_ENTRIES Scott Wood
2013-11-27 13:44 ` Lukasz Majewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131127144453.60620381@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox