arm64: dcc: simplify accessors
authorMark Rutland <mark.rutland@arm.com>
Thu, 8 Sep 2016 12:55:36 +0000 (13:55 +0100)
committerWill Deacon <will.deacon@arm.com>
Fri, 9 Sep 2016 10:41:13 +0000 (11:41 +0100)
A while back we added {read,write}_sysreg accessors to handle accesses
to system registers, without the usual boilerplate asm volatile,
temporary variable, etc.

This patch makes use of these in the arm64 DCC accessors to make the
code shorter and clearer.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/dcc.h

index 65e0190..836b056 100644 (file)
 #define __ASM_DCC_H
 
 #include <asm/barrier.h>
+#include <asm/sysreg.h>
 
 static inline u32 __dcc_getstatus(void)
 {
-       u32 ret;
-
-       asm volatile("mrs %0, mdccsr_el0" : "=r" (ret));
-
-       return ret;
+       return read_sysreg(mdccsr_el0);
 }
 
 static inline char __dcc_getchar(void)
 {
-       char c;
-
-       asm volatile("mrs %0, dbgdtrrx_el0" : "=r" (c));
+       char c = read_sysreg(dbgdtrrx_el0);
        isb();
 
        return c;
@@ -47,8 +42,7 @@ static inline void __dcc_putchar(char c)
         * The typecast is to make absolutely certain that 'c' is
         * zero-extended.
         */
-       asm volatile("msr dbgdtrtx_el0, %0"
-                       : : "r" ((unsigned long)(unsigned char)c));
+       write_sysreg((unsigned char)c, dbgdtrtx_el0);
        isb();
 }