Root/target/linux/generic/patches-2.6.31/049-byteshift_h_fix_usage_for_compressed_kernels.patch

1From 2fa4341074cd02fb39aa23410740764948755635 Mon Sep 17 00:00:00 2001
2From: Albin Tonnerre <albin.tonnerre@free-electrons.com>
3Date: Wed, 23 Sep 2009 15:57:38 -0700
4Subject: [PATCH] include/linux/unaligned/{l,b}e_byteshift.h: fix usage for compressed kernels
5
6When unaligned accesses are required for uncompressing a kernel (such as
7for LZO decompression on ARM in a patch that follows), including
8<linux/kernel.h> causes issues as it brings in a lot of things that are
9not available in the decompression environment.
10
11linux/kernel.h brings at least:
12extern int console_printk[];
13extern const char hex_asc[];
14which causes errors at link-time as they are not available when
15compiling the pre-boot environement. There are also a few others:
16
17  arch/arm/boot/compressed/misc.o: In function `valid_user_regs':
18   arch/arm/include/asm/ptrace.h:158: undefined reference to `elf_hwcap'
19  arch/arm/boot/compressed/misc.o: In function `console_silent':
20   include/linux/kernel.h:292: undefined reference to `console_printk'
21  arch/arm/boot/compressed/misc.o: In function `console_verbose':
22   include/linux/kernel.h:297: undefined reference to `console_printk'
23  arch/arm/boot/compressed/misc.o: In function `pack_hex_byte':
24   include/linux/kernel.h:360: undefined reference to `hex_asc'
25  arch/arm/boot/compressed/misc.o: In function `hweight_long':
26   include/linux/bitops.h:45: undefined reference to `hweight32'
27  arch/arm/boot/compressed/misc.o: In function `__cmpxchg_local_generic':
28   include/asm-generic/cmpxchg-local.h:21: undefined reference to `wrong_size_cmpxchg'
29   include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
30  arch/arm/boot/compressed/misc.o: In function `__xchg':
31   arch/arm/include/asm/system.h:309: undefined reference to `__bad_xchg'
32
33However, those files apparently use nothing from <linux/kernel.h>, all
34they need is the declaration of types such as u32 or u64, so
35<linux/types.h> should be enough
36
37Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
38Cc: Sam Ravnborg <sam@ravnborg.org>
39Cc: Russell King <rmk@arm.linux.org.uk>
40Cc: Ingo Molnar <mingo@elte.hu>
41Cc: Thomas Gleixner <tglx@linutronix.de>
42Cc: "H. Peter Anvin" <hpa@zytor.com>
43Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
44Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
45Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
46---
47 include/linux/unaligned/be_byteshift.h | 2 +-
48 include/linux/unaligned/le_byteshift.h | 2 +-
49 2 files changed, 2 insertions(+), 2 deletions(-)
50
51--- a/include/linux/unaligned/be_byteshift.h
52+++ b/include/linux/unaligned/be_byteshift.h
53@@ -1,7 +1,7 @@
54 #ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H
55 #define _LINUX_UNALIGNED_BE_BYTESHIFT_H
56 
57-#include <linux/kernel.h>
58+#include <linux/types.h>
59 
60 static inline u16 __get_unaligned_be16(const u8 *p)
61 {
62--- a/include/linux/unaligned/le_byteshift.h
63+++ b/include/linux/unaligned/le_byteshift.h
64@@ -1,7 +1,7 @@
65 #ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H
66 #define _LINUX_UNALIGNED_LE_BYTESHIFT_H
67 
68-#include <linux/kernel.h>
69+#include <linux/types.h>
70 
71 static inline u16 __get_unaligned_le16(const u8 *p)
72 {
73

Archive Download this file



interactive