From: Marcel Hellwig <git@cookiesoft.de>
To: barebox@lists.infradead.org
Subject: [PATCH] common: memtest: Allow memtest to be interrupted
Date: Wed, 17 Feb 2021 15:27:44 +0100 [thread overview]
Message-ID: <20210217142744.3166-1-git@cookiesoft.de> (raw)
This change will allow the user to interrupt a running memtest, as well
as poller to run in the background. This makes it possible to let a led
blink while doing a memtest to indicate process.
Signed-off-by: Marcel Hellwig <git@cookiesoft.de>
---
common/memtest.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/common/memtest.c b/common/memtest.c
index d47e4a672..0834f344e 100644
--- a/common/memtest.c
+++ b/common/memtest.c
@@ -390,6 +390,8 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
if (ret)
return ret;
start[offset] = offset + 1;
+ if (ctrlc())
+ return -EINTR;
}
/* Check each location and invert it for the second pass */
@@ -409,6 +411,8 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
anti_pattern = ~(offset + 1);
start[offset] = anti_pattern;
+ if (ctrlc())
+ return -EINTR;
}
/* Check each location for the inverted pattern and zero it */
@@ -429,6 +433,8 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
}
start[offset] = 0;
+ if (ctrlc())
+ return -EINTR;
}
show_progress(3 * num_words);
--
2.25.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2021-02-17 14:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210217142744.3166-1-git@cookiesoft.de \
--to=git@cookiesoft.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox