aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2005-12-16 16:43:46 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 23:13:08 -0500
commit88ced0314938814e1772b4d0d7ab20c52e4472b6 (patch)
tree3e06de882c0bf5706ee7a8994e06eb8c9ed3feca
parente1333803c3a8fb167ba67ffc5540dbb53fa7deb3 (diff)
[PATCH] powerpc: sanitize header files for user space includes
include/asm-ppc/ had #ifdef __KERNEL__ in all header files that are not meant for use by user space, include/asm-powerpc does not have this yet. This patch gets us a lot closer there. There are a few cases where I was not sure, so I left them out. I have verified that no CONFIG_* symbols are used outside of __KERNEL__ any more and that there are no obvious compile errors when including any of the headers in user space libraries. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--include/asm-powerpc/abs_addr.h2
-rw-r--r--include/asm-powerpc/agp.h2
-rw-r--r--include/asm-powerpc/asm-compat.h3
-rw-r--r--include/asm-powerpc/bootx.h5
-rw-r--r--include/asm-powerpc/bug.h2
-rw-r--r--include/asm-powerpc/checksum.h2
-rw-r--r--include/asm-powerpc/compat.h2
-rw-r--r--include/asm-powerpc/cputable.h1
-rw-r--r--include/asm-powerpc/current.h2
-rw-r--r--include/asm-powerpc/delay.h2
-rw-r--r--include/asm-powerpc/dma-mapping.h2
-rw-r--r--include/asm-powerpc/dma.h2
-rw-r--r--include/asm-powerpc/eeh.h2
-rw-r--r--include/asm-powerpc/eeh_event.h2
-rw-r--r--include/asm-powerpc/elf.h3
-rw-r--r--include/asm-powerpc/floppy.h2
-rw-r--r--include/asm-powerpc/grackle.h5
-rw-r--r--include/asm-powerpc/hardirq.h2
-rw-r--r--include/asm-powerpc/heathrow.h5
-rw-r--r--include/asm-powerpc/hvcall.h2
-rw-r--r--include/asm-powerpc/hvconsole.h2
-rw-r--r--include/asm-powerpc/hvcserver.h2
-rw-r--r--include/asm-powerpc/i8259.h2
-rw-r--r--include/asm-powerpc/ibmebus.h2
-rw-r--r--include/asm-powerpc/io.h6
-rw-r--r--include/asm-powerpc/iommu.h2
-rw-r--r--include/asm-powerpc/kdebug.h2
-rw-r--r--include/asm-powerpc/kexec.h2
-rw-r--r--include/asm-powerpc/keylargo.h5
-rw-r--r--include/asm-powerpc/kprobes.h2
-rw-r--r--include/asm-powerpc/lmb.h2
-rw-r--r--include/asm-powerpc/lppaca.h2
-rw-r--r--include/asm-powerpc/macio.h2
-rw-r--r--include/asm-powerpc/mmu.h2
-rw-r--r--include/asm-powerpc/mmu_context.h2
-rw-r--r--include/asm-powerpc/mmzone.h2
-rw-r--r--include/asm-powerpc/module.h2
-rw-r--r--include/asm-powerpc/mpic.h2
-rw-r--r--include/asm-powerpc/numnodes.h2
-rw-r--r--include/asm-powerpc/nvram.h4
-rw-r--r--include/asm-powerpc/of_device.h2
-rw-r--r--include/asm-powerpc/ohare.h6
-rw-r--r--include/asm-powerpc/oprofile_impl.h2
-rw-r--r--include/asm-powerpc/pSeries_reconfig.h2
-rw-r--r--include/asm-powerpc/paca.h2
-rw-r--r--include/asm-powerpc/page_32.h2
-rw-r--r--include/asm-powerpc/page_64.h2
-rw-r--r--include/asm-powerpc/param.h2
-rw-r--r--include/asm-powerpc/parport.h2
-rw-r--r--include/asm-powerpc/pci-bridge.h2
-rw-r--r--include/asm-powerpc/pgalloc.h2
-rw-r--r--include/asm-powerpc/pgtable-64k.h6
-rw-r--r--include/asm-powerpc/pgtable.h2
-rw-r--r--include/asm-powerpc/pmac_low_i2c.h2
-rw-r--r--include/asm-powerpc/pmc.h2
-rw-r--r--include/asm-powerpc/ppc-pci.h2
-rw-r--r--include/asm-powerpc/ppc_asm.h3
-rw-r--r--include/asm-powerpc/processor.h4
-rw-r--r--include/asm-powerpc/rtas.h2
-rw-r--r--include/asm-powerpc/seccomp.h4
-rw-r--r--include/asm-powerpc/sections.h2
-rw-r--r--include/asm-powerpc/signal.h7
-rw-r--r--include/asm-powerpc/smu.h22
-rw-r--r--include/asm-powerpc/sparsemem.h2
-rw-r--r--include/asm-powerpc/spinlock.h2
-rw-r--r--include/asm-powerpc/spu.h3
-rw-r--r--include/asm-powerpc/spu_csa.h3
-rw-r--r--include/asm-powerpc/synch.h4
-rw-r--r--include/asm-powerpc/system.h3
-rw-r--r--include/asm-powerpc/tce.h2
-rw-r--r--include/asm-powerpc/tlb.h2
-rw-r--r--include/asm-powerpc/topology.h2
-rw-r--r--include/asm-powerpc/udbg.h2
-rw-r--r--include/asm-powerpc/vdso_datapage.h2
-rw-r--r--include/asm-powerpc/vio.h2
75 files changed, 183 insertions, 29 deletions
diff --git a/include/asm-powerpc/abs_addr.h b/include/asm-powerpc/abs_addr.h
index 18415108fc56..c5c3259e0f86 100644
--- a/include/asm-powerpc/abs_addr.h
+++ b/include/asm-powerpc/abs_addr.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_ABS_ADDR_H 1#ifndef _ASM_POWERPC_ABS_ADDR_H
2#define _ASM_POWERPC_ABS_ADDR_H 2#define _ASM_POWERPC_ABS_ADDR_H
3#ifdef __KERNEL__
3 4
4#include <linux/config.h> 5#include <linux/config.h>
5 6
@@ -70,4 +71,5 @@ static inline unsigned long phys_to_abs(unsigned long pa)
70#define iseries_hv_addr(virtaddr) \ 71#define iseries_hv_addr(virtaddr) \
71 (0x8000000000000000 | virt_to_abs(virtaddr)) 72 (0x8000000000000000 | virt_to_abs(virtaddr))
72 73
74#endif /* __KERNEL__ */
73#endif /* _ASM_POWERPC_ABS_ADDR_H */ 75#endif /* _ASM_POWERPC_ABS_ADDR_H */
diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h
index 885b4631a6cf..e5ccaca2f5a4 100644
--- a/include/asm-powerpc/agp.h
+++ b/include/asm-powerpc/agp.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_AGP_H 1#ifndef _ASM_POWERPC_AGP_H
2#define _ASM_POWERPC_AGP_H 2#define _ASM_POWERPC_AGP_H
3#ifdef __KERNEL__
3 4
4#include <asm/io.h> 5#include <asm/io.h>
5 6
@@ -18,4 +19,5 @@
18#define free_gatt_pages(table, order) \ 19#define free_gatt_pages(table, order) \
19 free_pages((unsigned long)(table), (order)) 20 free_pages((unsigned long)(table), (order))
20 21
22#endif /* __KERNEL__ */
21#endif /* _ASM_POWERPC_AGP_H */ 23#endif /* _ASM_POWERPC_AGP_H */
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index 8b133efc9f79..8e64be0cc47d 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_POWERPC_ASM_COMPAT_H 1#ifndef _ASM_POWERPC_ASM_COMPAT_H
2#define _ASM_POWERPC_ASM_COMPAT_H 2#define _ASM_POWERPC_ASM_COMPAT_H
3 3
4#include <linux/config.h>
5#include <asm/types.h> 4#include <asm/types.h>
6 5
7#ifdef __ASSEMBLY__ 6#ifdef __ASSEMBLY__
@@ -41,6 +40,7 @@
41 40
42#endif 41#endif
43 42
43#ifdef __KERNEL__
44#ifdef CONFIG_IBM405_ERR77 44#ifdef CONFIG_IBM405_ERR77
45/* Erratum #77 on the 405 means we need a sync or dcbt before every 45/* Erratum #77 on the 405 means we need a sync or dcbt before every
46 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this. 46 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
@@ -51,5 +51,6 @@
51#define PPC405_ERR77(ra,rb) 51#define PPC405_ERR77(ra,rb)
52#define PPC405_ERR77_SYNC 52#define PPC405_ERR77_SYNC
53#endif 53#endif
54#endif
54 55
55#endif /* _ASM_POWERPC_ASM_COMPAT_H */ 56#endif /* _ASM_POWERPC_ASM_COMPAT_H */
diff --git a/include/asm-powerpc/bootx.h b/include/asm-powerpc/bootx.h
index ed626b7cbf22..57b82e3f89ce 100644
--- a/include/asm-powerpc/bootx.h
+++ b/include/asm-powerpc/bootx.h
@@ -9,6 +9,8 @@
9#ifndef __ASM_BOOTX_H__ 9#ifndef __ASM_BOOTX_H__
10#define __ASM_BOOTX_H__ 10#define __ASM_BOOTX_H__
11 11
12#include <asm/types.h>
13
12#ifdef macintosh 14#ifdef macintosh
13#include <Types.h> 15#include <Types.h>
14#include "linux_type_defs.h" 16#include "linux_type_defs.h"
@@ -122,6 +124,7 @@ typedef struct boot_infos
122 124
123} boot_infos_t; 125} boot_infos_t;
124 126
127#ifdef __KERNEL__
125/* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index 128/* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index
126 * is represented by 3 short words containing a 16 bits (unsigned) color 129 * is represented by 3 short words containing a 16 bits (unsigned) color
127 * component. Later versions may contain the gamma table for direct-color 130 * component. Later versions may contain the gamma table for direct-color
@@ -159,6 +162,8 @@ struct bootx_dt_node {
159 162
160extern void bootx_init(unsigned long r4, unsigned long phys); 163extern void bootx_init(unsigned long r4, unsigned long phys);
161 164
165#endif /* __KERNEL__ */
166
162#ifdef macintosh 167#ifdef macintosh
163#pragma options align=reset 168#pragma options align=reset
164#endif 169#endif
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index b001ecb3cd99..99817a802ca4 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_BUG_H 1#ifndef _ASM_POWERPC_BUG_H
2#define _ASM_POWERPC_BUG_H 2#define _ASM_POWERPC_BUG_H
3#ifdef __KERNEL__
3 4
4#include <asm/asm-compat.h> 5#include <asm/asm-compat.h>
5/* 6/*
@@ -67,4 +68,5 @@ struct bug_entry *find_bug(unsigned long bugaddr);
67 68
68#include <asm-generic/bug.h> 69#include <asm-generic/bug.h>
69 70
71#endif /* __KERNEL__ */
70#endif /* _ASM_POWERPC_BUG_H */ 72#endif /* _ASM_POWERPC_BUG_H */
diff --git a/include/asm-powerpc/checksum.h b/include/asm-powerpc/checksum.h
index d8354d8a49ce..609ecbbd7210 100644
--- a/include/asm-powerpc/checksum.h
+++ b/include/asm-powerpc/checksum.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_CHECKSUM_H 1#ifndef _ASM_POWERPC_CHECKSUM_H
2#define _ASM_POWERPC_CHECKSUM_H 2#define _ASM_POWERPC_CHECKSUM_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -129,4 +130,5 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
129} 130}
130 131
131#endif 132#endif
133#endif /* __KERNEL__ */
132#endif 134#endif
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h
index 4db4360c4d4a..accb80c9a339 100644
--- a/include/asm-powerpc/compat.h
+++ b/include/asm-powerpc/compat.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_COMPAT_H 1#ifndef _ASM_POWERPC_COMPAT_H
2#define _ASM_POWERPC_COMPAT_H 2#define _ASM_POWERPC_COMPAT_H
3#ifdef __KERNEL__
3/* 4/*
4 * Architecture specific compatibility types 5 * Architecture specific compatibility types
5 */ 6 */
@@ -202,4 +203,5 @@ struct compat_shmid64_ds {
202 compat_ulong_t __unused6; 203 compat_ulong_t __unused6;
203}; 204};
204 205
206#endif /* __KERNEL__ */
205#endif /* _ASM_POWERPC_COMPAT_H */ 207#endif /* _ASM_POWERPC_COMPAT_H */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 4b6f03444ffe..f4d508932467 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -1,7 +1,6 @@
1#ifndef __ASM_POWERPC_CPUTABLE_H 1#ifndef __ASM_POWERPC_CPUTABLE_H
2#define __ASM_POWERPC_CPUTABLE_H 2#define __ASM_POWERPC_CPUTABLE_H
3 3
4#include <linux/config.h>
5#include <asm/asm-compat.h> 4#include <asm/asm-compat.h>
6 5
7#define PPC_FEATURE_32 0x80000000 6#define PPC_FEATURE_32 0x80000000
diff --git a/include/asm-powerpc/current.h b/include/asm-powerpc/current.h
index 82cd4a9ca99a..1938d6abd255 100644
--- a/include/asm-powerpc/current.h
+++ b/include/asm-powerpc/current.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_CURRENT_H 1#ifndef _ASM_POWERPC_CURRENT_H
2#define _ASM_POWERPC_CURRENT_H 2#define _ASM_POWERPC_CURRENT_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -24,4 +25,5 @@ register struct task_struct *current asm ("r2");
24 25
25#endif 26#endif
26 27
28#endif /* __KERNEL__ */
27#endif /* _ASM_POWERPC_CURRENT_H */ 29#endif /* _ASM_POWERPC_CURRENT_H */
diff --git a/include/asm-powerpc/delay.h b/include/asm-powerpc/delay.h
index 54fe1f4f8fd0..057a60955474 100644
--- a/include/asm-powerpc/delay.h
+++ b/include/asm-powerpc/delay.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_DELAY_H 1#ifndef _ASM_POWERPC_DELAY_H
2#define _ASM_POWERPC_DELAY_H 2#define _ASM_POWERPC_DELAY_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Copyright 1996, Paul Mackerras. 6 * Copyright 1996, Paul Mackerras.
@@ -16,4 +17,5 @@
16extern void __delay(unsigned long loops); 17extern void __delay(unsigned long loops);
17extern void udelay(unsigned long usecs); 18extern void udelay(unsigned long usecs);
18 19
20#endif /* __KERNEL__ */
19#endif /* _ASM_POWERPC_DELAY_H */ 21#endif /* _ASM_POWERPC_DELAY_H */
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 59a80163f75f..58a25b13a5b3 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -6,6 +6,7 @@
6 */ 6 */
7#ifndef _ASM_DMA_MAPPING_H 7#ifndef _ASM_DMA_MAPPING_H
8#define _ASM_DMA_MAPPING_H 8#define _ASM_DMA_MAPPING_H
9#ifdef __KERNEL__
9 10
10#include <linux/config.h> 11#include <linux/config.h>
11#include <linux/types.h> 12#include <linux/types.h>
@@ -282,4 +283,5 @@ struct dma_mapping_ops {
282 int (*dac_dma_supported)(struct device *dev, u64 mask); 283 int (*dac_dma_supported)(struct device *dev, u64 mask);
283}; 284};
284 285
286#endif /* __KERNEL__ */
285#endif /* _ASM_DMA_MAPPING_H */ 287#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-powerpc/dma.h b/include/asm-powerpc/dma.h
index 926378d2cd94..4bb57fe37097 100644
--- a/include/asm-powerpc/dma.h
+++ b/include/asm-powerpc/dma.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_DMA_H 1#ifndef _ASM_POWERPC_DMA_H
2#define _ASM_POWERPC_DMA_H 2#define _ASM_POWERPC_DMA_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Defines for using and allocating dma channels. 6 * Defines for using and allocating dma channels.
@@ -387,4 +388,5 @@ extern int isa_dma_bridge_buggy;
387 388
388#endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */ 389#endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */
389 390
391#endif /* __KERNEL__ */
390#endif /* _ASM_POWERPC_DMA_H */ 392#endif /* _ASM_POWERPC_DMA_H */
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h
index e4ca35ad3338..14c9e8ab3e5f 100644
--- a/include/asm-powerpc/eeh.h
+++ b/include/asm-powerpc/eeh.h
@@ -19,6 +19,7 @@
19 19
20#ifndef _PPC64_EEH_H 20#ifndef _PPC64_EEH_H
21#define _PPC64_EEH_H 21#define _PPC64_EEH_H
22#ifdef __KERNEL__
22 23
23#include <linux/config.h> 24#include <linux/config.h>
24#include <linux/init.h> 25#include <linux/init.h>
@@ -373,4 +374,5 @@ static inline void eeh_insl_ns(unsigned long port, void * buf, int nl)
373 eeh_check_failure((void __iomem *)(port), *(u32*)buf); 374 eeh_check_failure((void __iomem *)(port), *(u32*)buf);
374} 375}
375 376
377#endif /* __KERNEL__ */
376#endif /* _PPC64_EEH_H */ 378#endif /* _PPC64_EEH_H */
diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h
index d168a30b3866..5e11a00b6fa0 100644
--- a/include/asm-powerpc/eeh_event.h
+++ b/include/asm-powerpc/eeh_event.h
@@ -20,6 +20,7 @@
20 20
21#ifndef ASM_PPC64_EEH_EVENT_H 21#ifndef ASM_PPC64_EEH_EVENT_H
22#define ASM_PPC64_EEH_EVENT_H 22#define ASM_PPC64_EEH_EVENT_H
23#ifdef __KERNEL__
23 24
24/** EEH event -- structure holding pci controller data that describes 25/** EEH event -- structure holding pci controller data that describes
25 * a change in the isolation status of a PCI slot. A pointer 26 * a change in the isolation status of a PCI slot. A pointer
@@ -49,4 +50,5 @@ int eeh_send_failure_event (struct device_node *dn,
49 int reset_state, 50 int reset_state,
50 int time_unavail); 51 int time_unavail);
51 52
53#endif /* __KERNEL__ */
52#endif /* ASM_PPC64_EEH_EVENT_H */ 54#endif /* ASM_PPC64_EEH_EVENT_H */
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 3dcd65edf978..c5a635d9bba4 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -1,7 +1,10 @@
1#ifndef _ASM_POWERPC_ELF_H 1#ifndef _ASM_POWERPC_ELF_H
2#define _ASM_POWERPC_ELF_H 2#define _ASM_POWERPC_ELF_H
3 3
4#ifdef __KERNEL__
4#include <linux/sched.h> /* for task_struct */ 5#include <linux/sched.h> /* for task_struct */
6#endif
7
5#include <asm/types.h> 8#include <asm/types.h>
6#include <asm/ptrace.h> 9#include <asm/ptrace.h>
7#include <asm/cputable.h> 10#include <asm/cputable.h>
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index 64276a3f6153..e258778ca429 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -9,6 +9,7 @@
9 */ 9 */
10#ifndef __ASM_POWERPC_FLOPPY_H 10#ifndef __ASM_POWERPC_FLOPPY_H
11#define __ASM_POWERPC_FLOPPY_H 11#define __ASM_POWERPC_FLOPPY_H
12#ifdef __KERNEL__
12 13
13#include <linux/config.h> 14#include <linux/config.h>
14#include <asm/machdep.h> 15#include <asm/machdep.h>
@@ -102,4 +103,5 @@ static int FDC2 = -1;
102 103
103#define EXTRA_FLOPPY_PARAMS 104#define EXTRA_FLOPPY_PARAMS
104 105
106#endif /* __KERNEL__ */
105#endif /* __ASM_POWERPC_FLOPPY_H */ 107#endif /* __ASM_POWERPC_FLOPPY_H */
diff --git a/include/asm-powerpc/grackle.h b/include/asm-powerpc/grackle.h
index 563c7a5e64c9..bd7812a519d4 100644
--- a/include/asm-powerpc/grackle.h
+++ b/include/asm-powerpc/grackle.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_GRACKLE_H
2#define _ASM_POWERPC_GRACKLE_H
3#ifdef __KERNEL__
1/* 4/*
2 * Functions for setting up and using a MPC106 northbridge 5 * Functions for setting up and using a MPC106 northbridge
3 */ 6 */
@@ -5,3 +8,5 @@
5#include <asm/pci-bridge.h> 8#include <asm/pci-bridge.h>
6 9
7extern void setup_grackle(struct pci_controller *hose); 10extern void setup_grackle(struct pci_controller *hose);
11#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_GRACKLE_H */
diff --git a/include/asm-powerpc/hardirq.h b/include/asm-powerpc/hardirq.h
index 3b3e3b49ec12..288e14d53b7f 100644
--- a/include/asm-powerpc/hardirq.h
+++ b/include/asm-powerpc/hardirq.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_HARDIRQ_H 1#ifndef _ASM_POWERPC_HARDIRQ_H
2#define _ASM_POWERPC_HARDIRQ_H 2#define _ASM_POWERPC_HARDIRQ_H
3#ifdef __KERNEL__
3 4
4#include <asm/irq.h> 5#include <asm/irq.h>
5#include <asm/bug.h> 6#include <asm/bug.h>
@@ -24,4 +25,5 @@ static inline void ack_bad_irq(int irq)
24 BUG(); 25 BUG();
25} 26}
26 27
28#endif /* __KERNEL__ */
27#endif /* _ASM_POWERPC_HARDIRQ_H */ 29#endif /* _ASM_POWERPC_HARDIRQ_H */
diff --git a/include/asm-powerpc/heathrow.h b/include/asm-powerpc/heathrow.h
index 22ac179856b9..470ab7be20a2 100644
--- a/include/asm-powerpc/heathrow.h
+++ b/include/asm-powerpc/heathrow.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_HEATHROW_H
2#define _ASM_POWERPC_HEATHROW_H
3#ifndef __KERNEL__
1/* 4/*
2 * heathrow.h: definitions for using the "Heathrow" I/O controller chip. 5 * heathrow.h: definitions for using the "Heathrow" I/O controller chip.
3 * 6 *
@@ -60,3 +63,5 @@
60/* Looks like Heathrow has some sort of GPIOs as well... */ 63/* Looks like Heathrow has some sort of GPIOs as well... */
61#define HRW_GPIO_MODEM_RESET 0x6d 64#define HRW_GPIO_MODEM_RESET 0x6d
62 65
66#endif /* __KERNEL__ */
67#endif /* _ASM_POWERPC_HEATHROW_H */
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index d36da61dbc53..da7af5a720e0 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_HVCALL_H 1#ifndef _ASM_POWERPC_HVCALL_H
2#define _ASM_POWERPC_HVCALL_H 2#define _ASM_POWERPC_HVCALL_H
3#ifdef __KERNEL__
3 4
4#define HVSC .long 0x44000022 5#define HVSC .long 0x44000022
5 6
@@ -170,4 +171,5 @@ long plpar_hcall_4out(unsigned long opcode,
170 unsigned long *out4); 171 unsigned long *out4);
171 172
172#endif /* __ASSEMBLY__ */ 173#endif /* __ASSEMBLY__ */
174#endif /* __KERNEL__ */
173#endif /* _ASM_POWERPC_HVCALL_H */ 175#endif /* _ASM_POWERPC_HVCALL_H */
diff --git a/include/asm-powerpc/hvconsole.h b/include/asm-powerpc/hvconsole.h
index 6da93ce74dc0..34daf7b9b62f 100644
--- a/include/asm-powerpc/hvconsole.h
+++ b/include/asm-powerpc/hvconsole.h
@@ -21,6 +21,7 @@
21 21
22#ifndef _PPC64_HVCONSOLE_H 22#ifndef _PPC64_HVCONSOLE_H
23#define _PPC64_HVCONSOLE_H 23#define _PPC64_HVCONSOLE_H
24#ifdef __KERNEL__
24 25
25/* 26/*
26 * This is the max number of console adapters that can/will be found as 27 * This is the max number of console adapters that can/will be found as
@@ -46,4 +47,5 @@ extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
46 struct hv_ops *ops); 47 struct hv_ops *ops);
47/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ 48/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
48extern int __devexit hvc_remove(struct hvc_struct *hp); 49extern int __devexit hvc_remove(struct hvc_struct *hp);
50#endif /* __KERNEL__ */
49#endif /* _PPC64_HVCONSOLE_H */ 51#endif /* _PPC64_HVCONSOLE_H */
diff --git a/include/asm-powerpc/hvcserver.h b/include/asm-powerpc/hvcserver.h
index aecba9665796..67d7da3a4da4 100644
--- a/include/asm-powerpc/hvcserver.h
+++ b/include/asm-powerpc/hvcserver.h
@@ -21,6 +21,7 @@
21 21
22#ifndef _PPC64_HVCSERVER_H 22#ifndef _PPC64_HVCSERVER_H
23#define _PPC64_HVCSERVER_H 23#define _PPC64_HVCSERVER_H
24#ifdef __KERNEL__
24 25
25#include <linux/list.h> 26#include <linux/list.h>
26 27
@@ -54,4 +55,5 @@ extern int hvcs_register_connection(uint32_t unit_address,
54 uint32_t p_partition_ID, uint32_t p_unit_address); 55 uint32_t p_partition_ID, uint32_t p_unit_address);
55extern int hvcs_free_connection(uint32_t unit_address); 56extern int hvcs_free_connection(uint32_t unit_address);
56 57
58#endif /* __KERNEL__ */
57#endif /* _PPC64_HVCSERVER_H */ 59#endif /* _PPC64_HVCSERVER_H */
diff --git a/include/asm-powerpc/i8259.h b/include/asm-powerpc/i8259.h
index fc4bfee124d7..0392159e16e4 100644
--- a/include/asm-powerpc/i8259.h
+++ b/include/asm-powerpc/i8259.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_I8259_H 1#ifndef _ASM_POWERPC_I8259_H
2#define _ASM_POWERPC_I8259_H 2#define _ASM_POWERPC_I8259_H
3#ifdef __KERNEL__
3 4
4#include <linux/irq.h> 5#include <linux/irq.h>
5 6
@@ -9,4 +10,5 @@ extern void i8259_init(unsigned long intack_addr, int offset);
9extern int i8259_irq(struct pt_regs *regs); 10extern int i8259_irq(struct pt_regs *regs);
10extern int i8259_irq_cascade(struct pt_regs *regs, void *unused); 11extern int i8259_irq_cascade(struct pt_regs *regs, void *unused);
11 12
13#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_I8259_H */ 14#endif /* _ASM_POWERPC_I8259_H */
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
index 55982b8e5b98..7a42723d107c 100644
--- a/include/asm-powerpc/ibmebus.h
+++ b/include/asm-powerpc/ibmebus.h
@@ -37,6 +37,7 @@
37 37
38#ifndef _ASM_EBUS_H 38#ifndef _ASM_EBUS_H
39#define _ASM_EBUS_H 39#define _ASM_EBUS_H
40#ifdef __KERNEL__
40 41
41#include <linux/device.h> 42#include <linux/device.h>
42#include <linux/interrupt.h> 43#include <linux/interrupt.h>
@@ -80,4 +81,5 @@ static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev)
80} 81}
81 82
82 83
84#endif /* __KERNEL__ */
83#endif /* _ASM_IBMEBUS_H */ 85#endif /* _ASM_IBMEBUS_H */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 48938d84d055..68efbea379c9 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_IO_H 1#ifndef _ASM_POWERPC_IO_H
2#define _ASM_POWERPC_IO_H 2#define _ASM_POWERPC_IO_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -186,7 +187,6 @@ extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
186#define IO_SPACE_LIMIT ~(0UL) 187#define IO_SPACE_LIMIT ~(0UL)
187 188
188 189
189#ifdef __KERNEL__
190extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr, 190extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr,
191 unsigned long size, unsigned long flags); 191 unsigned long size, unsigned long flags);
192extern void __iomem *__ioremap(unsigned long address, unsigned long size, 192extern void __iomem *__ioremap(unsigned long address, unsigned long size,
@@ -256,8 +256,6 @@ static inline void * phys_to_virt(unsigned long address)
256 */ 256 */
257#define BIO_VMERGE_BOUNDARY 0 257#define BIO_VMERGE_BOUNDARY 0
258 258
259#endif /* __KERNEL__ */
260
261static inline void iosync(void) 259static inline void iosync(void)
262{ 260{
263 __asm__ __volatile__ ("sync" : : : "memory"); 261 __asm__ __volatile__ ("sync" : : : "memory");
@@ -405,8 +403,6 @@ static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long
405#include <asm/eeh.h> 403#include <asm/eeh.h>
406#endif 404#endif
407 405
408#ifdef __KERNEL__
409
410/** 406/**
411 * check_signature - find BIOS signatures 407 * check_signature - find BIOS signatures
412 * @io_addr: mmio address to check 408 * @io_addr: mmio address to check
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 59f062668997..8a8393e50774 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -20,6 +20,7 @@
20 20
21#ifndef _ASM_IOMMU_H 21#ifndef _ASM_IOMMU_H
22#define _ASM_IOMMU_H 22#define _ASM_IOMMU_H
23#ifdef __KERNEL__
23 24
24#include <linux/config.h> 25#include <linux/config.h>
25#include <asm/types.h> 26#include <asm/types.h>
@@ -115,4 +116,5 @@ static inline void pci_iommu_init(void) { }
115 116
116extern void alloc_dart_table(void); 117extern void alloc_dart_table(void);
117 118
119#endif /* __KERNEL__ */
118#endif /* _ASM_IOMMU_H */ 120#endif /* _ASM_IOMMU_H */
diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h
index 9dcbac674811..7c16265568e0 100644
--- a/include/asm-powerpc/kdebug.h
+++ b/include/asm-powerpc/kdebug.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_KDEBUG_H 1#ifndef _ASM_POWERPC_KDEBUG_H
2#define _ASM_POWERPC_KDEBUG_H 2#define _ASM_POWERPC_KDEBUG_H
3#ifdef __KERNEL__
3 4
4/* nearly identical to x86_64/i386 code */ 5/* nearly identical to x86_64/i386 code */
5 6
@@ -39,4 +40,5 @@ static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,lon
39 return notifier_call_chain(&powerpc_die_chain, val, &args); 40 return notifier_call_chain(&powerpc_die_chain, val, &args);
40} 41}
41 42
43#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_KDEBUG_H */ 44#endif /* _ASM_POWERPC_KDEBUG_H */
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
index c0f6d6b0d935..4263af3cadfd 100644
--- a/include/asm-powerpc/kexec.h
+++ b/include/asm-powerpc/kexec.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_KEXEC_H 1#ifndef _ASM_POWERPC_KEXEC_H
2#define _ASM_POWERPC_KEXEC_H 2#define _ASM_POWERPC_KEXEC_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Maximum page that is mapped directly into kernel memory. 6 * Maximum page that is mapped directly into kernel memory.
@@ -58,4 +59,5 @@ extern void default_machine_crash_shutdown(struct pt_regs *regs);
58#endif /* !CONFIG_KEXEC */ 59#endif /* !CONFIG_KEXEC */
59 60
60#endif /* ! __ASSEMBLY__ */ 61#endif /* ! __ASSEMBLY__ */
62#endif /* __KERNEL__ */
61#endif /* _ASM_POWERPC_KEXEC_H */ 63#endif /* _ASM_POWERPC_KEXEC_H */
diff --git a/include/asm-powerpc/keylargo.h b/include/asm-powerpc/keylargo.h
index 334d4c9356f3..d8520ef121f9 100644
--- a/include/asm-powerpc/keylargo.h
+++ b/include/asm-powerpc/keylargo.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_KEYLARGO_H
2#define _ASM_POWERPC_KEYLARGO_H
3#ifdef __KERNEL__
1/* 4/*
2 * keylargo.h: definitions for using the "KeyLargo" I/O controller chip. 5 * keylargo.h: definitions for using the "KeyLargo" I/O controller chip.
3 * 6 *
@@ -254,3 +257,5 @@
254#define SH_FCR1_I2S2_ENABLE 0x00000080 257#define SH_FCR1_I2S2_ENABLE 0x00000080
255#define SH_FCR3_I2S2_CLK18_ENABLE 0x00008000 258#define SH_FCR3_I2S2_CLK18_ENABLE 0x00008000
256 259
260#endif /* __KERNEL__ */
261#endif /* _ASM_POWERPC_KEYLARGO_H */
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index 6cd0a3bfa280..0654f79b06df 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_KPROBES_H 1#ifndef _ASM_POWERPC_KPROBES_H
2#define _ASM_POWERPC_KPROBES_H 2#define _ASM_POWERPC_KPROBES_H
3#ifdef __KERNEL__
3/* 4/*
4 * Kernel Probes (KProbes) 5 * Kernel Probes (KProbes)
5 * 6 *
@@ -78,4 +79,5 @@ static inline int kprobe_exceptions_notify(struct notifier_block *self,
78 return 0; 79 return 0;
79} 80}
80#endif 81#endif
82#endif /* __KERNEL__ */
81#endif /* _ASM_POWERPC_KPROBES_H */ 83#endif /* _ASM_POWERPC_KPROBES_H */
diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h
index ea0afe343545..d3546c4c9f46 100644
--- a/include/asm-powerpc/lmb.h
+++ b/include/asm-powerpc/lmb.h
@@ -1,5 +1,6 @@
1#ifndef _PPC64_LMB_H 1#ifndef _PPC64_LMB_H
2#define _PPC64_LMB_H 2#define _PPC64_LMB_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Definitions for talking to the Open Firmware PROM on 6 * Definitions for talking to the Open Firmware PROM on
@@ -78,4 +79,5 @@ lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
78 lmb_size_pages(type, region_nr); 79 lmb_size_pages(type, region_nr);
79} 80}
80 81
82#endif /* __KERNEL__ */
81#endif /* _PPC64_LMB_H */ 83#endif /* _PPC64_LMB_H */
diff --git a/include/asm-powerpc/lppaca.h b/include/asm-powerpc/lppaca.h
index c1bedab1515b..ff82ea7c4829 100644
--- a/include/asm-powerpc/lppaca.h
+++ b/include/asm-powerpc/lppaca.h
@@ -18,6 +18,7 @@
18 */ 18 */
19#ifndef _ASM_POWERPC_LPPACA_H 19#ifndef _ASM_POWERPC_LPPACA_H
20#define _ASM_POWERPC_LPPACA_H 20#define _ASM_POWERPC_LPPACA_H
21#ifdef __KERNEL__
21 22
22//============================================================================= 23//=============================================================================
23// 24//
@@ -128,4 +129,5 @@ struct lppaca {
128 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF 129 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
129}; 130};
130 131
132#endif /* __KERNEL__ */
131#endif /* _ASM_POWERPC_LPPACA_H */ 133#endif /* _ASM_POWERPC_LPPACA_H */
diff --git a/include/asm-powerpc/macio.h b/include/asm-powerpc/macio.h
index b553dd4b139e..3a6cb1a513b7 100644
--- a/include/asm-powerpc/macio.h
+++ b/include/asm-powerpc/macio.h
@@ -1,5 +1,6 @@
1#ifndef __MACIO_ASIC_H__ 1#ifndef __MACIO_ASIC_H__
2#define __MACIO_ASIC_H__ 2#define __MACIO_ASIC_H__
3#ifdef __KERNEL__
3 4
4#include <asm/of_device.h> 5#include <asm/of_device.h>
5 6
@@ -137,4 +138,5 @@ struct macio_driver
137extern int macio_register_driver(struct macio_driver *); 138extern int macio_register_driver(struct macio_driver *);
138extern void macio_unregister_driver(struct macio_driver *); 139extern void macio_unregister_driver(struct macio_driver *);
139 140
141#endif /* __KERNEL__ */
140#endif /* __MACIO_ASIC_H__ */ 142#endif /* __MACIO_ASIC_H__ */
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 0a7323f0083b..d096d9e76ad7 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_MMU_H_ 1#ifndef _ASM_POWERPC_MMU_H_
2#define _ASM_POWERPC_MMU_H_ 2#define _ASM_POWERPC_MMU_H_
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/mmu.h> 6#include <asm-ppc/mmu.h>
@@ -402,4 +403,5 @@ typedef unsigned long phys_addr_t;
402#endif /* __ASSEMBLY */ 403#endif /* __ASSEMBLY */
403 404
404#endif /* CONFIG_PPC64 */ 405#endif /* CONFIG_PPC64 */
406#endif /* __KERNEL__ */
405#endif /* _ASM_POWERPC_MMU_H_ */ 407#endif /* _ASM_POWERPC_MMU_H_ */
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index ea6798c7d5fc..1b8a25fd48f3 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -1,5 +1,6 @@
1#ifndef __ASM_POWERPC_MMU_CONTEXT_H 1#ifndef __ASM_POWERPC_MMU_CONTEXT_H
2#define __ASM_POWERPC_MMU_CONTEXT_H 2#define __ASM_POWERPC_MMU_CONTEXT_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/mmu_context.h> 6#include <asm-ppc/mmu_context.h>
@@ -86,4 +87,5 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
86} 87}
87 88
88#endif /* CONFIG_PPC64 */ 89#endif /* CONFIG_PPC64 */
90#endif /* __KERNEL__ */
89#endif /* __ASM_POWERPC_MMU_CONTEXT_H */ 91#endif /* __ASM_POWERPC_MMU_CONTEXT_H */
diff --git a/include/asm-powerpc/mmzone.h b/include/asm-powerpc/mmzone.h
index 54958d6cae04..88d70bae7769 100644
--- a/include/asm-powerpc/mmzone.h
+++ b/include/asm-powerpc/mmzone.h
@@ -6,6 +6,7 @@
6 */ 6 */
7#ifndef _ASM_MMZONE_H_ 7#ifndef _ASM_MMZONE_H_
8#define _ASM_MMZONE_H_ 8#define _ASM_MMZONE_H_
9#ifdef __KERNEL__
9 10
10#include <linux/config.h> 11#include <linux/config.h>
11 12
@@ -47,4 +48,5 @@ extern unsigned long max_pfn;
47extern int __init early_pfn_to_nid(unsigned long pfn); 48extern int __init early_pfn_to_nid(unsigned long pfn);
48#endif 49#endif
49 50
51#endif /* __KERNEL__ */
50#endif /* _ASM_MMZONE_H_ */ 52#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h
index 7ecd05e03051..584fabfb4f08 100644
--- a/include/asm-powerpc/module.h
+++ b/include/asm-powerpc/module.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_MODULE_H 1#ifndef _ASM_POWERPC_MODULE_H
2#define _ASM_POWERPC_MODULE_H 2#define _ASM_POWERPC_MODULE_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -74,4 +75,5 @@ struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start, 75void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish); 76 struct exception_table_entry *finish);
76 77
78#endif /* __KERNEL__ */
77#endif /* _ASM_POWERPC_MODULE_H */ 79#endif /* _ASM_POWERPC_MODULE_H */
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index bf7e71793205..6b9e78142f4f 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_MPIC_H 1#ifndef _ASM_POWERPC_MPIC_H
2#define _ASM_POWERPC_MPIC_H 2#define _ASM_POWERPC_MPIC_H
3#ifdef __KERNEL__
3 4
4#include <linux/irq.h> 5#include <linux/irq.h>
5 6
@@ -286,4 +287,5 @@ extern int mpic_get_irq(struct pt_regs *regs);
286/* global mpic for pSeries */ 287/* global mpic for pSeries */
287extern struct mpic *pSeries_mpic; 288extern struct mpic *pSeries_mpic;
288 289
290#endif /* __KERNEL__ */
289#endif /* _ASM_POWERPC_MPIC_H */ 291#endif /* _ASM_POWERPC_MPIC_H */
diff --git a/include/asm-powerpc/numnodes.h b/include/asm-powerpc/numnodes.h
index 795533aca095..e138edae09dd 100644
--- a/include/asm-powerpc/numnodes.h
+++ b/include/asm-powerpc/numnodes.h
@@ -1,7 +1,9 @@
1#ifndef _ASM_POWERPC_MAX_NUMNODES_H 1#ifndef _ASM_POWERPC_MAX_NUMNODES_H
2#define _ASM_POWERPC_MAX_NUMNODES_H 2#define _ASM_POWERPC_MAX_NUMNODES_H
3#ifdef __KERNEL__
3 4
4/* Max 16 Nodes */ 5/* Max 16 Nodes */
5#define NODES_SHIFT 4 6#define NODES_SHIFT 4
6 7
8#endif /* __KERNEL__ */
7#endif /* _ASM_POWERPC_MAX_NUMNODES_H */ 9#endif /* _ASM_POWERPC_MAX_NUMNODES_H */
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h
index 24bd8c2388ea..f3563e11e260 100644
--- a/include/asm-powerpc/nvram.h
+++ b/include/asm-powerpc/nvram.h
@@ -55,6 +55,7 @@ struct nvram_header {
55 char name[12]; 55 char name[12];
56}; 56};
57 57
58#ifdef __KERNEL__
58struct nvram_partition { 59struct nvram_partition {
59 struct list_head partition; 60 struct list_head partition;
60 struct nvram_header header; 61 struct nvram_header header;
@@ -69,6 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
69 70
70extern int pSeries_nvram_init(void); 71extern int pSeries_nvram_init(void);
71extern int mmio_nvram_init(void); 72extern int mmio_nvram_init(void);
73#endif /* __KERNEL__ */
72 74
73/* PowerMac specific nvram stuffs */ 75/* PowerMac specific nvram stuffs */
74 76
@@ -78,6 +80,7 @@ enum {
78 pmac_nvram_NR /* MacOS Name Registry partition */ 80 pmac_nvram_NR /* MacOS Name Registry partition */
79}; 81};
80 82
83#ifdef __KERNEL__
81/* Return partition offset in nvram */ 84/* Return partition offset in nvram */
82extern int pmac_get_partition(int partition); 85extern int pmac_get_partition(int partition);
83 86
@@ -91,6 +94,7 @@ extern void nvram_sync(void);
91/* Normal access to NVRAM */ 94/* Normal access to NVRAM */
92extern unsigned char nvram_read_byte(int i); 95extern unsigned char nvram_read_byte(int i);
93extern void nvram_write_byte(unsigned char c, int i); 96extern void nvram_write_byte(unsigned char c, int i);
97#endif
94 98
95/* Some offsets in XPRAM */ 99/* Some offsets in XPRAM */
96#define PMAC_XPRAM_MACHINE_LOC 0xe4 100#define PMAC_XPRAM_MACHINE_LOC 0xe4
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index ddb16aae0bd6..6249a7c39639 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_OF_DEVICE_H 1#ifndef _ASM_POWERPC_OF_DEVICE_H
2#define _ASM_POWERPC_OF_DEVICE_H 2#define _ASM_POWERPC_OF_DEVICE_H
3#ifdef __KERNEL__
3 4
4#include <linux/device.h> 5#include <linux/device.h>
5#include <linux/mod_devicetable.h> 6#include <linux/mod_devicetable.h>
@@ -61,4 +62,5 @@ extern struct of_device *of_platform_device_create(struct device_node *np,
61 struct device *parent); 62 struct device *parent);
62extern void of_release_dev(struct device *dev); 63extern void of_release_dev(struct device *dev);
63 64
65#endif /* __KERNEL__ */
64#endif /* _ASM_POWERPC_OF_DEVICE_H */ 66#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-powerpc/ohare.h b/include/asm-powerpc/ohare.h
index 023b59772231..b42037cf4ad0 100644
--- a/include/asm-powerpc/ohare.h
+++ b/include/asm-powerpc/ohare.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_OHARE_H
2#define _ASM_POWERPC_OHARE_H
3#ifndef __KERNEL__
1/* 4/*
2 * ohare.h: definitions for using the "O'Hare" I/O controller chip. 5 * ohare.h: definitions for using the "O'Hare" I/O controller chip.
3 * 6 *
@@ -46,3 +49,6 @@
46 * Contributed by Harry Eaton. 49 * Contributed by Harry Eaton.
47 */ 50 */
48#define STARMAX_FEATURES 0xbeff7a 51#define STARMAX_FEATURES 0xbeff7a
52
53#endif /* __KERNEL__ */
54#endif /* _ASM_POWERPC_OHARE_H */
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index b48d35e40172..338e6a7cff4a 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -11,6 +11,7 @@
11 11
12#ifndef _ASM_POWERPC_OPROFILE_IMPL_H 12#ifndef _ASM_POWERPC_OPROFILE_IMPL_H
13#define _ASM_POWERPC_OPROFILE_IMPL_H 13#define _ASM_POWERPC_OPROFILE_IMPL_H
14#ifdef __KERNEL__
14 15
15#define OP_MAX_COUNTER 8 16#define OP_MAX_COUNTER 8
16 17
@@ -133,4 +134,5 @@ static inline void ctr_write(unsigned int i, unsigned int val)
133} 134}
134#endif /* !CONFIG_FSL_BOOKE */ 135#endif /* !CONFIG_FSL_BOOKE */
135 136
137#endif /* __KERNEL__ */
136#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */ 138#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */
diff --git a/include/asm-powerpc/pSeries_reconfig.h b/include/asm-powerpc/pSeries_reconfig.h
index c0db1ea7f7d1..ea6cfb8efb84 100644
--- a/include/asm-powerpc/pSeries_reconfig.h
+++ b/include/asm-powerpc/pSeries_reconfig.h
@@ -1,5 +1,6 @@
1#ifndef _PPC64_PSERIES_RECONFIG_H 1#ifndef _PPC64_PSERIES_RECONFIG_H
2#define _PPC64_PSERIES_RECONFIG_H 2#define _PPC64_PSERIES_RECONFIG_H
3#ifdef __KERNEL__
3 4
4#include <linux/notifier.h> 5#include <linux/notifier.h>
5 6
@@ -22,4 +23,5 @@ static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb)
22static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { } 23static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { }
23#endif /* CONFIG_PPC_PSERIES */ 24#endif /* CONFIG_PPC_PSERIES */
24 25
26#endif /* __KERNEL__ */
25#endif /* _PPC64_PSERIES_RECONFIG_H */ 27#endif /* _PPC64_PSERIES_RECONFIG_H */
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 59a41dbbf73c..3ae52d9dc9ff 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -14,6 +14,7 @@
14 */ 14 */
15#ifndef _ASM_POWERPC_PACA_H 15#ifndef _ASM_POWERPC_PACA_H
16#define _ASM_POWERPC_PACA_H 16#define _ASM_POWERPC_PACA_H
17#ifdef __KERNEL__
17 18
18#include <linux/config.h> 19#include <linux/config.h>
19#include <asm/types.h> 20#include <asm/types.h>
@@ -110,4 +111,5 @@ struct paca_struct {
110 111
111extern struct paca_struct paca[]; 112extern struct paca_struct paca[];
112 113
114#endif /* __KERNEL__ */
113#endif /* _ASM_POWERPC_PACA_H */ 115#endif /* _ASM_POWERPC_PACA_H */
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h
index 7259cfd85da9..2677bad70f40 100644
--- a/include/asm-powerpc/page_32.h
+++ b/include/asm-powerpc/page_32.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PAGE_32_H 1#ifndef _ASM_POWERPC_PAGE_32_H
2#define _ASM_POWERPC_PAGE_32_H 2#define _ASM_POWERPC_PAGE_32_H
3#ifdef __KERNEL__
3 4
4#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32 5#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32
5 6
@@ -37,4 +38,5 @@ extern __inline__ int get_order(unsigned long size)
37 38
38#endif /* __ASSEMBLY__ */ 39#endif /* __ASSEMBLY__ */
39 40
41#endif /* __KERNEL__ */
40#endif /* _ASM_POWERPC_PAGE_32_H */ 42#endif /* _ASM_POWERPC_PAGE_32_H */
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h
index 8a07a93b0321..3fb061bab9ec 100644
--- a/include/asm-powerpc/page_64.h
+++ b/include/asm-powerpc/page_64.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PAGE_64_H 1#ifndef _ASM_POWERPC_PAGE_64_H
2#define _ASM_POWERPC_PAGE_64_H 2#define _ASM_POWERPC_PAGE_64_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Copyright (C) 2001 PPC64 Team, IBM Corp 6 * Copyright (C) 2001 PPC64 Team, IBM Corp
@@ -170,4 +171,5 @@ extern unsigned int HPAGE_SHIFT;
170 171
171#include <asm-generic/page.h> 172#include <asm-generic/page.h>
172 173
174#endif /* __KERNEL__ */
173#endif /* _ASM_POWERPC_PAGE_64_H */ 175#endif /* _ASM_POWERPC_PAGE_64_H */
diff --git a/include/asm-powerpc/param.h b/include/asm-powerpc/param.h
index bdc724f70884..094f63d4d5ca 100644
--- a/include/asm-powerpc/param.h
+++ b/include/asm-powerpc/param.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_POWERPC_PARAM_H 1#ifndef _ASM_POWERPC_PARAM_H
2#define _ASM_POWERPC_PARAM_H 2#define _ASM_POWERPC_PARAM_H
3 3
4#include <linux/config.h>
5
6#ifdef __KERNEL__ 4#ifdef __KERNEL__
7#define HZ CONFIG_HZ /* internal kernel timer frequency */ 5#define HZ CONFIG_HZ /* internal kernel timer frequency */
8#define USER_HZ 100 /* for user interfaces in "ticks" */ 6#define USER_HZ 100 /* for user interfaces in "ticks" */
diff --git a/include/asm-powerpc/parport.h b/include/asm-powerpc/parport.h
index d86b410a6f8b..897e49a88a6b 100644
--- a/include/asm-powerpc/parport.h
+++ b/include/asm-powerpc/parport.h
@@ -8,6 +8,7 @@
8 8
9#ifndef _ASM_POWERPC_PARPORT_H 9#ifndef _ASM_POWERPC_PARPORT_H
10#define _ASM_POWERPC_PARPORT_H 10#define _ASM_POWERPC_PARPORT_H
11#ifdef __KERNEL__
11 12
12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); 13static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
13static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 14static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
@@ -15,4 +16,5 @@ static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
15 return parport_pc_find_isa_ports (autoirq, autodma); 16 return parport_pc_find_isa_ports (autoirq, autodma);
16} 17}
17 18
19#endif /* __KERNEL__ */
18#endif /* !(_ASM_POWERPC_PARPORT_H) */ 20#endif /* !(_ASM_POWERPC_PARPORT_H) */
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 443c75a16571..1a08860e789e 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PCI_BRIDGE_H 1#ifndef _ASM_POWERPC_PCI_BRIDGE_H
2#define _ASM_POWERPC_PCI_BRIDGE_H 2#define _ASM_POWERPC_PCI_BRIDGE_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/pci-bridge.h> 6#include <asm-ppc/pci-bridge.h>
@@ -172,4 +173,5 @@ static inline unsigned long pci_address_to_pio(phys_addr_t address)
172#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ 173#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
173 174
174#endif /* CONFIG_PPC64 */ 175#endif /* CONFIG_PPC64 */
176#endif /* __KERNEL__ */
175#endif 177#endif
diff --git a/include/asm-powerpc/pgalloc.h b/include/asm-powerpc/pgalloc.h
index bfc2113b3630..9f5b052784a5 100644
--- a/include/asm-powerpc/pgalloc.h
+++ b/include/asm-powerpc/pgalloc.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PGALLOC_H 1#ifndef _ASM_POWERPC_PGALLOC_H
2#define _ASM_POWERPC_PGALLOC_H 2#define _ASM_POWERPC_PGALLOC_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/pgalloc.h> 6#include <asm-ppc/pgalloc.h>
@@ -153,4 +154,5 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
153#define check_pgt_cache() do { } while (0) 154#define check_pgt_cache() do { } while (0)
154 155
155#endif /* CONFIG_PPC64 */ 156#endif /* CONFIG_PPC64 */
157#endif /* __KERNEL__ */
156#endif /* _ASM_POWERPC_PGALLOC_H */ 158#endif /* _ASM_POWERPC_PGALLOC_H */
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 154f1840ece4..653915014dcd 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -1,3 +1,7 @@
1#ifndef _ASM_POWERPC_PGTABLE_64K_H
2#define _ASM_POWERPC_PGTABLE_64K_H
3#ifdef __KERNEL__
4
1#include <asm-generic/pgtable-nopud.h> 5#include <asm-generic/pgtable-nopud.h>
2 6
3 7
@@ -88,3 +92,5 @@
88 92
89 93
90#endif /* __ASSEMBLY__ */ 94#endif /* __ASSEMBLY__ */
95#endif /* __KERNEL__ */
96#endif /* _ASM_POWERPC_PGTABLE_64K_H */
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index 3518adb2cc18..e38931379a72 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PGTABLE_H 1#ifndef _ASM_POWERPC_PGTABLE_H
2#define _ASM_POWERPC_PGTABLE_H 2#define _ASM_POWERPC_PGTABLE_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/pgtable.h> 6#include <asm-ppc/pgtable.h>
@@ -532,4 +533,5 @@ void pgtable_cache_init(void);
532#endif /* __ASSEMBLY__ */ 533#endif /* __ASSEMBLY__ */
533 534
534#endif /* CONFIG_PPC64 */ 535#endif /* CONFIG_PPC64 */
536#endif /* __KERNEL__ */
535#endif /* _ASM_POWERPC_PGTABLE_H */ 537#endif /* _ASM_POWERPC_PGTABLE_H */
diff --git a/include/asm-powerpc/pmac_low_i2c.h b/include/asm-powerpc/pmac_low_i2c.h
index 809a5963d5e7..3fb8d51540dd 100644
--- a/include/asm-powerpc/pmac_low_i2c.h
+++ b/include/asm-powerpc/pmac_low_i2c.h
@@ -11,6 +11,7 @@
11 */ 11 */
12#ifndef __PMAC_LOW_I2C_H__ 12#ifndef __PMAC_LOW_I2C_H__
13#define __PMAC_LOW_I2C_H__ 13#define __PMAC_LOW_I2C_H__
14#ifdef __KERNEL__
14 15
15/* i2c mode (based on the platform functions format) */ 16/* i2c mode (based on the platform functions format) */
16enum { 17enum {
@@ -40,4 +41,5 @@ int pmac_low_i2c_setmode(struct device_node *np, int mode);
40int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len); 41int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len);
41 42
42 43
44#endif /* __KERNEL__ */
43#endif /* __PMAC_LOW_I2C_H__ */ 45#endif /* __PMAC_LOW_I2C_H__ */
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
index 5f41f3a2b293..07d6a4279319 100644
--- a/include/asm-powerpc/pmc.h
+++ b/include/asm-powerpc/pmc.h
@@ -18,6 +18,7 @@
18 */ 18 */
19#ifndef _POWERPC_PMC_H 19#ifndef _POWERPC_PMC_H
20#define _POWERPC_PMC_H 20#define _POWERPC_PMC_H
21#ifdef __KERNEL__
21 22
22#include <asm/ptrace.h> 23#include <asm/ptrace.h>
23 24
@@ -44,4 +45,5 @@ void dump_pmcs(void);
44extern struct op_powerpc_model op_model_fsl_booke; 45extern struct op_powerpc_model op_model_fsl_booke;
45#endif 46#endif
46 47
48#endif /* __KERNEL__ */
47#endif /* _POWERPC_PMC_H */ 49#endif /* _POWERPC_PMC_H */
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index 36cdc869e580..bdef312900a1 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#ifndef _ASM_POWERPC_PPC_PCI_H 9#ifndef _ASM_POWERPC_PPC_PCI_H
10#define _ASM_POWERPC_PPC_PCI_H 10#define _ASM_POWERPC_PPC_PCI_H
11#ifdef __KERNEL__
11 12
12#include <linux/pci.h> 13#include <linux/pci.h>
13#include <asm/pci-bridge.h> 14#include <asm/pci-bridge.h>
@@ -93,4 +94,5 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag);
93 94
94#endif 95#endif
95 96
97#endif /* __KERNEL__ */
96#endif /* _ASM_POWERPC_PPC_PCI_H */ 98#endif /* _ASM_POWERPC_PPC_PCI_H */
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index c27baa0563fe..0dc798d46ea4 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -94,6 +94,7 @@
94#define RFDI .long 0x4c00004e /* rfdi instruction */ 94#define RFDI .long 0x4c00004e /* rfdi instruction */
95#define RFMCI .long 0x4c00004c /* rfmci instruction */ 95#define RFMCI .long 0x4c00004c /* rfmci instruction */
96 96
97#ifdef __KERNEL__
97#ifdef CONFIG_PPC64 98#ifdef CONFIG_PPC64
98 99
99#define XGLUE(a,b) a##b 100#define XGLUE(a,b) a##b
@@ -325,6 +326,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
325#define CLR_TOP32(r) 326#define CLR_TOP32(r)
326#endif 327#endif
327 328
329#endif /* __KERNEL__ */
330
328/* The boring bits... */ 331/* The boring bits... */
329 332
330/* Condition Register Bit Fields */ 333/* Condition Register Bit Fields */
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index f3db98454c4d..415fa393b00c 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -10,7 +10,6 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <asm/reg.h> 13#include <asm/reg.h>
15 14
16#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
@@ -50,6 +49,7 @@
50#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ 49#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
51#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ 50#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
52 51
52#ifdef __KERNEL__
53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ 53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \
54 _machine == PLATFORM_PSERIES_LPAR) 54 _machine == PLATFORM_PSERIES_LPAR)
55#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR)) 55#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR))
@@ -81,7 +81,7 @@ extern unsigned char ucBoardRevMaj, ucBoardRevMin;
81#else 81#else
82#define _machine 0 82#define _machine 0
83#endif /* CONFIG_PPC_MULTIPLATFORM */ 83#endif /* CONFIG_PPC_MULTIPLATFORM */
84 84#endif /* __KERNEL__ */
85/* 85/*
86 * Default implementation of macro that returns current 86 * Default implementation of macro that returns current
87 * instruction pointer ("program counter"). 87 * instruction pointer ("program counter").
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index d1bb611ea626..3428889e27b7 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -1,5 +1,6 @@
1#ifndef _POWERPC_RTAS_H 1#ifndef _POWERPC_RTAS_H
2#define _POWERPC_RTAS_H 2#define _POWERPC_RTAS_H
3#ifdef __KERNEL__
3 4
4#include <linux/spinlock.h> 5#include <linux/spinlock.h>
5#include <asm/page.h> 6#include <asm/page.h>
@@ -229,4 +230,5 @@ extern unsigned long rtas_rmo_buf;
229 230
230#define GLOBAL_INTERRUPT_QUEUE 9005 231#define GLOBAL_INTERRUPT_QUEUE 9005
231 232
233#endif /* __KERNEL__ */
232#endif /* _POWERPC_RTAS_H */ 234#endif /* _POWERPC_RTAS_H */
diff --git a/include/asm-powerpc/seccomp.h b/include/asm-powerpc/seccomp.h
index 1e1cfe12882b..cc8137b77b90 100644
--- a/include/asm-powerpc/seccomp.h
+++ b/include/asm-powerpc/seccomp.h
@@ -1,6 +1,10 @@
1#ifndef _ASM_POWERPC_SECCOMP_H 1#ifndef _ASM_POWERPC_SECCOMP_H
2#define _ASM_POWERPC_SECCOMP_H
2 3
4#ifndef __KERNEL__
3#include <linux/thread_info.h> 5#include <linux/thread_info.h>
6#endif
7
4#include <linux/unistd.h> 8#include <linux/unistd.h>
5 9
6#define __NR_seccomp_read __NR_read 10#define __NR_seccomp_read __NR_read
diff --git a/include/asm-powerpc/sections.h b/include/asm-powerpc/sections.h
index 47be2ac2a925..916018e425c4 100644
--- a/include/asm-powerpc/sections.h
+++ b/include/asm-powerpc/sections.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_SECTIONS_H 1#ifndef _ASM_POWERPC_SECTIONS_H
2#define _ASM_POWERPC_SECTIONS_H 2#define _ASM_POWERPC_SECTIONS_H
3#ifdef __KERNEL__
3 4
4#include <asm-generic/sections.h> 5#include <asm-generic/sections.h>
5 6
@@ -17,4 +18,5 @@ static inline int in_kernel_text(unsigned long addr)
17 18
18#endif 19#endif
19 20
21#endif /* __KERNEL__ */
20#endif /* _ASM_POWERPC_SECTIONS_H */ 22#endif /* _ASM_POWERPC_SECTIONS_H */
diff --git a/include/asm-powerpc/signal.h b/include/asm-powerpc/signal.h
index 694c8d2dab87..a4d8f8648541 100644
--- a/include/asm-powerpc/signal.h
+++ b/include/asm-powerpc/signal.h
@@ -2,10 +2,13 @@
2#define _ASM_POWERPC_SIGNAL_H 2#define _ASM_POWERPC_SIGNAL_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/config.h>
6 5
7#define _NSIG 64 6#define _NSIG 64
8#define _NSIG_BPW BITS_PER_LONG 7#ifdef __powerpc64__
8#define _NSIG_BPW 64
9#else
10#define _NSIG_BPW 32
11#endif
9#define _NSIG_WORDS (_NSIG / _NSIG_BPW) 12#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
10 13
11typedef unsigned long old_sigset_t; /* at least 32 bits */ 14typedef unsigned long old_sigset_t; /* at least 32 bits */
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h
index 76c29a9784dd..7fae3ce9a8c1 100644
--- a/include/asm-powerpc/smu.h
+++ b/include/asm-powerpc/smu.h
@@ -4,9 +4,11 @@
4/* 4/*
5 * Definitions for talking to the SMU chip in newer G5 PowerMacs 5 * Definitions for talking to the SMU chip in newer G5 PowerMacs
6 */ 6 */
7 7#ifdef __KERNEL__
8#include <linux/config.h> 8#include <linux/config.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#endif
11#include <linux/types.h>
10 12
11/* 13/*
12 * Known SMU commands 14 * Known SMU commands
@@ -487,8 +489,8 @@ struct smu_sdbp_slotspow {
487#define SMU_SDB_SENSORTREE_ID 0x25 489#define SMU_SDB_SENSORTREE_ID 0x25
488 490
489struct smu_sdbp_sensortree { 491struct smu_sdbp_sensortree {
490 u8 model_id; 492 __u8 model_id;
491 u8 unknown[3]; 493 __u8 unknown[3];
492}; 494};
493 495
494/* This partition contains CPU thermal control PID informations. So far 496/* This partition contains CPU thermal control PID informations. So far
@@ -498,13 +500,13 @@ struct smu_sdbp_sensortree {
498#define SMU_SDB_CPUPIDDATA_ID 0x17 500#define SMU_SDB_CPUPIDDATA_ID 0x17
499 501
500struct smu_sdbp_cpupiddata { 502struct smu_sdbp_cpupiddata {
501 u8 unknown1; 503 __u8 unknown1;
502 u8 target_temp_delta; 504 __u8 target_temp_delta;
503 u8 unknown2; 505 __u8 unknown2;
504 u8 history_len; 506 __u8 history_len;
505 s16 power_adj; 507 __s16 power_adj;
506 u16 max_power; 508 __u16 max_power;
507 s32 gp,gr,gd; 509 __s32 gp,gr,gd;
508}; 510};
509 511
510 512
diff --git a/include/asm-powerpc/sparsemem.h b/include/asm-powerpc/sparsemem.h
index c3f17d442f7d..38b1ea3b58fd 100644
--- a/include/asm-powerpc/sparsemem.h
+++ b/include/asm-powerpc/sparsemem.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_SPARSEMEM_H 1#ifndef _ASM_POWERPC_SPARSEMEM_H
2#define _ASM_POWERPC_SPARSEMEM_H 1 2#define _ASM_POWERPC_SPARSEMEM_H 1
3#ifdef __KERNEL__
3 4
4#ifdef CONFIG_SPARSEMEM 5#ifdef CONFIG_SPARSEMEM
5/* 6/*
@@ -25,4 +26,5 @@ static inline int hot_add_scn_to_nid(unsigned long scn_addr)
25 26
26#endif /* CONFIG_SPARSEMEM */ 27#endif /* CONFIG_SPARSEMEM */
27 28
29#endif /* __KERNEL__ */
28#endif /* _ASM_POWERPC_SPARSEMEM_H */ 30#endif /* _ASM_POWERPC_SPARSEMEM_H */
diff --git a/include/asm-powerpc/spinlock.h b/include/asm-powerpc/spinlock.h
index caa4b14e0e94..754900901cd8 100644
--- a/include/asm-powerpc/spinlock.h
+++ b/include/asm-powerpc/spinlock.h
@@ -1,5 +1,6 @@
1#ifndef __ASM_SPINLOCK_H 1#ifndef __ASM_SPINLOCK_H
2#define __ASM_SPINLOCK_H 2#define __ASM_SPINLOCK_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Simple spin lock operations. 6 * Simple spin lock operations.
@@ -266,4 +267,5 @@ static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
266 rw->lock = 0; 267 rw->lock = 0;
267} 268}
268 269
270#endif /* __KERNEL__ */
269#endif /* __ASM_SPINLOCK_H */ 271#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 698c4cb08c60..ee337e37195c 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -22,6 +22,8 @@
22 22
23#ifndef _SPU_H 23#ifndef _SPU_H
24#define _SPU_H 24#define _SPU_H
25#ifdef __KERNEL__
26
25#include <linux/config.h> 27#include <linux/config.h>
26#include <linux/kref.h> 28#include <linux/kref.h>
27#include <linux/workqueue.h> 29#include <linux/workqueue.h>
@@ -578,4 +580,5 @@ struct spu_priv1 {
578 u64 spu_trace_cntl; /* 0x1070 */ 580 u64 spu_trace_cntl; /* 0x1070 */
579} __attribute__ ((aligned(0x2000))); 581} __attribute__ ((aligned(0x2000)));
580 582
583#endif /* __KERNEL__ */
581#endif 584#endif
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index 2a8af416638f..ba18d7d4dde2 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -22,6 +22,7 @@
22 22
23#ifndef _SPU_CSA_H_ 23#ifndef _SPU_CSA_H_
24#define _SPU_CSA_H_ 24#define _SPU_CSA_H_
25#ifdef __KERNEL__
25 26
26/* 27/*
27 * Total number of 128-bit registers. 28 * Total number of 128-bit registers.
@@ -89,8 +90,6 @@ struct spu_lscsa {
89 unsigned char ls[LS_SIZE]; 90 unsigned char ls[LS_SIZE];
90}; 91};
91 92
92#ifdef __KERNEL__
93
94/* 93/*
95 * struct spu_problem_collapsed - condensed problem state area, w/o pads. 94 * struct spu_problem_collapsed - condensed problem state area, w/o pads.
96 */ 95 */
diff --git a/include/asm-powerpc/synch.h b/include/asm-powerpc/synch.h
index 4660c0394a77..794870ab8fd3 100644
--- a/include/asm-powerpc/synch.h
+++ b/include/asm-powerpc/synch.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_POWERPC_SYNCH_H 1#ifndef _ASM_POWERPC_SYNCH_H
2#define _ASM_POWERPC_SYNCH_H 2#define _ASM_POWERPC_SYNCH_H
3 3#ifdef __KERNEL__
4#include <linux/config.h>
5 4
6#ifdef __powerpc64__ 5#ifdef __powerpc64__
7#define __SUBARCH_HAS_LWSYNC 6#define __SUBARCH_HAS_LWSYNC
@@ -47,5 +46,6 @@ static inline void isync(void)
47#define isync_on_smp() __asm__ __volatile__("": : :"memory") 46#define isync_on_smp() __asm__ __volatile__("": : :"memory")
48#endif 47#endif
49 48
49#endif /* __KERNEL__ */
50#endif /* _ASM_POWERPC_SYNCH_H */ 50#endif /* _ASM_POWERPC_SYNCH_H */
51 51
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 5341b75c75cb..0c58e32a9570 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -4,7 +4,6 @@
4#ifndef _ASM_POWERPC_SYSTEM_H 4#ifndef _ASM_POWERPC_SYSTEM_H
5#define _ASM_POWERPC_SYSTEM_H 5#define _ASM_POWERPC_SYSTEM_H
6 6
7#include <linux/config.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9 8
10#include <asm/hw_irq.h> 9#include <asm/hw_irq.h>
@@ -42,6 +41,7 @@
42#define set_mb(var, value) do { var = value; mb(); } while (0) 41#define set_mb(var, value) do { var = value; mb(); } while (0)
43#define set_wmb(var, value) do { var = value; wmb(); } while (0) 42#define set_wmb(var, value) do { var = value; wmb(); } while (0)
44 43
44#ifdef __KERNEL__
45#ifdef CONFIG_SMP 45#ifdef CONFIG_SMP
46#define smp_mb() mb() 46#define smp_mb() mb()
47#define smp_rmb() rmb() 47#define smp_rmb() rmb()
@@ -54,7 +54,6 @@
54#define smp_read_barrier_depends() do { } while(0) 54#define smp_read_barrier_depends() do { } while(0)
55#endif /* CONFIG_SMP */ 55#endif /* CONFIG_SMP */
56 56
57#ifdef __KERNEL__
58struct task_struct; 57struct task_struct;
59struct pt_regs; 58struct pt_regs;
60 59
diff --git a/include/asm-powerpc/tce.h b/include/asm-powerpc/tce.h
index 980a094fd5a7..6fa200ad7a7f 100644
--- a/include/asm-powerpc/tce.h
+++ b/include/asm-powerpc/tce.h
@@ -20,6 +20,7 @@
20 20
21#ifndef _ASM_POWERPC_TCE_H 21#ifndef _ASM_POWERPC_TCE_H
22#define _ASM_POWERPC_TCE_H 22#define _ASM_POWERPC_TCE_H
23#ifdef __KERNEL__
23 24
24/* 25/*
25 * Tces come in two formats, one for the virtual bus and a different 26 * Tces come in two formats, one for the virtual bus and a different
@@ -61,4 +62,5 @@ union tce_entry {
61}; 62};
62 63
63 64
65#endif /* __KERNEL__ */
64#endif /* _ASM_POWERPC_TCE_H */ 66#endif /* _ASM_POWERPC_TCE_H */
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h
index 56659f121779..601a53cf96d5 100644
--- a/include/asm-powerpc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -11,6 +11,7 @@
11 */ 11 */
12#ifndef _ASM_POWERPC_TLB_H 12#ifndef _ASM_POWERPC_TLB_H
13#define _ASM_POWERPC_TLB_H 13#define _ASM_POWERPC_TLB_H
14#ifdef __KERNEL__
14 15
15#include <linux/config.h> 16#include <linux/config.h>
16#ifndef __powerpc64__ 17#ifndef __powerpc64__
@@ -67,4 +68,5 @@ static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
67} 68}
68 69
69#endif 70#endif
71#endif /* __KERNEL__ */
70#endif /* __ASM_POWERPC_TLB_H */ 72#endif /* __ASM_POWERPC_TLB_H */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index f8a130af7d09..9f3d4da261c4 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_TOPOLOGY_H 1#ifndef _ASM_POWERPC_TOPOLOGY_H
2#define _ASM_POWERPC_TOPOLOGY_H 2#define _ASM_POWERPC_TOPOLOGY_H
3#ifdef __KERNEL__
3 4
4#include <linux/config.h> 5#include <linux/config.h>
5 6
@@ -65,4 +66,5 @@ static inline void dump_numa_cpu_topology(void) {}
65 66
66#endif /* CONFIG_NUMA */ 67#endif /* CONFIG_NUMA */
67 68
69#endif /* __KERNEL__ */
68#endif /* _ASM_POWERPC_TOPOLOGY_H */ 70#endif /* _ASM_POWERPC_TOPOLOGY_H */
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index 58cdc883e38c..6c8abc924b28 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -9,6 +9,7 @@
9 9
10#ifndef _ASM_POWERPC_UDBG_H 10#ifndef _ASM_POWERPC_UDBG_H
11#define _ASM_POWERPC_UDBG_H 11#define _ASM_POWERPC_UDBG_H
12#ifdef __KERNEL__
12 13
13#include <linux/compiler.h> 14#include <linux/compiler.h>
14#include <linux/init.h> 15#include <linux/init.h>
@@ -34,4 +35,5 @@ extern void udbg_scc_init(int force_scc);
34extern int udbg_adb_init(int force_btext); 35extern int udbg_adb_init(int force_btext);
35extern void udbg_adb_init_early(void); 36extern void udbg_adb_init_early(void);
36 37
38#endif /* __KERNEL__ */
37#endif /* _ASM_POWERPC_UDBG_H */ 39#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h
index 411832d5bbdb..7aa92086c3fb 100644
--- a/include/asm-powerpc/vdso_datapage.h
+++ b/include/asm-powerpc/vdso_datapage.h
@@ -1,5 +1,6 @@
1#ifndef _VDSO_DATAPAGE_H 1#ifndef _VDSO_DATAPAGE_H
2#define _VDSO_DATAPAGE_H 2#define _VDSO_DATAPAGE_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM 6 * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM
@@ -105,4 +106,5 @@ extern struct vdso_data *vdso_data;
105 106
106#endif /* __ASSEMBLY__ */ 107#endif /* __ASSEMBLY__ */
107 108
109#endif /* __KERNEL__ */
108#endif /* _SYSTEMCFG_H */ 110#endif /* _SYSTEMCFG_H */
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index e0ccf108277c..0544ece51761 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -13,6 +13,7 @@
13 13
14#ifndef _ASM_POWERPC_VIO_H 14#ifndef _ASM_POWERPC_VIO_H
15#define _ASM_POWERPC_VIO_H 15#define _ASM_POWERPC_VIO_H
16#ifdef __KERNEL__
16 17
17#include <linux/config.h> 18#include <linux/config.h>
18#include <linux/init.h> 19#include <linux/init.h>
@@ -103,4 +104,5 @@ static inline struct vio_dev *to_vio_dev(struct device *dev)
103 return container_of(dev, struct vio_dev, dev); 104 return container_of(dev, struct vio_dev, dev);
104} 105}
105 106
107#endif /* __KERNEL__ */
106#endif /* _ASM_POWERPC_VIO_H */ 108#endif /* _ASM_POWERPC_VIO_H */