[PATCH 07/20] x86/alternative: Remove operand numbering restrictions

From: Josh Poimboeuf
Date: Fri Mar 14 2025 - 17:49:01 EST


alternative_input() and alternative_io() arbitrarily require input
constraint operand numbering to start at index 1. No more callers rely
on that. Simplify the interfaces by removing that restriction.

Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
arch/x86/include/asm/alternative.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 484dfea35aaa..3804b82cb03c 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -214,17 +214,15 @@ static inline int alternatives_text_reserved(void *start, void *end)
*
* Peculiarities:
* No memory clobber here.
- * Argument numbers start with 1.
- * Leaving an unused argument 0 to keep API compatibility.
*/
#define alternative_input(oldinstr, newinstr, ft_flags, input...) \
asm_inline volatile(ALTERNATIVE(oldinstr, newinstr, ft_flags) \
- : : "i" (0), ## input)
+ : : input)

/* Like alternative_input, but with a single output argument */
#define alternative_io(oldinstr, newinstr, ft_flags, output, input...) \
asm_inline volatile(ALTERNATIVE(oldinstr, newinstr, ft_flags) \
- : output : "i" (0), ## input)
+ : output : input)

/*
* Like alternative_io, but for replacing a direct call with another one.
--
2.48.1