From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Smith Date: Fri, 23 Oct 2015 19:56:43 +0000 Subject: [U-Boot] [PATCH] mtd: pxa3xx_nand: Correct allocation and init bug In-Reply-To: <1445624429.701.184.camel@freescale.com> References: <1445622596-18764-1-git-send-email-kevin.smith@elecsyscorp.com> <1445624429.701.184.camel@freescale.com> Message-ID: <562A90FD.9050907@elecsyscorp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Scott, On 10/23/2015 01:20 PM, Scott Wood wrote: > > Yuck. Could you please rework this driver to not play games with pointers > and one giant allocation? Why can't this function allocate each region it > needs separately? > > -Scott > This driver is taken from Linux. There are a few API modifications to make it work in U-Boot, but the main form and function of the driver is the same. The single allocation method is used by Linux and is kept here in U-boot. As for why Linux does this, it may be for cache coherency, avoiding memory fragmentation, speed (fewer calls to malloc), or something else. I agree it is kind of opaque, but is probably done for a good reason. I didn't port the driver, and I don't know if the reason is applicable to U-Boot or if a rework is appropriate. Maybe Stefan can comment? Either way, I am not able to rework it right now. I think my patch fixes a legitimate issue. (It at least fixes the crashes I was experiencing). I hope it can be accepted as-is. Thanks, Kevin