Re: [PATCH 1/3] jump_label: Allow asm/jump_label.h to be included in assembly

From: Will Deacon
Date: Wed Jan 07 2015 - 06:30:25 EST


On Wed, Jan 07, 2015 at 10:35:56AM +0000, Anton Blanchard wrote:
> Wrap asm/jump_label.h for all archs with #ifndef __ASSEMBLY__.
> Since these are kernel only headers, we don't need #ifdef __KERNEL__
> so can simplify things a bit.
>
> If an architecture wants to use jump labels in assembly, it
> will still need to define a macro to create the __jump_table
> entries (see ARCH_STATIC_BRANCH in the powerpc asm/jump_label.h
> for an example).
>
> Signed-off-by: Anton Blanchard <anton@xxxxxxxxx>
> ---
> arch/arm/include/asm/jump_label.h | 5 ++---
> arch/arm64/include/asm/jump_label.h | 8 ++++----
> arch/mips/include/asm/jump_label.h | 7 +++----
> arch/s390/include/asm/jump_label.h | 3 +++
> arch/sparc/include/asm/jump_label.h | 5 ++---
> arch/x86/include/asm/jump_label.h | 5 ++---
> 6 files changed, 16 insertions(+), 17 deletions(-)

[...]

> diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h
> index 076a1c7..c0e5165 100644
> --- a/arch/arm64/include/asm/jump_label.h
> +++ b/arch/arm64/include/asm/jump_label.h
> @@ -18,11 +18,12 @@
> */
> #ifndef __ASM_JUMP_LABEL_H
> #define __ASM_JUMP_LABEL_H
> +
> +#ifndef __ASSEMBLY__
> +
> #include <linux/types.h>
> #include <asm/insn.h>
>
> -#ifdef __KERNEL__
> -
> #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
>
> static __always_inline bool arch_static_branch(struct static_key *key)
> @@ -39,8 +40,6 @@ l_yes:
> return true;
> }
>
> -#endif /* __KERNEL__ */
> -
> typedef u64 jump_label_t;
>
> struct jump_entry {
> @@ -49,4 +48,5 @@ struct jump_entry {
> jump_label_t key;
> };
>
> +#endif /* __ASSEMBLY__ */
> #endif /* __ASM_JUMP_LABEL_H */

The arm64 bit looks fine to me:

Acked-by: Will Deacon <will.deacon@xxxxxxx>

Will
--
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/