Re: [PATCH 01/11] Add generic fixmap.h

From: Arnd Bergmann
Date: Tue Nov 12 2013 - 08:47:39 EST


On Tuesday 12 November 2013, Mark Salter wrote:
> Many architectures provide an asm/fixmap.h which defines support for
> compile-time 'special' virtual mappings which need to be made before
> paging_init() has run. This suport is also used for early ioremap
> on x86. Much of this support is identical across the architectures.
> This patch consolidates all of the common bits into asm-generic/fixmap.h
> which is intended to be included from arch/*/include/asm/fixmap.h.


Good idea,

Acked-by: Arnd Bergmann <arnd@xxxxxxxx>

On Tuesday 12 November 2013, Mark Salter wrote:
> +static __always_inline unsigned long fix_to_virt(const unsigned int idx)
> +{
> + /*
> + * this branch gets completely eliminated after inlining,
> + * except when someone tries to use fixaddr indices in an
> + * illegal way. (such as mixing up address types or using
> + * out-of-range indices).
> + *
> + * If it doesn't get removed, the linker will complain
> + * loudly with a reasonably clear error message..
> + */
> + if (idx >= __end_of_fixed_addresses)
> + __this_fixmap_does_not_exist();
> +

You might be able to turn this into the more readable BUILD_BUG_ON().

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