diff mbox series

[kvm-unit-tests,v1,08/10] s390x: gs: turn off formatter for inline assembly

Message ID 20231106125352.859992-9-nrb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series RFC: Add clang-format and kerneldoc check | expand

Commit Message

Nico Boehr Nov. 6, 2023, 12:51 p.m. UTC
clang-format does not properly understand the code and aligns the first
opening quote on consecutive lines with the last opening quote on the
previous line like so:

" some string " CONCATED_WITH_MACRO " continues here "
                                    " weird indent for some reason"

Disable clang-format for this block of code and properly align the
indented asm with the opening parenthesis.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 s390x/gs.c | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/s390x/gs.c b/s390x/gs.c
index 9ae893eaf89a..7e08c2a78d32 100644
--- a/s390x/gs.c
+++ b/s390x/gs.c
@@ -35,28 +35,30 @@  static inline unsigned long load_guarded(unsigned long *p)
 }
 
 /* guarded-storage event handler and finally it calls gs_handler */
+/* clang-format off */
 extern void gs_handler_asm(void);
-	asm (          ".macro	STGSC	args:vararg\n"
-		"	.insn	rxy,0xe30000000049,\\args\n"
-		"	.endm\n"
-		"	.globl	gs_handler_asm\n"
-		"gs_handler_asm:\n"
-		"	lgr	%r14,%r15\n"				/* Save current stack address in r14 */
-		".Lgs_handler_frame = 16*8+32+" xstr(STACK_FRAME_SIZE) "\n"
-		"	aghi	%r15,-(.Lgs_handler_frame)\n"		/* Allocate stack frame */
-		"	stmg	%r0,%r13,192(%r15)\n"			/* Store regs to save area */
-		"	stg	%r14,312(%r15)\n"
-		"	la	%r2," xstr(STACK_FRAME_SIZE) "(%r15)\n"	/* Store gscb address in this_cb */
-		"	STGSC	%r0," xstr(STACK_FRAME_SIZE) "(%r15)\n"
-		"	lg	%r14,24(%r2)\n"				/* Get GSEPLA from GSCB*/
-		"	lg	%r14,40(%r14)\n"			/* Get GSERA from GSEPL*/
-		"	stg	%r14,304(%r15)\n"			/* Store GSERA in r14 of reg save area */
-		"	brasl	%r14,gs_handler\n"			/* Jump to gs_handler */
-		"	lmg	%r0,%r15,192(%r15)\n"			/* Restore regs */
-		"	aghi	%r14, 6\n"				/* Add lgg instr len to GSERA */
-		"	br	%r14\n"					/* Jump to next instruction after lgg */
-		".size gs_handler_asm,.-gs_handler_asm\n"
-	);
+asm (".macro	STGSC	args:vararg\n"
+     "	.insn	rxy,0xe30000000049,\\args\n"
+     "	.endm\n"
+     "	.globl	gs_handler_asm\n"
+     "gs_handler_asm:\n"
+     "	lgr	%r14,%r15\n"				/* Save current stack address in r14 */
+     ".Lgs_handler_frame = 16*8+32+" xstr(STACK_FRAME_SIZE) "\n"
+     "	aghi	%r15,-(.Lgs_handler_frame)\n"		/* Allocate stack frame */
+     "	stmg	%r0,%r13,192(%r15)\n"			/* Store regs to save area */
+     "	stg	%r14,312(%r15)\n"
+     "	la	%r2," xstr(STACK_FRAME_SIZE) "(%r15)\n"	/* Store gscb address in this_cb */
+     "	STGSC	%r0," xstr(STACK_FRAME_SIZE) "(%r15)\n"
+     "	lg	%r14,24(%r2)\n"				/* Get GSEPLA from GSCB*/
+     "	lg	%r14,40(%r14)\n"			/* Get GSERA from GSEPL*/
+     "	stg	%r14,304(%r15)\n"			/* Store GSERA in r14 of reg save area */
+     "	brasl	%r14,gs_handler\n"			/* Jump to gs_handler */
+     "	lmg	%r0,%r15,192(%r15)\n"			/* Restore regs */
+     "	aghi	%r14, 6\n"				/* Add lgg instr len to GSERA */
+     "	br	%r14\n"					/* Jump to next instruction after lgg */
+     ".size gs_handler_asm,.-gs_handler_asm\n"
+);
+/* clang-format on */
 
 void gs_handler(struct gs_cb *this_cb)
 {