summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/pmu
diff options
context:
space:
mode:
authorBenjamin Gray <bgray@linux.ibm.com>2023-02-03 11:39:46 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2023-02-09 23:56:45 +1100
commit5c20de57888f0962e25a0eeec1a59c98056fc42e (patch)
tree94d8ed4b5dedaeb221761e8693ff1399f2fd7af7 /tools/testing/selftests/powerpc/pmu
parentd1bc05b7bf02f8635fe6c445f67d78f85234cbb7 (diff)
downloadlwn-5c20de57888f0962e25a0eeec1a59c98056fc42e.tar.gz
lwn-5c20de57888f0962e25a0eeec1a59c98056fc42e.zip
selftests/powerpc: Add {read,write}_{long,ulong}
Add helper functions to read and write (unsigned) long values directly from/to files. One of the kernel interfaces uses hex strings, so we need to allow passing a base too. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20230203003947.38033-5-bgray@linux.ibm.com
Diffstat (limited to 'tools/testing/selftests/powerpc/pmu')
-rw-r--r--tools/testing/selftests/powerpc/pmu/lib.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/lib.c b/tools/testing/selftests/powerpc/pmu/lib.c
index 1cfc13a25aee..719f94f10d41 100644
--- a/tools/testing/selftests/powerpc/pmu/lib.c
+++ b/tools/testing/selftests/powerpc/pmu/lib.c
@@ -192,15 +192,8 @@ bool require_paranoia_below(int level)
{
int err;
long current;
- char buf[16] = {0};
- err = read_file(PARANOID_PATH, buf, sizeof(buf) - 1, NULL);
- if (err) {
- printf("Couldn't read " PARANOID_PATH "?\n");
- return false;
- }
-
- err = parse_long(buf, sizeof(buf), &current, 10);
+ err = read_long(PARANOID_PATH, &current, 10);
if (err) {
printf("Couldn't parse " PARANOID_PATH "?\n");
return false;