Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752881AbbDBQ00 (ORCPT ); Thu, 2 Apr 2015 12:26:26 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:33140 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbbDBQ0Z (ORCPT ); Thu, 2 Apr 2015 12:26:25 -0400 Date: Thu, 2 Apr 2015 09:26:19 -0700 From: Brian Norris To: Roger Quadros Cc: dwmw2@infradead.org, akinobu.mita@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] mtd: mtd_oobtest: Fix the address offset with vary_offset case Message-ID: <20150402162619.GG32500@ld-irv-0074> References: <1417792720-3017-1-git-send-email-rogerq@ti.com> <1417792720-3017-3-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1417792720-3017-3-git-send-email-rogerq@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3306 Lines: 86 On Fri, Dec 05, 2014 at 05:18:40PM +0200, Roger Quadros wrote: > When vary_offset is set (e.g. test case 3), the offset is not always > zero so memcmpshow() will show the wrong offset in the print message. > To fix this we introduce a new function memcmpshowoffset() which takes > offset as a parameter and displays the right offset and use it in > the case where offset is non zero. > > The old memcmpshow() functionality is preserved by converting it into > a macro with offset preset to 0. > > Signed-off-by: Roger Quadros > --- > drivers/mtd/tests/oobtest.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c > index 4da877b..0d5e85d 100644 > --- a/drivers/mtd/tests/oobtest.c > +++ b/drivers/mtd/tests/oobtest.c > @@ -122,7 +122,8 @@ static int write_whole_device(void) > * Display the address, offset and data bytes at comparison failure. > * Return number of bitflips encountered. > */ > -static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t count) > +static size_t memcmpshowoffset(loff_t addr, loff_t offset, const void *cs, > + const void *ct, size_t count) > { > const unsigned char *su1, *su2; > int res; > @@ -132,8 +133,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou > for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--, i++) { > res = *su1 ^ *su2; > if (res) { > - pr_info("error @addr[0x%lx:0x%x] 0x%x -> 0x%x diff 0x%x\n", > - (unsigned long)addr, i, *su1, *su2, res); > + pr_info("error @addr[0x%lx:0x%lx] 0x%x -> 0x%x diff 0x%x\n", > + (unsigned long)addr, (unsigned long)offset + i, > + *su1, *su2, res); This hunk doesn't apply. You seem to have missed this commit: commit 806b6ef5676a1c6ea78592174aae15f59bb0a923 Author: Brian Norris Date: Thu Nov 20 01:26:51 2014 -0800 mtd: oobtest: correct printf() format specifier for 'size_t' Please rebase this patch on the latest l2-mtd.git. Brian > bitflips += hweight8(res); > } > } > @@ -141,6 +143,9 @@ static size_t memcmpshow(loff_t addr, const void *cs, const void *ct, size_t cou > return bitflips; > } > > +#define memcmpshow(addr, cs, ct, count) memcmpshowoffset((addr), 0, (cs), (ct),\ > + (count)) > + > /* > * Compare with 0xff and show the address, offset and data bytes at > * comparison failure. Return number of bitflips encountered. > @@ -224,9 +229,10 @@ static int verify_eraseblock(int ebnum) > errcnt += 1; > return err ? err : -1; > } > - bitflips = memcmpshow(addr, readbuf + use_offset, > - writebuf + (use_len_max * i) + use_offset, > - use_len); > + bitflips = memcmpshowoffset(addr, use_offset, > + readbuf + use_offset, > + writebuf + (use_len_max * i) + use_offset, > + use_len); > > /* verify pre-offset area for 0xff */ > bitflips += memffshow(addr, 0, readbuf, use_offset); > -- > 2.1.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/