--- /dev/null
+From: Jeff Mahoney <jeffm@suse.com>
+Subject: [PATCH] kbuild: Properly handle arch/$arch/include/asm
+References: bnc#427473
+
+ Some architectures have moved include/asm-$arch to arch/$arch/include/asm,
+ but were still placing new files in include/asm-$arch. This causes build
+ problems with out-of-tree modules.
+
+ This patch properly handles the new locations.
+
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+---
+ Makefile | 23 +++++++++++++++--------
+ arch/ia64/Makefile | 2 +-
+ arch/ia64/include/asm/irq.h | 2 +-
+ arch/ia64/kernel/Makefile | 6 +++---
+ 4 files changed, 20 insertions(+), 13 deletions(-)
+
+--- a/arch/ia64/include/asm/irq.h
++++ b/arch/ia64/include/asm/irq.h
+@@ -13,7 +13,7 @@
+
+ #include <linux/types.h>
+ #include <linux/cpumask.h>
+-#include <asm-ia64/nr-irqs.h>
++#include <asm/nr-irqs.h>
+
+ static __inline__ int
+ irq_canonicalize (int irq)
+--- a/arch/ia64/kernel/Makefile
++++ b/arch/ia64/kernel/Makefile
+@@ -96,15 +96,15 @@ endef
+
+ # We use internal kbuild rules to avoid the "is up to date" message from make
+ arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c \
+- $(wildcard $(srctree)/include/asm-ia64/*/irq.h)
++ $(wildcard $(srctree)/arch/ia64/include/asm/*/irq.h)
+ $(Q)mkdir -p $(dir $@)
+ $(call if_changed_dep,cc_s_c)
+
+-include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
++arch/ia64/include/asm/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
+ $(Q)mkdir -p $(dir $@)
+ $(call cmd,nr_irqs)
+
+-clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
++clean-files += $(objtree)/arch/ia64/include/asm/nr-irqs.h
+
+ #
+ # native ivt.S and entry.S
+--- a/arch/ia64/Makefile
++++ b/arch/ia64/Makefile
+@@ -105,4 +105,4 @@ archprepare: make_nr_irqs_h FORCE
+ PHONY += make_nr_irqs_h FORCE
+
+ make_nr_irqs_h: FORCE
+- $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h
++ $(Q)$(MAKE) $(build)=arch/ia64/kernel arch/ia64/include/asm/nr-irqs.h
+--- a/Makefile
++++ b/Makefile
+@@ -968,8 +968,10 @@ define check-symlink
+ set -e; \
+ if [ -L include/asm ]; then \
+ asmlink=`readlink include/asm | cut -d '-' -f 2`; \
+- if [ "$$asmlink" != "$(SRCARCH)" ]; then \
+- echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
++ archlink=`readlink include/asm | cut -d '/' -f 3`; \
++ if [ "$$asmlink" != "$(SRCARCH)" -a \
++ "$$archlink" != "$(SRCARCH)" ]; then \
++ echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) or ../arch/$(SRCARCH)/include/asm was expected"; \
+ echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
+ exit 1; \
+ fi; \
+@@ -980,12 +982,18 @@ endef
+ # not exist so the test in chack-symlink works and we have a
+ # directory for generated filesas used by some architectures.
+ define create-symlink
+- if [ ! -L include/asm ]; then \
+- echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
+- if [ ! -d include/asm-$(SRCARCH) ]; then \
+- mkdir -p include/asm-$(SRCARCH); \
+- fi; \
+- ln -fsn asm-$(SRCARCH) $@; \
++ if [ ! -L include/asm ]; then \
++ if [ -d $(srctree)/arch/$(SRCARCH)/include/asm ]; then \
++ echo ' SYMLINK $@ -> arch/$(SRCARCH)/include/asm'; \
++ mkdir -p arch/$(SRCARCH)/include/asm; \
++ ln -fsn ../arch/$(SRCARCH)/include/asm $@; \
++ else \
++ echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
++ if [ ! -d include/asm-$(SRCARCH) ]; then \
++ mkdir -p include/asm-$(SRCARCH); \
++ fi; \
++ ln -fsn asm-$(SRCARCH) $@; \
++ fi; \
+ fi
+ endef
+