ARM: mx51: Fix build error due to missing include of <linux/bug.h>
Subsystems (3)
PATCH 1/1 ARM: mx51: Fix build error due to missing include of <linux/bug.h>
Fix the following build error:
arch/arm/mach-imx/cpu_op-mx51.c: In function 'mx51_get_cpu_op':arch/arm/mach-imx/cpu_op-mx51.c:27: error: implicit declaration of function 'BUILD_BUG_ON_ZERO'
---
This applies against linux-next
arch/arm/mach-imx/cpu_op-mx51.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-imx/cpu_op-mx51.c +1 -0
@@ -14,6 +14,7 @@#include <linux/types.h> #include <mach/hardware.h> #include <linux/kernel.h> +#include <linux/bug.h> static struct cpu_op mx51_cpu_op[] = { {
Signature · 1 line
1.7.1
PATCH 1/1 ARM: mx51: Fix build error due to missing include of <linux/bug.h>
Quoted 4 lines · Fabio Estevam
Fix the following build error:
arch/arm/mach-imx/cpu_op-mx51.c: In function 'mx51_get_cpu_op':arch/arm/mach-imx/cpu_op-mx51.c:27: error: implicit declaration of function 'BUILD_BUG_ON_ZERO'
I think having the asm/bug.h replaced with linux/bug.h in linux/kernel.h would be a better solution.
Quoted 29 lines
Signed-off-by Fabio Estevam <[email protected]>---
This applies against linux-nextarch/arm/mach-imx/cpu_op-mx51.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)arch/arm/mach-imx/cpu_op-mx51.c +1
-0@@ -14,6 +14,7 @@#include <linux/types.h> #include <mach/hardware.h> #include <linux/kernel.h> +#include <linux/bug.h> static struct cpu_op mx51_cpu_op[] = { {Signature · 8 lines
1.7.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Fabio Estevam
reviewerPATCH 1/1 ARM: mx51: Fix build error due to missing include of <linux/bug.h>
Quoted 2 lines · Russell King - ARM Linux
I think having the
asm/bug.hreplaced withlinux/bug.hinlinux/kernel.hwould be a better solution.
commit 6f863554 (kernel.h: doesn't explicitly use bug.h, so don't include it. ), which appears in linux-next, has removed asm/debug.h from linux/kernel.h.
I should have pointed this commit ID in my commit log.
Regards,
Fabio Estevam
PATCH 1/1 ARM: mx51: Fix build error due to missing include of <linux/bug.h>
Quoted 11 lines · Fabio Estevam
Quoted 2 lines · Russell King - ARM Linux
I think having the
asm/bug.hreplaced withlinux/bug.hinlinux/kernel.hwould be a better solution.commit
6f863554(kernel.h: doesn't explicitly usebug.h, so don't include it. ), which appears in linux-next, has removedasm/debug.hfromlinux/kernel.h.I should have pointed this commit ID in my commit log.
No, this is not a fix, and it probably makes things worse.
linux/kernel.h _does_ use bug stuff - in ARRAY_SIZE().
ARRAY_SIZE() uses __must_be_array(), which is defined in linux/compiler-gcc.h, which is obtained via linux/compiler.h and linux/linkage.h.
linux/compiler-gcc.h defines __must_be_array() to be:
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
and BUILD_BUG_ON_ZERO used to be in linux/kernel.h but got moved to linux/bug.h.
Hence why people are seeing build breakage with ARRAY_SIZE().
The answer is not to start scattering lots of .c files with linux/bug.h includes, but to fix linux/kernel.h.
Fabio Estevam
reviewerPATCH 1/1 ARM: mx51: Fix build error due to missing include of <linux/bug.h>
Quoted 24 lines · Russell King - ARM Linux
Quoted 11 lines · Fabio Estevam
Quoted 2 lines · Russell King - ARM Linux
I think having the
asm/bug.hreplaced withlinux/bug.hinlinux/kernel.hwould be a better solution.commit
6f863554(kernel.h: doesn't explicitly usebug.h, so don't include it. ), which appears in linux-next, has removedasm/debug.hfromlinux/kernel.h.I should have pointed this commit ID in my commit log.
No, this is not a fix, and it probably makes things worse.
linux/kernel.h_does_ use bug stuff - inARRAY_SIZE().
ARRAY_SIZE()uses__must_be_array(), which is defined inlinux/compiler-gcc.h,
which is obtained vialinux/compiler.handlinux/linkage.h.
linux/compiler-gcc.hdefines__must_be_array()to be:
#define__must_be_array(a)BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
Quoted 7 lines
and
BUILD_BUG_ON_ZEROused to be inlinux/kernel.hbut got moved tolinux/bug.h.Hence why people are seeing build breakage with
ARRAY_SIZE().The answer is not to start scattering lots of .c files with
linux/bug.hincludes, but to fixlinux/kernel.h.
This makes sense, thanks.
Will submit a patch for lkml shortly.
PATCH 1/1 ARM: mx51: Fix build error due to missing include of <linux/bug.h>
In reply to Russell King - ARM Linux[Re: [PATCH] ARM: mx51: Fix build error due to missing include of <linux/bug.h>] On 28/02/2012 (Tue 13:21) Russell King - ARM Linux wrote:
[...]
Quoted 2 lines
The answer is not to start scattering lots of .c files with
linux/bug.hincludes, but to fixlinux/kernel.h.
Hi Russell,
I understand your concerns, and had I found myself "buggering" lots of .c files, I would have backed away and said to myself, "OK, this really isn't going to work - we really can't do this."
But to put some metrics to it, after building for about 10 different arch and all their defconfigs, I only had to change about twenty[1] of the approximately sixteen thousand .c files in the kernel. That is about 0.125% -- which is one of the things that made me think "Hey, we
can really do this cleanup!" Including this file, there were only
two .c files in all of arch/arm that were using bug somehow.
So I think having kernel.h not require bug.h is completely do-able. But in the end, I'm not welded to the idea. I think it is a win, but I'm not going to kick up a big stink if Linus or Andrew say they don't think it is of value, and would rather not rock the boat.
Thanks,
Paul.
--
PATCH 1/1 ARM: mx51: Fix build error due to missing include of <linux/bug.h>
Quoted 9 lines · Paul Gortmaker
[Re: [PATCH] ARM: mx51: Fix build error due to missing include of <
linux/bug.h>] On 28/02/2012 (Tue 13:21) Russell King - ARM Linux wrote:[...]
Quoted 2 lines
The answer is not to start scattering lots of .c files with
linux/bug.hincludes, but to fixlinux/kernel.h.Hi Russell,
Quoted 7 lines
I understand your concerns, and had I found myself "buggering" lots of .c files, I would have backed away and said to myself, "OK, this really isn't going to work - we really can't do this."
But to put some metrics to it, after building for about 10 different arch and all their defconfigs, I only had to change about twenty[1] of the approximately sixteen thousand .c files in the kernel.
I think there's more than that - I've seen two reports for other files which have needed fixing so far, and I wouldn't be surprised if there's more.
I guess we'll see in coming weeks how it pans out, but my gut feeling is that this is going to cause a fair number of build problems.