Re: [PATCH 06/15] mtd: rawnand: Add nand_[de]select_target() helpers

Boris Brezillon
2018-10-29T13:57:52Z

On Mon, 29 Oct 2018 14:39:24 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Mon, 29 Oct 2018
> 14:36:47 +0100:
>
> > Hi Boris,
> >
> > Boris Brezillon <boris.brezillon@bootlin.com> wrote on Tue, 23 Oct 2018
> > 20:50:02 +0200:
> >
> > > Add a wrapper to prevent drivers and core code from directly calling
> > > the ->select_chip hook which we are about to deprecate.
> > >
> > > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > ---
> > > drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 23 +++--
> > > drivers/mtd/nand/raw/jz4740_nand.c | 4 +-
> > > drivers/mtd/nand/raw/nand_base.c | 114 ++++++++++++++-------
> > > drivers/mtd/nand/raw/r852.c | 4 +-
> > > include/linux/mtd/rawnand.h | 4 +
> > > 5 files changed, 98 insertions(+), 51 deletions(-)
> > >
> >
> > So far I am glad to see all these changes.
> >
> > About the ->select_chip() removal, I wonder if it would not be better
> > to also change the local variables "chipnr" or "chip_number" (or
> > even "i") that suggest that this ID selects a chip, while it
> > actually selects a die in a chip (and it is possible to have multiple
> > die on a chip, so multiple CS for one single NAND chip).

I agree.

> >
> > Do you think it is worth the change ? If yes, would it fit in this patch
> > or is it better to do this change elsewhere?
> >
>
> This request actually applies to the following patches as well. Maybe we
> could even find a uniform way to name it, "die_nr" or something like
> this?

Target is the name used in the ONFI spec, hence the function names.
Note that die is not accurate since you might have several dies exposed
through a single CS line (that's called LUNs).