aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/dscr/dscr.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/powerpc/dscr/dscr.h')
-rw-r--r--tools/testing/selftests/powerpc/dscr/dscr.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/tools/testing/selftests/powerpc/dscr/dscr.h b/tools/testing/selftests/powerpc/dscr/dscr.h
index aaa2b0d89f7e..2c54998d4715 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr.h
+++ b/tools/testing/selftests/powerpc/dscr/dscr.h
@@ -65,26 +65,21 @@ inline void set_dscr_usr(unsigned long val)
unsigned long get_default_dscr(void)
{
int err;
- char buf[16] = {0};
unsigned long val;
- err = read_file(DSCR_DEFAULT, buf, sizeof(buf) - 1, NULL);
+ err = read_ulong(DSCR_DEFAULT, &val, 16);
if (err) {
perror("read() failed");
exit(1);
}
- sscanf(buf, "%lx", &val);
return val;
}
void set_default_dscr(unsigned long val)
{
int err;
- char buf[16];
- sprintf(buf, "%lx\n", val);
-
- err = write_file(DSCR_DEFAULT, buf, strlen(buf));
+ err = write_ulong(DSCR_DEFAULT, val, 16);
if (err) {
perror("write() failed");
exit(1);