From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Fri, 8 Mar 2013 19:00:01 -0600 Subject: [U-Boot] [PATCH v5 4/9] nand: Extend nand_(read|write)_skip_bad with *actual and limit parameters In-Reply-To: <1362764249-15547-5-git-send-email-trini@ti.com> (from trini@ti.com on Fri Mar 8 11:37:23 2013) References: <1362764249-15547-1-git-send-email-trini@ti.com> <1362764249-15547-5-git-send-email-trini@ti.com> Message-ID: <1362790801.29198.13@snotra> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 03/08/2013 11:37:23 AM, Tom Rini wrote: > We make these two functions take a size_t pointer to how much space > was used on NAND to read or write the buffer (when reads/writes > happen) > so that bad blocks can be accounted for. We also make them take an > loff_t limit on how much data can be read or written. This means that > we can now catch the case of when writing to a partition would exceed > the partition size due to bad blocks. To do this we also need to make > check_skip_len count not just complete blocks used but partial ones as > well. All callers of nand_(read|write)_skip_bad are adjusted to call > these with the most sensible limits available. > > The changes were started by Pantelis and finished by Tom. > > Signed-off-by: Pantelis Antoniou > Signed-off-by: Tom Rini > --- > Changes in v5: None > Changes in v4: > - Further reword nand_util.c comments, from Scott > - In nand_write_skip_bad make sure *actual is 0 for YAFFS2 errors too, > reminded by Scott. > - In cmd_nand.c don't drop the size is less than maxsize check in > arg_off_size as other nand functions need this still (Scott). > > Changes in v3: > - Reworked skip_check_len changes to just add accounting for *used to > the logic. > - Allow for actual to be NULL in nand_(read|write)_skip_bad, only DFU > calls this with a non-NULL parameter. Make sure the comments for > both > functions explain the parameters and their behavior. > - Other style changes requested by Scott. > - As nand_(write|read)_skip_bad passes back just a used length now. > > Changes in v2: > - NAND skip_check_len changes reworked to allow > nand_(read|write)_skip_bad to return this information to the caller. > > common/cmd_nand.c | 53 ++++++++++++++++++-------------- > common/env_nand.c | 3 +- > drivers/mtd/nand/nand_util.c | 68 > +++++++++++++++++++++++++++++++++++++----- > include/nand.h | 4 +-- > 4 files changed, 95 insertions(+), 33 deletions(-) Acked-by: Scott Wood -Scott