linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Boris Brezillon <bbrezillon@kernel.org>
Subject: Re: [PATCH v4 1/9] mtd: rawnand: denali: use nand_chip pointer more for internal functions
Date: Mon, 1 Apr 2019 19:14:19 +0200	[thread overview]
Message-ID: <20190401191419.0431882e@xps13> (raw)
In-Reply-To: <20190330152323.71734cb8@collabora.com>

Hi Masahiro,

Boris Brezillon <boris.brezillon@collabora.com> wrote on Sat, 30 Mar
2019 15:23:23 +0100:

> On Fri, 29 Mar 2019 16:28:13 +0900
> Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> 
> > With the recent refactoring, the NAND driver hooks now take a pointer
> > to nand_chip. Add to_denali() in order to convert (struct nand_chip *)
> > to (struct denali_nand_info *) directly. It is more useful than the
> > current mtd_to_denali().
> > 
> > I changed some helper functions to take (struct nand_chip *). This will
> > avoid pointer conversion back and forth, and ease further development.
> > 
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> > 
> > Changes in v4: None
> > Changes in v3: None
> > Changes in v2: None
> > 
> >  drivers/mtd/nand/raw/denali.c | 57 ++++++++++++++++++++++++-------------------
> >  1 file changed, 32 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
> > index 24aeafc..4ac1314 100644
> > --- a/drivers/mtd/nand/raw/denali.c
> > +++ b/drivers/mtd/nand/raw/denali.c
> > @@ -47,6 +47,11 @@ static inline struct denali_nand_info *mtd_to_denali(struct mtd_info *mtd)
> >  	return container_of(mtd_to_nand(mtd), struct denali_nand_info, nand);
> >  }
> >  
> > +static struct denali_nand_info *to_denali(struct nand_chip *chip)
> > +{
> > +	return container_of(chip, struct denali_nand_info, nand);
> > +}
> > +
> >  /*
> >   * Direct Addressing - the slave address forms the control information (command
> >   * type, bank, block, and page address).  The slave data is the actual data to
> > @@ -282,12 +287,12 @@ static void denali_cmd_ctrl(struct nand_chip *chip, int dat, unsigned int ctrl)
> >  	denali->host_write(denali, DENALI_BANK(denali) | type, dat);
> >  }
> >  
> > -static int denali_check_erased_page(struct mtd_info *mtd,
> > -				    struct nand_chip *chip, uint8_t *buf,
> > +static int denali_check_erased_page(struct nand_chip *chip,
> > +				    struct denali_nand_info *denali, u8 *buf,  
> 
> You don't need to pass both chip and denali, as one can be extracted
> from the other.
> 
> >  				    unsigned long uncor_ecc_flags,
> >  				    unsigned int max_bitflips)
> >  {
> > -	struct denali_nand_info *denali = mtd_to_denali(mtd);
> > +	struct mtd_ecc_stats *ecc_stats = &nand_to_mtd(chip)->ecc_stats;
> >  	uint8_t *ecc_code = chip->oob_poi + denali->oob_skip_bytes;
> >  	int ecc_steps = chip->ecc.steps;
> >  	int ecc_size = chip->ecc.size;
> > @@ -303,9 +308,9 @@ static int denali_check_erased_page(struct mtd_info *mtd,
> >  						  NULL, 0,
> >  						  chip->ecc.strength);
> >  		if (stat < 0) {
> > -			mtd->ecc_stats.failed++;
> > +			ecc_stats->failed++;
> >  		} else {
> > -			mtd->ecc_stats.corrected += stat;
> > +			ecc_stats->corrected += stat;
> >  			max_bitflips = max_t(unsigned int, max_bitflips, stat);
> >  		}
> >  
> > @@ -316,11 +321,11 @@ static int denali_check_erased_page(struct mtd_info *mtd,
> >  	return max_bitflips;
> >  }
> >  
> > -static int denali_hw_ecc_fixup(struct mtd_info *mtd,
> > +static int denali_hw_ecc_fixup(struct nand_chip *chip,
> >  			       struct denali_nand_info *denali,  
> 
> Ditto.
> 

I am fine with the series in its current state, please submit a v5
with Boris comment's addressed and I'll queue it right away to next.

Thanks,
Miquèl

  reply	other threads:[~2019-04-01 18:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29  7:28 [PATCH v4 0/9] mtd: rawnand: denali: exec_op(), controller/chip separation, and cleanups Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 1/9] mtd: rawnand: denali: use nand_chip pointer more for internal functions Masahiro Yamada
2019-03-30 14:23   ` Boris Brezillon
2019-04-01 17:14     ` Miquel Raynal [this message]
2019-04-02  3:48       ` Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 2/9] mtd: rawnand: denali: refactor raw page accessors Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 3/9] mtd: rawnand: denali: remove unneeded casts in denali_{read,write}_pio Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 4/9] mtd: rawnand: denali: switch over to ->exec_op() from legacy hooks Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 5/9] mtd: rawnand: denali: use bool type instead of int where appropriate Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 6/9] mtd: rawnand: denali_pci: rename goto labels Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 7/9] mtd: rawnand: denali: decouple controller and NAND chips Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 8/9] mtd: rawnand: denali: remove DENALI_NR_BANKS macro Masahiro Yamada
2019-03-29  7:28 ` [PATCH v4 9/9] mtd: rawnand: denali: clean up coding style Masahiro Yamada

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=20190401191419.0431882e@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=boris.brezillon@collabora.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=yamada.masahiro@socionext.com \
    /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;
as well as URLs for NNTP newsgroup(s).