* [PATCH 00/11] arch/arm and other random cleanups @ 2010-02-16 14:46 Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 01/11] arm/Kconfig: delete trailing whitespace Marc Kleine-Budde 2010-02-16 14:54 ` [PATCH 00/11] arch/arm and other random cleanups Marc Kleine-Budde 0 siblings, 2 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Hey, while working on the PXA270 port these cleanups and updates of header files piled up. The PXA270 series I'm about to post depends on these patches. Please review and consider to apply. Cheers, Marc _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/11] arm/Kconfig: delete trailing whitespace 2010-02-16 14:46 [PATCH 00/11] arch/arm and other random cleanups Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 02/11] arm/Kconfig: removed unused TAG options Marc Kleine-Budde 2010-02-16 14:54 ` [PATCH 00/11] arch/arm and other random cleanups Marc Kleine-Budde 1 sibling, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9cad224..d4df14d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -80,7 +80,7 @@ config CMD_ARM_CPUINFO help Say yes here to get a cpuinfo command to show some information about the cp15 registers - + config CMDLINE_TAG bool "Send commandline to kernel" default y -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 02/11] arm/Kconfig: removed unused TAG options 2010-02-16 14:46 ` [PATCH 01/11] arm/Kconfig: delete trailing whitespace Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 03/11] arm/Makefile: keep list of boards sorted Marc Kleine-Budde 0 siblings, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha The tags for the command line parameters are not used, so let's remove them: - CMDLINE_TAG - SETUP_MEMORY_TAGS - INITRD_TAG Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/Kconfig | 19 ------------------- 1 files changed, 0 insertions(+), 19 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d4df14d..92ec417 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -81,25 +81,6 @@ config CMD_ARM_CPUINFO Say yes here to get a cpuinfo command to show some information about the cp15 registers -config CMDLINE_TAG - bool "Send commandline to kernel" - default y - help - If you want to start a 2.6 kernel say y here. - -config SETUP_MEMORY_TAGS - bool "send memory definition to kernel" - default y - help - If you want to start a 2.6 kernel say y here. - -config INITRD_TAG - bool "send initrd params to kernel" - default y - help - If you want to start a 2.6 kernel and use an - initrd image say y here. - config CPU_V7_DCACHE_SKIP bool "Skip DCache Invlidate" depends on CPU_V7 -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 03/11] arm/Makefile: keep list of boards sorted 2010-02-16 14:46 ` [PATCH 02/11] arm/Kconfig: removed unused TAG options Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 04/11] arm/cpu/Makefile: cleanup: propper indention Marc Kleine-Budde 0 siblings, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index ede2085..fbbea42 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -61,8 +61,8 @@ board-$(CONFIG_MACH_EDB93012) := edb93xx board-$(CONFIG_MACH_EDB9315) := edb93xx board-$(CONFIG_MACH_EDB9315A) := edb93xx board-$(CONFIG_MACH_EUKREA_CPUIMX27) := eukrea_cpuimx27 -board-$(CONFIG_MACH_FREESCALE_MX35_3STACK) := freescale-mx35-3-stack board-$(CONFIG_MACH_FREESCALE_MX25_3STACK) := freescale-mx25-3-stack +board-$(CONFIG_MACH_FREESCALE_MX35_3STACK) := freescale-mx35-3-stack board-$(CONFIG_MACH_IMX21ADS) := imx21ads board-$(CONFIG_MACH_IMX27ADS) := imx27ads board-$(CONFIG_MACH_MMCCPU) := mmccpu -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 04/11] arm/cpu/Makefile: cleanup: propper indention 2010-02-16 14:46 ` [PATCH 03/11] arm/Makefile: keep list of boards sorted Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 05/11] drivers/video/Makefile: cleanup " Marc Kleine-Budde 0 siblings, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/cpu/Makefile | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile index 2273e45..d974af2 100644 --- a/arch/arm/cpu/Makefile +++ b/arch/arm/cpu/Makefile @@ -1,17 +1,18 @@ -obj-y += cpu.o exceptions.o -obj-y += interrupts.o +obj-y += cpu.o +obj-y += exceptions.o +obj-y += interrupts.o # # Any variants can be called as start-armxyz.S # -obj-$(CONFIG_CPU_ARM920T) += start-arm.o -obj-$(CONFIG_CPU_ARM926T) += start-arm.o -obj-$(CONFIG_CPU_V7) += start-arm.o -obj-$(CONFIG_ARCH_IMX31) += start-arm.o -obj-$(CONFIG_ARCH_IMX35) += start-arm.o -obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o -obj-$(CONFIG_MMU) += mmu.o -obj-$(CONFIG_CPU_32v4T) += cache-armv4.o -obj-$(CONFIG_CPU_32v5) += cache-armv4.o -obj-$(CONFIG_CPU_32v6) += cache-armv6.o -obj-$(CONFIG_CPU_32v7) += cache-armv7.o +obj-$(CONFIG_CPU_ARM920T) += start-arm.o +obj-$(CONFIG_CPU_ARM926T) += start-arm.o +obj-$(CONFIG_CPU_V7) += start-arm.o +obj-$(CONFIG_ARCH_IMX31) += start-arm.o +obj-$(CONFIG_ARCH_IMX35) += start-arm.o +obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o +obj-$(CONFIG_MMU) += mmu.o +obj-$(CONFIG_CPU_32v4T) += cache-armv4.o +obj-$(CONFIG_CPU_32v5) += cache-armv4.o +obj-$(CONFIG_CPU_32v6) += cache-armv6.o +obj-$(CONFIG_CPU_32v7) += cache-armv7.o -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 05/11] drivers/video/Makefile: cleanup propper indention 2010-02-16 14:46 ` [PATCH 04/11] arm/cpu/Makefile: cleanup: propper indention Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 06/11] start-arm: cleanup: " Marc Kleine-Budde 2010-02-16 20:35 ` [PATCH 05/11] drivers/video/Makefile: cleanup " Marc Kleine-Budde 0 siblings, 2 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/video/Makefile | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 1e0d1b9..45ee09e 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -1,3 +1,4 @@ -obj-$(CONFIG_VIDEO) += fb.o -obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o -obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o +obj-$(CONFIG_VIDEO) += fb.o + +obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o +obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 06/11] start-arm: cleanup: propper indention 2010-02-16 14:46 ` [PATCH 05/11] drivers/video/Makefile: cleanup " Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 07/11] i2c.h: fix typo in copyright Marc Kleine-Budde 2010-02-16 15:01 ` [PATCH 06/11] start-arm: cleanup: propper indention Uwe Kleine-König 2010-02-16 20:35 ` [PATCH 05/11] drivers/video/Makefile: cleanup " Marc Kleine-Budde 1 sibling, 2 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/cpu/start-arm.S | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/cpu/start-arm.S b/arch/arm/cpu/start-arm.S index a30b281..4d61cee 100644 --- a/arch/arm/cpu/start-arm.S +++ b/arch/arm/cpu/start-arm.S @@ -127,16 +127,16 @@ reset: msr cpsr,r0 #ifdef CONFIG_ARCH_HAS_LOWLEVEL_INIT - bl arch_init_lowlevel + bl arch_init_lowlevel #endif #ifdef CONFIG_CPU_V7 /* * Invalidate v7 I/D caches */ - mov r0, #0 /* set up for MCR */ - mcr p15, 0, r0, c8, c7, 0 /* invalidate TLBs */ - mcr p15, 0, r0, c7, c5, 0 /* invalidate icache */ + mov r0, #0 /* set up for MCR */ + mcr p15, 0, r0, c8, c7, 0 /* invalidate TLBs */ + mcr p15, 0, r0, c7, c5, 0 /* invalidate icache */ /* Invalidate all Dcaches */ #ifndef CONFIG_CPU_V7_DCACHE_SKIP /* If Arch specific ROM code SMI handling does not exist */ @@ -212,8 +212,8 @@ finished_inval: relocate: /* relocate barebox to RAM */ adr r0, _start /* r0 <- current position of code */ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ - cmp r0, r1 /* don't reloc during debug */ - beq stack_setup + cmp r0, r1 /* don't reloc during debug */ + beq stack_setup ldr r2, _barebox_start ldr r3, _bss_start -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 07/11] i2c.h: fix typo in copyright 2010-02-16 14:46 ` [PATCH 06/11] start-arm: cleanup: " Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 08/11] ioreadsb: put the whole ioreadsb function into the .text.readsb section Marc Kleine-Budde 2010-02-16 15:01 ` [PATCH 06/11] start-arm: cleanup: propper indention Uwe Kleine-König 1 sibling, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- include/i2c/i2c.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/i2c/i2c.h b/include/i2c/i2c.h index 3e9d2b4..0760fdc 100644 --- a/include/i2c/i2c.h +++ b/include/i2c/i2c.h @@ -1,7 +1,7 @@ /* * i2c.h - definitions for the barebox i2c framework * - * Copyricht (C) 2009 by Marc Kleine-Budde <mkl@pengutronix.de> + * Copyright (C) 2009 by Marc Kleine-Budde <mkl@pengutronix.de> * * This file is released under the GPLv2 * -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 08/11] ioreadsb: put the whole ioreadsb function into the .text.readsb section 2010-02-16 14:46 ` [PATCH 07/11] i2c.h: fix typo in copyright Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 09/11] import recent include/linux/compiler*.h Marc Kleine-Budde 0 siblings, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/lib/io-readsb.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/io-readsb.S b/arch/arm/lib/io-readsb.S index 9ee07b8..963c455 100644 --- a/arch/arm/lib/io-readsb.S +++ b/arch/arm/lib/io-readsb.S @@ -10,6 +10,8 @@ #include <linux/linkage.h> #include <asm/assembler.h> +.section .text.readsb + .Linsb_align: rsb ip, ip, #4 cmp ip, r2 movgt ip, r2 @@ -23,8 +25,6 @@ subs r2, r2, ip bne .Linsb_aligned -.section .text.readsb - ENTRY(readsb) teq r2, #0 @ do we have to check for the zero len? moveq pc, lr -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 09/11] import recent include/linux/compiler*.h 2010-02-16 14:46 ` [PATCH 08/11] ioreadsb: put the whole ioreadsb function into the .text.readsb section Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 10/11] io.h: update definitions of __raw_{read,write}* Marc Kleine-Budde 0 siblings, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- include/linux/compiler-gcc.h | 30 +++++++++- include/linux/compiler-gcc3.h | 11 +++- include/linux/compiler-gcc4.h | 32 ++++++++++- include/linux/compiler.h | 124 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 180 insertions(+), 17 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 5c8351b..73dcf80 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -11,9 +11,19 @@ /* The "volatile" is due to gcc bugs */ #define barrier() __asm__ __volatile__("": : :"memory") -/* This macro obfuscates arithmetic on a variable address so that gcc - shouldn't recognize the original var, and make assumptions about it */ /* + * This macro obfuscates arithmetic on a variable address so that gcc + * shouldn't recognize the original var, and make assumptions about it. + * + * This is needed because the C standard makes it undefined to do + * pointer arithmetic on "objects" outside their boundaries and the + * gcc optimizers assume this is the case. In particular they + * assume such arithmetic does not wrap. + * + * A miscompilation has been observed because of this on PPC. + * To work around it we hide the relationship of the pointer and the object + * using this macro. + * * Versions of the ppc64 compiler before 4.1 had a bug where use of * RELOC_HIDE could trash r30. The bug can be worked around by changing * the inline assembly constraint from =g to =r, in this particular @@ -42,7 +52,15 @@ #define __deprecated __attribute__((deprecated)) #define __packed __attribute__((packed)) #define __weak __attribute__((weak)) -#define __naked __attribute__((naked)) + +/* + * it doesn't make sense on ARM (currently the only user of __naked) to trace + * naked functions because then mcount is called without stack and frame pointer + * being set up and there is no chance to restore the lr register to the value + * before mcount was called. + */ +#define __naked __attribute__((naked)) notrace + #define __noreturn __attribute__((noreturn)) /* @@ -61,3 +79,9 @@ #define noinline __attribute__((noinline)) #define __attribute_const__ __attribute__((__const__)) #define __maybe_unused __attribute__((unused)) +#define __always_unused __attribute__((unused)) + +#define __gcc_header(x) #x +#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) +#define gcc_header(x) _gcc_header(x) +#include gcc_header(__GNUC__) diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h index e5eb795..b721129 100644 --- a/include/linux/compiler-gcc3.h +++ b/include/linux/compiler-gcc3.h @@ -2,8 +2,9 @@ #error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead." #endif -/* These definitions are for GCC v3.x. */ -#include <linux/compiler-gcc.h> +#if __GNUC_MINOR__ < 2 +# error Sorry, your compiler is too old - please upgrade it. +#endif #if __GNUC_MINOR__ >= 3 # define __used __attribute__((__used__)) @@ -15,6 +16,12 @@ #define __must_check __attribute__((warn_unused_result)) #endif +#ifdef CONFIG_GCOV_KERNEL +# if __GNUC_MINOR__ < 4 +# error "GCOV profiling support for gcc versions below 3.4 not included" +# endif /* __GNUC_MINOR__ */ +#endif /* CONFIG_GCOV_KERNEL */ + /* * A trick to suppress uninitialized variable warning without generating any * code diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 974f5b7..94dea3f 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h @@ -2,8 +2,12 @@ #error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead." #endif -/* These definitions are for GCC v4.x. */ -#include <linux/compiler-gcc.h> +/* GCC 4.1.[01] miscompiles __weak */ +#ifdef __KERNEL__ +# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 +# error Your version of gcc miscompiles the __weak directive +# endif +#endif #define __used __attribute__((__used__)) #define __must_check __attribute__((warn_unused_result)) @@ -16,7 +20,7 @@ */ #define uninitialized_var(x) x = x -#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3) +#if __GNUC_MINOR__ >= 3 /* Mark functions as cold. gcc will assume any path leading to a call to them will be unlikely. This means a lot of manual unlikely()s are unnecessary now for any paths leading to the usual suspects @@ -32,4 +36,26 @@ the kernel context */ #define __cold __attribute__((__cold__)) + +#if __GNUC_MINOR__ >= 5 +/* + * Mark a position in code as unreachable. This can be used to + * suppress control flow warnings after asm blocks that transfer + * control elsewhere. + * + * Early snapshots of gcc 4.5 don't support this and we can't detect + * this in the preprocessor, but we can live with this because they're + * unreleased. Really, we need to have autoconf for the kernel. + */ +#define unreachable() __builtin_unreachable() +#endif + +#endif + +#if __GNUC_MINOR__ > 0 +#define __compiletime_object_size(obj) __builtin_object_size(obj, 0) +#endif +#if __GNUC_MINOR__ >= 4 +#define __compiletime_warning(message) __attribute__((warning(message))) +#define __compiletime_error(message) __attribute__((error(message))) #endif diff --git a/include/linux/compiler.h b/include/linux/compiler.h index c8bd2da..5be3dab 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -36,14 +36,12 @@ extern void __chk_io_ptr(const volatile void __iomem *); #ifdef __KERNEL__ -#if __GNUC__ >= 4 -# include <linux/compiler-gcc4.h> -#elif __GNUC__ == 3 && __GNUC_MINOR__ >= 2 -# include <linux/compiler-gcc3.h> -#else -# error Sorry, your compiler is too old/not recognized. +#ifdef __GNUC__ +#include <linux/compiler-gcc.h> #endif +#define notrace __attribute__((no_instrument_function)) + /* Intel compiler defines __GNUC__. So we will overwrite implementations * coming from above header files here */ @@ -57,14 +55,100 @@ extern void __chk_io_ptr(const volatile void __iomem *); * specific implementations come from the above header files */ -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) +struct ftrace_branch_data { + const char *func; + const char *file; + unsigned line; + union { + struct { + unsigned long correct; + unsigned long incorrect; + }; + struct { + unsigned long miss; + unsigned long hit; + }; + unsigned long miss_hit[2]; + }; +}; + +/* + * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code + * to disable branch tracing on a per file basis. + */ +#if defined(CONFIG_TRACE_BRANCH_PROFILING) \ + && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__) +void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); + +#define likely_notrace(x) __builtin_expect(!!(x), 1) +#define unlikely_notrace(x) __builtin_expect(!!(x), 0) + +#define __branch_check__(x, expect) ({ \ + int ______r; \ + static struct ftrace_branch_data \ + __attribute__((__aligned__(4))) \ + __attribute__((section("_ftrace_annotated_branch"))) \ + ______f = { \ + .func = __func__, \ + .file = __FILE__, \ + .line = __LINE__, \ + }; \ + ______r = likely_notrace(x); \ + ftrace_likely_update(&______f, ______r, expect); \ + ______r; \ + }) + +/* + * Using __builtin_constant_p(x) to ignore cases where the return + * value is always the same. This idea is taken from a similar patch + * written by Daniel Walker. + */ +# ifndef likely +# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1)) +# endif +# ifndef unlikely +# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) +# endif + +#ifdef CONFIG_PROFILE_ALL_BRANCHES +/* + * "Define 'is'", Bill Clinton + * "Define 'if'", Steven Rostedt + */ +#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) +#define __trace_if(cond) \ + if (__builtin_constant_p((cond)) ? !!(cond) : \ + ({ \ + int ______r; \ + static struct ftrace_branch_data \ + __attribute__((__aligned__(4))) \ + __attribute__((section("_ftrace_branch"))) \ + ______f = { \ + .func = __func__, \ + .file = __FILE__, \ + .line = __LINE__, \ + }; \ + ______r = !!(cond); \ + ______f.miss_hit[______r]++; \ + ______r; \ + })) +#endif /* CONFIG_PROFILE_ALL_BRANCHES */ + +#else +# define likely(x) __builtin_expect(!!(x), 1) +# define unlikely(x) __builtin_expect(!!(x), 0) +#endif /* Optimization barrier */ #ifndef barrier # define barrier() __memory_barrier() #endif +/* Unreachable code */ +#ifndef unreachable +# define unreachable() do { } while (1) +#endif + #ifndef RELOC_HIDE # define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ @@ -134,6 +218,10 @@ extern void __chk_io_ptr(const volatile void __iomem *); # define __maybe_unused /* unimplemented */ #endif +#ifndef __always_unused +# define __always_unused /* unimplemented */ +#endif + #ifndef noinline #define noinline #endif @@ -182,6 +270,22 @@ extern void __chk_io_ptr(const volatile void __iomem *); # define __section(S) __attribute__ ((__section__(#S))) #endif +/* Are two types/vars the same type (ignoring qualifiers)? */ +#ifndef __same_type +# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +#endif + +/* Compile time object size, -1 for unknown */ +#ifndef __compiletime_object_size +# define __compiletime_object_size(obj) -1 +#endif +#ifndef __compiletime_warning +# define __compiletime_warning(message) +#endif +#ifndef __compiletime_error +# define __compiletime_error(message) +#endif + /* * Prevent the compiler from merging or refetching accesses. The compiler * is also forbidden from reordering successive instances of ACCESS_ONCE(), @@ -190,7 +294,9 @@ extern void __chk_io_ptr(const volatile void __iomem *); * ACCESS_ONCE() in different C statements. * * This macro does absolutely -nothing- to prevent the CPU from reordering, - * merging, or refetching absolutely anything at any time. + * merging, or refetching absolutely anything at any time. Its main intended + * use is to mediate communication between process-level code and irq/NMI + * handlers, all running on the same CPU. */ #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 10/11] io.h: update definitions of __raw_{read,write}* 2010-02-16 14:46 ` [PATCH 09/11] import recent include/linux/compiler*.h Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 11/11] common.h: add compile time check helper functions Marc Kleine-Budde 0 siblings, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha This patch updates the definitions of the __raw_read and __raw_write functions so that "sparse" doesn't complain. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/include/asm/io.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index c7f4b62..e8e82f6 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -26,13 +26,13 @@ #ifndef __ASM_ARM_IO_H #define __ASM_ARM_IO_H -#define __raw_writeb(v,a) (*(volatile unsigned char *)(a) = (v)) -#define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v)) -#define __raw_writel(v,a) (*(volatile unsigned int *)(a) = (v)) +#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v)) +#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v)) +#define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a) = (v)) -#define __raw_readb(a) (*(volatile unsigned char *)(a)) -#define __raw_readw(a) (*(volatile unsigned short *)(a)) -#define __raw_readl(a) (*(volatile unsigned int *)(a)) +#define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a)) +#define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a)) +#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a)) #define writeb(v,a) __raw_writeb(v,a) #define writew(v,a) __raw_writew(v,a) -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 11/11] common.h: add compile time check helper functions 2010-02-16 14:46 ` [PATCH 10/11] io.h: update definitions of __raw_{read,write}* Marc Kleine-Budde @ 2010-02-16 14:46 ` Marc Kleine-Budde 0 siblings, 0 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:46 UTC (permalink / raw) To: barebox; +Cc: sha Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- include/common.h | 31 +++++++++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 2 deletions(-) diff --git a/include/common.h b/include/common.h index 2b40954..76e9be9 100644 --- a/include/common.h +++ b/include/common.h @@ -45,7 +45,7 @@ #ifdef DEBUG #define pr_debug(fmt, arg...) printf(fmt, ##arg) #else -#define pr_debug(fmt, arg...) do {} while(0) +#define pr_debug(fmt, arg...) do {} while(0) #endif #define debug(fmt, arg...) pr_debug(fmt, ##arg) @@ -138,7 +138,32 @@ int arch_execute(void *, int argc, char *argv[]); int run_shell(void); -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +/* Force a compilation error if condition is true */ +#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) + +/* Force a compilation error if condition is constant and true */ +#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) + +/* Force a compilation error if a constant expression is not a power of 2 */ +#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ + BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) + +/* + * Force a compilation error if condition is true, but also produce a + * result (of value 0 and type size_t), so the expression can be used + * e.g. in a structure initializer (or where-ever else comma + * expressions aren't permitted). + */ +#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) +#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) + +#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) +#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) +#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) +#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) /** * container_of - cast a member of a structure out to the containing structure @@ -164,4 +189,6 @@ int run_shell(void); #define LLONG_MIN (-LLONG_MAX - 1) #define ULLONG_MAX (~0ULL) +#define PAGE_SIZE 4096 + #endif /* __COMMON_H_ */ -- 1.6.6.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 06/11] start-arm: cleanup: propper indention 2010-02-16 14:46 ` [PATCH 06/11] start-arm: cleanup: " Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 07/11] i2c.h: fix typo in copyright Marc Kleine-Budde @ 2010-02-16 15:01 ` Uwe Kleine-König 1 sibling, 0 replies; 17+ messages in thread From: Uwe Kleine-König @ 2010-02-16 15:01 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox, sha Hey Marc, a minor nitpick only: $Subject ~= s/pp/p/ Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 05/11] drivers/video/Makefile: cleanup propper indention 2010-02-16 14:46 ` [PATCH 05/11] drivers/video/Makefile: cleanup " Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 06/11] start-arm: cleanup: " Marc Kleine-Budde @ 2010-02-16 20:35 ` Marc Kleine-Budde 1 sibling, 0 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 20:35 UTC (permalink / raw) To: barebox; +Cc: sha [-- Attachment #1.1: Type: text/plain, Size: 1143 bytes --] Marc Kleine-Budde wrote: > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> > --- > drivers/video/Makefile | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/video/Makefile b/drivers/video/Makefile > index 1e0d1b9..45ee09e 100644 > --- a/drivers/video/Makefile > +++ b/drivers/video/Makefile > @@ -1,3 +1,4 @@ > -obj-$(CONFIG_VIDEO) += fb.o > -obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o > -obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o > +obj-$(CONFIG_VIDEO) += fb.o > + > +obj-$(CONFIG_DRIVER_VIDEO_IMX) += imx.o > +obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o As Uwe pointed out indention with tabs isn't good in the long term. As soon as a longer config option occurs the whole indention is broken again. I'll convert the two files into a "just one space" style. cheers, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 260 bytes --] [-- Attachment #2: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 00/11] arch/arm and other random cleanups 2010-02-16 14:46 [PATCH 00/11] arch/arm and other random cleanups Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 01/11] arm/Kconfig: delete trailing whitespace Marc Kleine-Budde @ 2010-02-16 14:54 ` Marc Kleine-Budde 2010-02-17 9:46 ` Sascha Hauer 1 sibling, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-16 14:54 UTC (permalink / raw) To: barebox; +Cc: sha [-- Attachment #1.1: Type: text/plain, Size: 1910 bytes --] Marc Kleine-Budde wrote: > Please review and consider to apply. The following changes since commit 2e6eb64a396b99559cd46dfd49e649521c42c010: Juergen Beisert (1): Fix compile time errors when DEBUG is defined are available in the git repository at: git://git.pengutronix.de/git/mkl/barebox.git for-sha-cleanups Marc Kleine-Budde (11): arm/Kconfig: delete trailing whitespace arm/Kconfig: removed unused TAG options arm/Makefile: keep list of boards sorted arm/cpu/Makefile: cleanup: propper indention drivers/video/Makefile: cleanup propper indention start-arm: cleanup: propper indention i2c.h: fix typo in copyright ioreadsb: put the whole ioreadsb function into the .text.readsb section import recent include/linux/compiler*.h io.h: update definitions of __raw_{read,write}* common.h: add compile time check helper functions arch/arm/Kconfig | 19 ------ arch/arm/Makefile | 2 +- arch/arm/cpu/Makefile | 27 +++++---- arch/arm/cpu/start-arm.S | 12 ++-- arch/arm/include/asm/io.h | 12 ++-- arch/arm/lib/io-readsb.S | 4 +- drivers/video/Makefile | 7 +- include/common.h | 31 ++++++++++- include/i2c/i2c.h | 2 +- include/linux/compiler-gcc.h | 30 +++++++++- include/linux/compiler-gcc3.h | 11 +++- include/linux/compiler-gcc4.h | 32 ++++++++++- include/linux/compiler.h | 124 ++++++++++++++++++++++++++++++++++++++--- 13 files changed, 243 insertions(+), 70 deletions(-) Cheers, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 260 bytes --] [-- Attachment #2: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 00/11] arch/arm and other random cleanups 2010-02-16 14:54 ` [PATCH 00/11] arch/arm and other random cleanups Marc Kleine-Budde @ 2010-02-17 9:46 ` Sascha Hauer 2010-02-17 22:20 ` Marc Kleine-Budde 0 siblings, 1 reply; 17+ messages in thread From: Sascha Hauer @ 2010-02-17 9:46 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox On Tue, Feb 16, 2010 at 03:54:24PM +0100, Marc Kleine-Budde wrote: > Marc Kleine-Budde wrote: > > Please review and consider to apply. > > The following changes since commit 2e6eb64a396b99559cd46dfd49e649521c42c010: > Juergen Beisert (1): > Fix compile time errors when DEBUG is defined > > are available in the git repository at: > > git://git.pengutronix.de/git/mkl/barebox.git for-sha-cleanups > > Marc Kleine-Budde (11): > arm/Kconfig: delete trailing whitespace > arm/Kconfig: removed unused TAG options > arm/Makefile: keep list of boards sorted > arm/cpu/Makefile: cleanup: propper indention > drivers/video/Makefile: cleanup propper indention > start-arm: cleanup: propper indention > i2c.h: fix typo in copyright > ioreadsb: put the whole ioreadsb function into the .text.readsb section > import recent include/linux/compiler*.h > io.h: update definitions of __raw_{read,write}* > common.h: add compile time check helper functions Looks good modulo the changes mentioned. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 00/11] arch/arm and other random cleanups 2010-02-17 9:46 ` Sascha Hauer @ 2010-02-17 22:20 ` Marc Kleine-Budde 0 siblings, 0 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2010-02-17 22:20 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox [-- Attachment #1.1: Type: text/plain, Size: 3014 bytes --] Sascha Hauer wrote: > On Tue, Feb 16, 2010 at 03:54:24PM +0100, Marc Kleine-Budde wrote: >> Marc Kleine-Budde wrote: >>> Please review and consider to apply. >> The following changes since commit 2e6eb64a396b99559cd46dfd49e649521c42c010: >> Juergen Beisert (1): >> Fix compile time errors when DEBUG is defined >> >> are available in the git repository at: >> >> git://git.pengutronix.de/git/mkl/barebox.git for-sha-cleanups >> >> Marc Kleine-Budde (11): >> arm/Kconfig: delete trailing whitespace >> arm/Kconfig: removed unused TAG options >> arm/Makefile: keep list of boards sorted >> arm/cpu/Makefile: cleanup: propper indention >> drivers/video/Makefile: cleanup propper indention >> start-arm: cleanup: propper indention >> i2c.h: fix typo in copyright >> ioreadsb: put the whole ioreadsb function into the .text.readsb section >> import recent include/linux/compiler*.h >> io.h: update definitions of __raw_{read,write}* >> common.h: add compile time check helper functions > > Looks good modulo the changes mentioned. The branch is updated, here a pull request: Cheers, Marc The following changes since commit 2e6eb64a396b99559cd46dfd49e649521c42c010: Juergen Beisert (1): Fix compile time errors when DEBUG is defined are available in the git repository at: git://git.pengutronix.de/git/mkl/barebox.git for-sha-cleanups Marc Kleine-Budde (11): arm/Kconfig: delete trailing whitespace arm/Kconfig: removed unused TAG options arm/Makefile: keep list of boards sorted arm/cpu/Makefile: cleanup: proper indention drivers/video/Makefile: cleanup proper indention start-arm: cleanup: proper indention i2c.h: fix typo in copyright ioreadsb: put the whole ioreadsb function into the .text.readsb section import recent include/linux/compiler*.h io.h: update definitions of __raw_{read,write}* common.h: add compile time check helper functions arch/arm/Kconfig | 19 ------ arch/arm/Makefile | 2 +- arch/arm/cpu/Makefile | 11 ++-- arch/arm/cpu/start-arm.S | 12 ++-- arch/arm/include/asm/io.h | 12 ++-- arch/arm/lib/io-readsb.S | 4 +- drivers/video/Makefile | 5 +- include/common.h | 31 ++++++++++- include/i2c/i2c.h | 2 +- include/linux/compiler-gcc.h | 30 +++++++++- include/linux/compiler-gcc3.h | 11 +++- include/linux/compiler-gcc4.h | 32 ++++++++++- include/linux/compiler.h | 124 ++++++++++++++++++++++++++++++++++++++--- 13 files changed, 234 insertions(+), 61 deletions(-) -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 260 bytes --] [-- Attachment #2: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2010-02-17 22:21 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-02-16 14:46 [PATCH 00/11] arch/arm and other random cleanups Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 01/11] arm/Kconfig: delete trailing whitespace Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 02/11] arm/Kconfig: removed unused TAG options Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 03/11] arm/Makefile: keep list of boards sorted Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 04/11] arm/cpu/Makefile: cleanup: propper indention Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 05/11] drivers/video/Makefile: cleanup " Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 06/11] start-arm: cleanup: " Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 07/11] i2c.h: fix typo in copyright Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 08/11] ioreadsb: put the whole ioreadsb function into the .text.readsb section Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 09/11] import recent include/linux/compiler*.h Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 10/11] io.h: update definitions of __raw_{read,write}* Marc Kleine-Budde 2010-02-16 14:46 ` [PATCH 11/11] common.h: add compile time check helper functions Marc Kleine-Budde 2010-02-16 15:01 ` [PATCH 06/11] start-arm: cleanup: propper indention Uwe Kleine-König 2010-02-16 20:35 ` [PATCH 05/11] drivers/video/Makefile: cleanup " Marc Kleine-Budde 2010-02-16 14:54 ` [PATCH 00/11] arch/arm and other random cleanups Marc Kleine-Budde 2010-02-17 9:46 ` Sascha Hauer 2010-02-17 22:20 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox