Hi Masahiro, Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote on Sat, 30 Mar 2019 15:23:23 +0100: > On Fri, 29 Mar 2019 16:28:13 +0900 > Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx> > > --- > > > > 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 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/