From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 27 Jul 2018 01:13:46 +0200 From: Miquel Raynal To: Boris Brezillon Cc: Alexandre Belloni , Mans Rullgard , Maxime Ripard , Stefan Agner , linux-kernel@vger.kernel.org, Masahiro Yamada , linux-mtd@lists.infradead.org, Kamal Dasu , Josh Wu , Marc Gonzalez , Marek Vasut , Chen-Yu Tsai , bcm-kernel-feedback-list@broadcom.com, Sylvain Lemieux , Wenyou Yang , Tudor Ambarus , Vladimir Zapolskiy , Harvey Hunt , linux-mediatek@lists.infradead.org, Matthias Brugger , Han Xu , Xiaolei Li , linux-arm-kernel@lists.infradead.org, Nicolas Ferre , Richard Weinberger , Brian Norris , David Woodhouse Subject: Re: [PATCH v4 27/35] mtd: rawnand: sm_common: convert driver to nand_scan_with_ids() Message-ID: <20180727011346.3931dbe9@xps13> In-Reply-To: <20180726210655.03eca681@bbrezillon> References: <20180720151527.16038-1-miquel.raynal@bootlin.com> <20180720151527.16038-28-miquel.raynal@bootlin.com> <20180722084432.61b579b1@bbrezillon> <20180726210655.03eca681@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi Boris, Boris Brezillon wrote on Thu, 26 Jul 2018 21:06:55 +0200: > On Sun, 22 Jul 2018 08:44:32 +0200 > Boris Brezillon wrote: >=20 > > On Fri, 20 Jul 2018 17:15:19 +0200 > > Miquel Raynal wrote: > > =20 > > > Two helpers have been added to the core to make ECC-related > > > configuration between the detection phase and the final NAND scan. Use > > > these hooks and convert the driver to just use nand_scan_with_ids() > > > (alternative to nand_scan() for passing a flash IDs table) instead of > > > both nand_scan_ident() and nand_scan_tail(). > > >=20 > > > Signed-off-by: Miquel Raynal =20 > >=20 > > Reviewed-by: Boris Brezillon > > =20 > > > --- > > > drivers/mtd/nand/raw/sm_common.c | 39 +++++++++++++++++++++++++-----= --------- > > > 1 file changed, 25 insertions(+), 14 deletions(-) > > >=20 > > > diff --git a/drivers/mtd/nand/raw/sm_common.c b/drivers/mtd/nand/raw/= sm_common.c > > > index 7f5044a79f01..d05e3f976a5e 100644 > > > --- a/drivers/mtd/nand/raw/sm_common.c > > > +++ b/drivers/mtd/nand/raw/sm_common.c > > > @@ -160,19 +160,9 @@ static struct nand_flash_dev nand_xd_flash_ids[]= =3D { > > > {NULL} > > > }; > > > =20 > > > -int sm_register_device(struct mtd_info *mtd, int smartmedia) > > > +static int sm_attach_chip(struct nand_chip *chip) > > > { > > > - struct nand_chip *chip =3D mtd_to_nand(mtd); > > > - int ret; > > > - > > > - chip->options |=3D NAND_SKIP_BBTSCAN; > > > - > > > - /* Scan for card properties */ > > > - ret =3D nand_scan_ident(mtd, 1, smartmedia ? > > > - nand_smartmedia_flash_ids : nand_xd_flash_ids); > > > - > > > - if (ret) > > > - return ret; > > > + struct mtd_info *mtd =3D nand_to_mtd(chip); > > > =20 > > > /* Bad block marker position */ > > > chip->badblockpos =3D 0x05; > > > @@ -187,12 +177,33 @@ int sm_register_device(struct mtd_info *mtd, in= t smartmedia) > > > else > > > return -ENODEV; > > > =20 > > > - ret =3D nand_scan_tail(mtd); > > > + return 0; > > > +} > > > =20 > > > +static const struct nand_controller_ops sm_controller_ops =3D { > > > + .attach_chip =3D sm_attach_chip, > > > +}; > > > + > > > +int sm_register_device(struct mtd_info *mtd, int smartmedia) > > > +{ > > > + struct nand_chip *chip =3D mtd_to_nand(mtd); > > > + struct nand_flash_dev *flash_ids; > > > + int ret; > > > + > > > + chip->options |=3D NAND_SKIP_BBTSCAN; > > > + > > > + /* Scan for card properties */ > > > + chip->dummy_controller.ops =3D &sm_controller_ops; > > > + flash_ids =3D smartmedia ? nand_smartmedia_flash_ids : nand_xd_flas= h_ids; > > > + ret =3D nand_scan_with_ids(mtd, 1, flash_ids); > > > if (ret) > > > return ret; > > > =20 > > > - return mtd_device_register(mtd, NULL, 0); > > > + ret =3D mtd_device_register(mtd, NULL, 0); > > > + if (ret) > > > + nand_release(mtd); =20 >=20 > Didn't notice that while reviewing, but it would have been better to > use nand_cleanup() and do this change separately. Indeed, will fix it. Miqu=C3=A8l