瀏覽代碼

arm64: dcc: simplify accessors

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>
Mark Rutland 9 年之前
父節點
當前提交
d0a69d9f38
共有 1 個文件被更改,包括 4 次插入10 次删除
  1. 4 10
      arch/arm64/include/asm/dcc.h

+ 4 - 10
arch/arm64/include/asm/dcc.h

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