From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miquel Raynal Date: Mon, 19 Nov 2018 10:25:27 +0100 Subject: [U-Boot] [PATCH 3/4] mtd: Delete partitions attached to the device when a device is deleted In-Reply-To: <0776b30a-fce7-010f-5903-0faf9bb0d0e2@denx.de> References: <20181116144026.3015-1-boris.brezillon@bootlin.com> <20181116144026.3015-3-boris.brezillon@bootlin.com> <20181117101912.55eaccc6@bbrezillon> <0776b30a-fce7-010f-5903-0faf9bb0d0e2@denx.de> Message-ID: <20181119102527.134e0e04@xps13> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hi Heiko, Heiko Schocher wrote on Mon, 19 Nov 2018 07:16:53 +0100: > Hello Boris, >=20 > Am 17.11.2018 um 10:19 schrieb Boris Brezillon: > > On Fri, 16 Nov 2018 15:40:25 +0100 > > Boris Brezillon wrote: =20 > > >> If we don't do that, partitions might still be exposed while the =20 > >> underlying device is gone. > >> > >> Fixes: 2a74930da57f ("mtd: mtdpart: implement proper partition handlin= g") > >> Signed-off-by: Boris Brezillon > >> --- > >> drivers/mtd/mtdcore.c | 1 + > >> include/linux/mtd/mtd.h | 14 ++++++++++++++ > >> 2 files changed, 15 insertions(+) > >> > >> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c > >> index 7a15ded8c883..46657fe7c949 100644 > >> --- a/drivers/mtd/mtdcore.c > >> +++ b/drivers/mtd/mtdcore.c > >> @@ -528,6 +528,7 @@ int del_mtd_device(struct mtd_info *mtd) > >> struct mtd_notifier *not; > >> #endif =20 > >> >> + del_mtd_partitions(mtd); =20 > >> mutex_lock(&mtd_table_mutex); =20 > >> >> if (idr_find(&mtd_idr, mtd->index) !=3D mtd) { =20 > >> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h > >> index d20ebd820289..c5b58dd3f0f7 100644 > >> --- a/include/linux/mtd/mtd.h > >> +++ b/include/linux/mtd/mtd.h > >> @@ -562,8 +562,22 @@ unsigned mtd_mmap_capabilities(struct mtd_info *m= td); > >> /* drivers/mtd/mtdcore.h */ > >> int add_mtd_device(struct mtd_info *mtd); > >> int del_mtd_device(struct mtd_info *mtd); > >> + > >> +#ifdef CONFIG_MTD_PARTITIONS > >> int add_mtd_partitions(struct mtd_info *, const struct mtd_partition= *, int); > >> int del_mtd_partitions(struct mtd_info *); > >> +#else > >> +static inline int add_mtd_partitions(struct mtd_info *, > >> + const struct mtd_partition *, int) > > > Args should have names. =20 > > >> +{ =20 > >> + return 0; > >> +} > >> + > >> +static int del_mtd_partitions(struct mtd_info *) > > > Missing inline here. > > > I'll send a v2 fixing those 2 bugs. =20 >=20 > Thanks! >=20 > I tried your patchset, with them "ubi part ubi" does now work, also > after a "sf probe" ... >=20 > There is one problem, see log [1]. >=20 > If you have an ubi partition attached (In my example on the NAND), > and issue "sf probe", the following "mtd list" shows not anymore > the SPI NOR MTD partitions. (It prints an error message > "Partition "ubi" already in use, aborting") >=20 > If I detach UBI from the NAND MTD partition, the MTD Partitions on > the SPI NOR are again found after a "sf probe" before "mtd list" [2] I will have just a little time to look into this issue today, so there is a quick fix, please tell me if it works for you, otherwise I'll try to find more time during this week to look into it. Thanks, Miqu=C3=A8l ---