[RFC PATCH 0/5] Fix Thumb-2 undef handling for mixed-arch kernels

Nicolas Pitre nicolas.pitre at linaro.org
Mon Aug 15 19:13:35 EDT 2011


On Thu, 11 Aug 2011, Dave Martin wrote:

> On Wed, Aug 10, 2011 at 12:31:37PM +0100, Tixy wrote:
> > An alternative to defend against this is to make cpu_architecture() an
> > inline function returning the value of the global variable like:
> > 
> > inline int cpu_architecture(void)
> > {
> > 	BUG_ON(the_cpu_architecture == CPU_ARCH_UNKNOWN);
> > 	return the_cpu_architecture;
> > }
> > 
> > This has the bonus of not needing to change users of the the function.
> 
> Sounds like a good idea.  I got rid of the function because I didn't like
> calling a function from the undef handler entry code, but an inline
> function which just reads the variable seems like the best of both worlds.

While at it, you could mark the function with __attribute__((pure)).


Nicolas



More information about the linux-arm-kernel mailing list