Re: [GIT PULL] x86: cleanup alternative.h

From: Ingo Molnar
Date: Tue Apr 28 2009 - 10:59:20 EST



* Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx> wrote:

> Ingo, do you think the cleanup below would be worth merging ? It
> adds the ability to use ALTERNATIVE() directly in gcc inline
> assembly _and_ cleans up the current alternative*() cut-and-paste
> coding style. :)

Sure it's worth it! Your patch removes quite a bit of code:

1 file changed, 22 insertions(+), 36 deletions(-)

One small style detail:

> +/* alternative assembly primitive */
> +#define ALTERNATIVE(oldinstr, newinstr, feature) \
> + "661:\n\t" oldinstr "\n662:\n" \
> + ".section .altinstructions,\"a\"\n" \
> + _ASM_ALIGN "\n" \
> + _ASM_PTR "661b\n" /* label */ \
> + _ASM_PTR "663f\n" /* new instruction */ \
> + " .byte " __stringify(feature) "\n" /* feature bit */ \
> + " .byte 662b-661b\n" /* sourcelen */ \
> + " .byte 664f-663f\n" /* replacementlen */ \
> + ".previous\n" \
> + ".section .altinstr_replacement,\"ax\"\n" \
> + "663:\n\t" newinstr "\n664:\n" /* replacement */ \
> + ".previous"

Please try to align both the continuation backslashes and the
comments vertically. Something like:

> +#define ALTERNATIVE(oldinstr, newinstr, feature) \
> + \
> + "661:\n\t" oldinstr "\n662:\n" \
> + ".section .altinstructions,\"a\"\n" \
> + _ASM_ALIGN "\n" \
> + _ASM_PTR "661b\n" /* label */ \
> + _ASM_PTR "663f\n" /* new instruction */ \
> + " .byte " __stringify(feature) "\n" /* feature bit */ \
> + " .byte 662b-661b\n" /* sourcelen */ \
> + " .byte 664f-663f\n" /* replacementlen */ \

... should do the trick. (also note the extra line after the #define)

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/