Re: include/linux: Add missing include / fix build failure

From: Axel
Date: Thu Dec 16 2010 - 05:46:34 EST


On 12æ16æ, äå7æ50å, Peter HÃwe <PeterHu...@xxxxxx> wrote:
> From: Peter Huewe <peterhu...@xxxxxx>
>
> This patch fixes a build failure[1-2] by adding the missing asm/memory.h
> include needed for arch_is_coherent().
>
> Error message:
> In file included from include/linux/list_bl.h:5,
> Â Â Â Â Â Â Â Â Âfrom include/linux/rculist_bl.h:7,
> Â Â Â Â Â Â Â Â Âfrom include/linux/dcache.h:7,
> Â Â Â Â Â Â Â Â Âfrom include/linux/fs.h:381,
> Â Â Â Â Â Â Â Â Âfrom arch/arm/mm/mmap.c:4:
> include/linux/bit_spinlock.h: In function 'bit_spin_unlock':
> include/linux/bit_spinlock.h:61: error: implicit declaration of function
> 'arch_is_coherent'
>
> KernelVersion: linux-next-20101215
> Used configs: hackkit_defconfig (arm), ep93xx_defconfig (arm)
>
> References:
> [1]http://kisskb.ellerman.id.au/kisskb/buildresult/3651495/
> [2]http://kisskb.ellerman.id.au/kisskb/buildresult/3651425/
>
> Signed-off-by: Peter Huewe <peterhu...@xxxxxx>
> ---
> v2:
> moved additional information in the commit message.
>
> Âinclude/linux/bit_spinlock.h | Â Â1 +
> Â1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
> index e612575..053fad7 100644
> --- a/include/linux/bit_spinlock.h
> +++ b/include/linux/bit_spinlock.h
> @@ -4,6 +4,7 @@
> Â#include <linux/kernel.h>
> Â#include <linux/preempt.h>
> Â#include <asm/atomic.h>
> +#include <asm/memory.h>
>
> Â/*
> Â * Âbit-based spin_lock()
> --
> 1.7.2.2
>
> --

hi Peter,
After apply the patch,
I got below error message while
# make i386_defconfig;make

CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CC init/main.o
In file included from include/linux/list_bl.h:5,
from include/linux/rculist_bl.h:7,
from include/linux/dcache.h:7,
from include/linux/fs.h:381,
from include/linux/proc_fs.h:5,
from init/main.c:14:
include/linux/bit_spinlock.h:7:24: error: asm/memory.h: No such file
or directory
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2

I personally fix it by below patch now, but I'm not so sure if this is
a good way to fix it.

git diff arch/arm/include/asm/system.h
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/
system.h
index ec4327a..3222ab8 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -155,6 +155,7 @@ extern unsigned int user_debug;
#define rmb() dmb()
#define wmb() mb()
#else
+#include <asm/memory.h>
#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); }
while (0)
#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); }
while (0)
#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); }
while (0)

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