* [PATCH v2] mtd: mtd_oobtest: Fix the address offset with vary_offset case
@ 2015-07-08 11:50 Roger Quadros
2015-08-28 17:18 ` Brian Norris
0 siblings, 1 reply; 2+ messages in thread
From: Roger Quadros @ 2015-07-08 11:50 UTC (permalink / raw)
To: computersforpeace, dwmw2
Cc: akinobu.mita, linux-mtd, linux-kernel, Roger Quadros
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 <rogerq@ti.com>
---
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 8e8525f..3176212 100644
--- a/drivers/mtd/tests/oobtest.c
+++ b/drivers/mtd/tests/oobtest.c
@@ -125,7 +125,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;
@@ -135,8 +136,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%zx] 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);
bitflips += hweight8(res);
}
}
@@ -144,6 +146,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.
@@ -228,9 +233,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.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mtd: mtd_oobtest: Fix the address offset with vary_offset case
2015-07-08 11:50 [PATCH v2] mtd: mtd_oobtest: Fix the address offset with vary_offset case Roger Quadros
@ 2015-08-28 17:18 ` Brian Norris
0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2015-08-28 17:18 UTC (permalink / raw)
To: Roger Quadros; +Cc: dwmw2, akinobu.mita, linux-mtd, linux-kernel
On Wed, Jul 08, 2015 at 02:50:19PM +0300, 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 <rogerq@ti.com>
Applied to l2-mtd.git. Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-28 17:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08 11:50 [PATCH v2] mtd: mtd_oobtest: Fix the address offset with vary_offset case Roger Quadros
2015-08-28 17:18 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).