All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Yoshio Furuyama <tmcmc-mb-yfuruyama7@ml.toshiba.co.jp>
Cc: bbrezillon@kernel.org, richard@nod.at, dwmw2@infradead.org,
	computersforpeace@gmail.com, marek.vasut@gmail.com,
	frieder.schrempf@kontron.De, peron.clem@gmail.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: spinand: Add support for all Toshiba Memory products
Date: Wed, 16 Jan 2019 11:04:57 +0100	[thread overview]
Message-ID: <20190116110457.6ca57d77@xps13> (raw)
In-Reply-To: <20190116055319.2755-1-tmcmc-mb-yfuruyama7@ml.toshiba.co.jp>

Hi Yoshio,

Yoshio Furuyama <tmcmc-mb-yfuruyama7@ml.toshiba.co.jp> wrote on Wed, 16
Jan 2019 14:53:19 +0900:

> Add device table for Toshiba Memory products.
> Also, generalize OOB layout structure and function names.
> 
> Signed-off-by: Yoshio Furuyama <tmcmc-mb-yfuruyama7@ml.toshiba.co.jp>
> 
> ---
>  drivers/mtd/nand/spi/toshiba.c |   79 +++++++++++++++++++++++++++++++++-------
>  1 file changed, 65 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
> index 0812655..0916962 100644
> --- a/drivers/mtd/nand/spi/toshiba.c
> +++ b/drivers/mtd/nand/spi/toshiba.c
> @@ -25,19 +25,19 @@ static SPINAND_OP_VARIANTS(write_cache_variants,
>  static SPINAND_OP_VARIANTS(update_cache_variants,
>  		SPINAND_PROG_LOAD(false, 0, NULL, 0));
>  
> -static int tc58cvg2s0h_ooblayout_ecc(struct mtd_info *mtd, int section,
> +static int tc58cxgxsx_ooblayout_ecc(struct mtd_info *mtd, int section,
>  				     struct mtd_oob_region *region)
>  {
> -	if (section > 7)
> +	if (section > 0)
>  		return -ERANGE;
>  
> -	region->offset = 128 + 16 * section;
> -	region->length = 16;
> +	region->offset = mtd->oobsize / 2;
> +	region->length = mtd->oobsize / 2;
>  
>  	return 0;
>  }
>  
> -static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section,
> +static int tc58cxgxsx_ooblayout_free(struct mtd_info *mtd, int section,
>  				      struct mtd_oob_region *region)
>  {
>  	if (section > 0)
> @@ -45,17 +45,17 @@ static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section,
>  
>  	/* 2 bytes reserved for BBM */
>  	region->offset = 2;
> -	region->length = 126;
> +	region->length = mtd->oobsize / 2 - 2;

I know this is valid C but I am always puzzled when reading such
mathematical operation, I would prefer (mtd->oobsize / 2) - 2.

I'm fine with the rest so if there is no other comment I will fix when
applying.


Thanks,
Miquèl

WARNING: multiple messages have this Message-ID (diff)
From: miquel.raynal@bootlin.com (Miquel Raynal)
To: linux-mtd@lists.infradead.org
Subject: [PATCH] mtd: spinand: Add support for all Toshiba Memory products
Date: Wed, 16 Jan 2019 11:04:57 +0100	[thread overview]
Message-ID: <20190116110457.6ca57d77@xps13> (raw)
In-Reply-To: <20190116055319.2755-1-tmcmc-mb-yfuruyama7@ml.toshiba.co.jp>

Hi Yoshio,

Yoshio Furuyama <tmcmc-mb-yfuruyama7@ml.toshiba.co.jp> wrote on Wed, 16
Jan 2019 14:53:19 +0900:

> Add device table for Toshiba Memory products.
> Also, generalize OOB layout structure and function names.
> 
> Signed-off-by: Yoshio Furuyama <tmcmc-mb-yfuruyama7@ml.toshiba.co.jp>
> 
> ---
>  drivers/mtd/nand/spi/toshiba.c |   79 +++++++++++++++++++++++++++++++++-------
>  1 file changed, 65 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
> index 0812655..0916962 100644
> --- a/drivers/mtd/nand/spi/toshiba.c
> +++ b/drivers/mtd/nand/spi/toshiba.c
> @@ -25,19 +25,19 @@ static SPINAND_OP_VARIANTS(write_cache_variants,
>  static SPINAND_OP_VARIANTS(update_cache_variants,
>  		SPINAND_PROG_LOAD(false, 0, NULL, 0));
>  
> -static int tc58cvg2s0h_ooblayout_ecc(struct mtd_info *mtd, int section,
> +static int tc58cxgxsx_ooblayout_ecc(struct mtd_info *mtd, int section,
>  				     struct mtd_oob_region *region)
>  {
> -	if (section > 7)
> +	if (section > 0)
>  		return -ERANGE;
>  
> -	region->offset = 128 + 16 * section;
> -	region->length = 16;
> +	region->offset = mtd->oobsize / 2;
> +	region->length = mtd->oobsize / 2;
>  
>  	return 0;
>  }
>  
> -static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section,
> +static int tc58cxgxsx_ooblayout_free(struct mtd_info *mtd, int section,
>  				      struct mtd_oob_region *region)
>  {
>  	if (section > 0)
> @@ -45,17 +45,17 @@ static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section,
>  
>  	/* 2 bytes reserved for BBM */
>  	region->offset = 2;
> -	region->length = 126;
> +	region->length = mtd->oobsize / 2 - 2;

I know this is valid C but I am always puzzled when reading such
mathematical operation, I would prefer (mtd->oobsize / 2) - 2.

I'm fine with the rest so if there is no other comment I will fix when
applying.


Thanks,
Miqu?l

  reply	other threads:[~2019-01-16 10:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  5:53 [PATCH] mtd: spinand: Add support for all Toshiba Memory products Yoshio Furuyama
2019-01-16 10:04 ` Miquel Raynal [this message]
2019-01-16 10:04   ` Miquel Raynal
2019-01-16 10:42 ` Schrempf Frieder
2019-01-16 10:42   ` Schrempf Frieder
2019-01-16 12:55   ` Schrempf Frieder
2019-01-16 12:55     ` Schrempf Frieder
2019-01-16 12:58 ` Schrempf Frieder
2019-01-16 12:58   ` Schrempf Frieder
2018-12-25  3:25   ` posting test
2019-01-17  8:42     ` posting test
2019-01-25 12:35 ` Miquel Raynal
2019-01-25 12:35   ` Miquel Raynal

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=20190116110457.6ca57d77@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@kontron.De \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=peron.clem@gmail.com \
    --cc=richard@nod.at \
    --cc=tmcmc-mb-yfuruyama7@ml.toshiba.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.