From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Fri, 03 Jun 2016 17:30:45 -0500 Subject: [U-Boot] [PATCH v2 3/7] nand: add nand mtd concat support In-Reply-To: <574FBDC9.6010002@denx.de> References: <1464696492-10349-1-git-send-email-hs@denx.de> <1464696492-10349-4-git-send-email-hs@denx.de> <1464826156.16584.144.camel@buserror.net> <574FBDC9.6010002@denx.de> Message-ID: <1464993045.22191.27.camel@buserror.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, 2016-06-02 at 07:02 +0200, Heiko Schocher wrote: > Hello Scott, > > Am 02.06.2016 um 02:09 schrieb Scott Wood: > > On Tue, 2016-05-31 at 14:08 +0200, Heiko Schocher wrote: > > > @@ -59,6 +64,9 @@ int nand_register(int devnum, struct mtd_info *mtd) > > > * via the mtdcore infrastructure (e.g. ubi). > > > */ > > > add_mtd_device(mtd); > > > +#ifdef CONFIG_MTD_CONCAT > > > + nand_devices_found++; > > > +#endif > > > #endif > > [snip] > > > + sprintf(c_mtd_name, "nand%d", nand_devices_found); > > > + mtd = mtd_concat_create(nand_info, nand_devices_found, > > > + c_mtd_name); > > > > This assumes that there are no gaps in the NAND numbering (e.g. because > > some > > device was optional or failed to init). It would be better to build an > > array > > by scanning nand_info[] for non-NULL devices. > > Yes, you are right ... Hmm... thinking about it ... this did exactly > my v1 ... I created such an array "mtd_nand_list" ... Ok, this > "mtd_nand_list" was a variable in file scope ... but as it is an array > of pointers, the mem footprint is not so big ... My concern was code organization, not (just) footprint. > but if you find it > better to scan nand_info and create a new array on stack, I can do > this ... what way do you preffer? On the stack. -Scott