summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorRasmus Villemoes <[email protected]>2025-08-22 20:18:48 +0200
committerTom Rini <[email protected]>2025-09-02 14:11:36 -0600
commit42529beba5a262992b53893477e0de646c1754b6 (patch)
tree1f213d7c6998c37b15e45b2a66ecc341ae8f1fec /cmd
parent835915bb7d2b76d7e422b6d60628a0f7cef30ddb (diff)
memtest: remove use of vu_long typedef in mem_test_alt
Hiding a qualifier such as "volatile" inside a typedef makes the code much harder to understand. Since addr and dummy being volatile-qualified are important for the correctness of the test code, make it more obvious by spelling it out as "volatile ulong". Signed-off-by: Rasmus Villemoes <[email protected]> Tested-by: Anshul Dalal <[email protected]>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mem.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd/mem.c b/cmd/mem.c
index b67368dfba5..d5d7ca2790b 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -712,10 +712,10 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc,
#endif /* CONFIG_LOOPW */
#ifdef CONFIG_CMD_MEMTEST
-static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
- vu_long *dummy)
+static ulong mem_test_alt(volatile ulong *buf, ulong start_addr, ulong end_addr,
+ volatile ulong *dummy)
{
- vu_long *addr;
+ volatile ulong *addr;
ulong errs = 0;
ulong val, readback;
int j;
@@ -735,7 +735,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
/* Rate-limit schedule() calls to one for every 256 words. */
u8 count = 0;
- num_words = (end_addr - start_addr) / sizeof(vu_long);
+ num_words = (end_addr - start_addr) / sizeof(ulong);
/*
* Data line test: write a pattern to the first
@@ -817,8 +817,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
*
* Returns: 0 if the test succeeds, 1 if the test fails.
*/
- pattern = (vu_long)0xaaaaaaaaaaaaaaaa;
- anti_pattern = (vu_long)0x5555555555555555;
+ pattern = (ulong)0xaaaaaaaaaaaaaaaa;
+ anti_pattern = (ulong)0x5555555555555555;
debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
/*
@@ -839,7 +839,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
if (temp != pattern) {
printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx\n",
- start_addr + offset*sizeof(vu_long),
+ start_addr + offset*sizeof(ulong),
pattern, temp);
errs++;
if (ctrlc())
@@ -861,7 +861,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
printf("\nFAILURE: Address bit stuck low or"
" shorted @ 0x%.8lx: expected 0x%.8lx,"
" actual 0x%.8lx\n",
- start_addr + offset*sizeof(vu_long),
+ start_addr + offset*sizeof(ulong),
pattern, temp);
errs++;
if (ctrlc())
@@ -904,7 +904,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
if (temp != pattern) {
printf("\nFAILURE (read/write) @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx)\n",
- start_addr + offset*sizeof(vu_long),
+ start_addr + offset*sizeof(ulong),
pattern, temp);
errs++;
if (ctrlc())
@@ -926,7 +926,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
if (temp != anti_pattern) {
printf("\nFAILURE (read/write): @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx)\n",
- start_addr + offset*sizeof(vu_long),
+ start_addr + offset*sizeof(ulong),
anti_pattern, temp);
errs++;
if (ctrlc())