From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Brezillon Date: Thu, 6 Sep 2018 11:52:32 +0200 Subject: [U-Boot] [PATCH v7 11/12] cmd: ubi: clean the partition handling In-Reply-To: <20180906070854.9717-12-miquel.raynal@bootlin.com> References: <20180906070854.9717-1-miquel.raynal@bootlin.com> <20180906070854.9717-12-miquel.raynal@bootlin.com> Message-ID: <20180906115232.18640684@bbrezillon> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Miquel, On Thu, 6 Sep 2018 09:08:53 +0200 Miquel Raynal wrote: > int ubi_part(char *part_name, const char *vid_header_offset) > { > + struct mtd_info *mtd; > int err = 0; > - char mtd_dev[16]; > - struct mtd_device *dev; > - struct part_info *part; > - u8 pnum; > > ubi_detach(); > - /* > - * Search the mtd device number where this partition > - * is located > - */ > - if (find_dev_and_part(part_name, &dev, &pnum, &part)) { > + > +#ifdef CONFIG_MTD > + mtd_probe_devices(); > +#endif Okay, so just like for the mtdparts patch, the #ifdef is incorrect, but more importantly, with you're rework, you're breaking all non-DM platforms, because the UBI layer no longer creates an MTD device on the fly, and the mtd partition creation won't take place if CONFIG_MTD is not activated. My suggestion would be to make mtd_probe_devices() available to everyone (not only those who have CONFIG_MTD selected, which in turn depends on CONFIG_DM) so that the mtd part creation is done unconditionally, and you can safely get rid of the "dummy MTD device creation" done in UBI. > + mtd = get_mtd_device_nm(part_name); > + if (IS_ERR(mtd)) { Regards, Boris