Skip to contentSkip to conversation

Remove unneccessary included headers

RFC PATCH Superseded Christophe Leroy 2 participants 10 messages May 30, 2018 – May 31, 2018 PowerPC

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Remove unneccessary included headers

The purpose of this serie is to limit the number of includes to only the necessary ones in order to reduce the number of files recompiled everytime a header file is modified.

This is the start of the work, please provide feedback if any so that I don't go in the wrong direction.

Christophe Leroy (8):
powerpc: remove kdump.h from page.h
powerpc: remove unneeded inclusions of cpu_has_feature.h
powerpc: remove superflous inclusions of asm-compat.h
powerpc: remove superflous inclusions of asm/feature-fixups.h
powerpc: remove superflous inclusions of asm/fixmap.h
powerpc: declare set_breakpoint() static powerpc/book3s: Remove PPC_PIN_SIZE
powerpc: fix includes in asm/processor.h

 arch/powerpc/include/asm/book3s/32/pgtable.h |  5 -----
 arch/powerpc/include/asm/cacheflush.h        |  1 -
 arch/powerpc/include/asm/cputable.h          |  2 --
 arch/powerpc/include/asm/cputime.h           |  1 -
 arch/powerpc/include/asm/dbell.h             |  1 -
 arch/powerpc/include/asm/debug.h             |  1 -
 arch/powerpc/include/asm/dt_cpu_ftrs.h       |  3 ---
 arch/powerpc/include/asm/feature-fixups.h    |  2 ++
 arch/powerpc/include/asm/firmware.h          |  1 -
 arch/powerpc/include/asm/fixmap.h            |  2 --
 arch/powerpc/include/asm/hw_breakpoint.h     |  1 +
 arch/powerpc/include/asm/mmu.h               |  1 -
 arch/powerpc/include/asm/nohash/32/pgtable.h |  2 +-
 arch/powerpc/include/asm/page.h              |  1 -
 arch/powerpc/include/asm/ppc-opcode.h        |  1 -
 arch/powerpc/include/asm/processor.h         |  5 ++---
 arch/powerpc/include/asm/reg.h               |  1 +
 arch/powerpc/kernel/head_8xx.S               |  1 -
 arch/powerpc/kernel/process.c                | 14 +++++++-------
 arch/powerpc/kernel/setup_32.c               |  1 +
 arch/powerpc/kernel/vdso.c                   |  1 -
 arch/powerpc/mm/dump_hashpagetable.c         |  1 -
 arch/powerpc/sysdev/cpm_common.c             |  1 -
 23 files changed, 15 insertions(+), 35 deletions(-)
Signature · 1 line
2.13.3
#1 lore raw

RFC PATCH 1/8 powerpc: remove kdump.h from page.h

page.h doesn't need kdump.h

---
 arch/powerpc/include/asm/page.h | 1 -
 arch/powerpc/kernel/setup_32.c  | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/page.h +0 -1
index db7be0779d55..a9fbefaacf10 100644
@@ -17,7 +17,6 @@
 #include <asm/types.h>
 #endif
 #include <asm/asm-compat.h>
-#include <asm/kdump.h>
 
 /*
  * On regular PPC32 page size is 4K (but we support 4K/16K/64K/256K pages
arch/powerpc/kernel/setup_32.c +1 -0
index 74457485574b..ef747a5a30b9 100644
@@ -40,6 +40,7 @@
 #include <asm/code-patching.h>
 #include <asm/cpu_has_feature.h>
 #include <asm/asm-prototypes.h>
+#include <asm/kdump.h>
 
 #define DBG(fmt...)
 
Signature · 1 line
2.13.3
#2 lore raw

RFC PATCH 2/8 powerpc: remove unneeded inclusions of cpu_has_feature.h

In reply to Christophe Leroy

Files not using cpu_has_feature() don't need cpu_has_feature.h

---
 arch/powerpc/include/asm/cacheflush.h  | 1 -
 arch/powerpc/include/asm/cputime.h     | 1 -
 arch/powerpc/include/asm/dbell.h       | 1 -
 arch/powerpc/include/asm/dt_cpu_ftrs.h | 3 ---
 arch/powerpc/kernel/vdso.c             | 1 -
 5 files changed, 7 deletions(-)
arch/powerpc/include/asm/cacheflush.h +0 -1
index 11843e37d9cf..cfe3a98349c4 100644
@@ -11,7 +11,6 @@
 
 #include <linux/mm.h>
 #include <asm/cputable.h>
-#include <asm/cpu_has_feature.h>
 
 /*
  * No cache flushing is required when address mappings are changed,
arch/powerpc/include/asm/cputime.h +0 -1
index 99b541865d8d..d78fee0cdbf0 100644
@@ -23,7 +23,6 @@
 #include <asm/div64.h>
 #include <asm/time.h>
 #include <asm/param.h>
-#include <asm/cpu_has_feature.h>
 
 typedef u64 __nocast cputime_t;
 typedef u64 __nocast cputime64_t;
arch/powerpc/include/asm/dbell.h +0 -1
index 9f2ae0d25e15..998c42ff1caa 100644
@@ -16,7 +16,6 @@
 #include <linux/threads.h>
 
 #include <asm/ppc-opcode.h>
-#include <asm/cpu_has_feature.h>
 
 #define PPC_DBELL_MSG_BRDCAST	(0x04000000)
 #define PPC_DBELL_TYPE(x)	(((x) & 0xf) << (63-36))
arch/powerpc/include/asm/dt_cpu_ftrs.h +0 -3
index 71515d909ed1..40165eea22ee 100644
@@ -10,9 +10,6 @@
  */
 
 #include <linux/types.h>
-#include <asm/asm-compat.h>
-#include <asm/feature-fixups.h>
-#include <uapi/asm/cputable.h>
 
 #ifdef CONFIG_PPC_DT_CPU_FTRS
 bool dt_cpu_ftrs_init(void *fdt);
arch/powerpc/kernel/vdso.c +0 -1
index b44ec104a5a1..63b4e4485b00 100644
@@ -22,7 +22,6 @@
 #include <linux/security.h>
 #include <linux/memblock.h>
 
-#include <asm/cpu_has_feature.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
Signature · 1 line
2.13.3
#3 lore raw

RFC PATCH 3/8 powerpc: remove superflous inclusions of asm-compat.h

In reply to Christophe Leroy

ppc-opcode.h doesn't need asm-compat.h
neither does dt_cpu_ftrs.h

---
 arch/powerpc/include/asm/cputable.h       | 1 -
 arch/powerpc/include/asm/feature-fixups.h | 2 ++
 arch/powerpc/include/asm/ppc-opcode.h     | 1 -
 3 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/cputable.h +0 -1
index 66fcab13c8b4..7518dafa7cd4 100644
@@ -4,7 +4,6 @@
 
 
 #include <linux/types.h>
-#include <asm/asm-compat.h>
 #include <asm/feature-fixups.h>
 #include <uapi/asm/cputable.h>
 
arch/powerpc/include/asm/feature-fixups.h +2 -0
index a9b64df34e2a..ecfdf9d3d145 100644
@@ -1,6 +1,8 @@
 #ifndef __ASM_POWERPC_FEATURE_FIXUPS_H
 #define __ASM_POWERPC_FEATURE_FIXUPS_H
 
+#include <asm/asm-compat.h>
+
 /*
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
arch/powerpc/include/asm/ppc-opcode.h +0 -1
index 4436887bc415..ab12fac26f5b 100644
@@ -13,7 +13,6 @@
 #define _ASM_POWERPC_PPC_OPCODE_H
 
 #include <linux/stringify.h>
-#include <asm/asm-compat.h>
 
 #define	__REG_R0	0
 #define	__REG_R1	1
Signature · 1 line
2.13.3
#4 lore raw

RFC PATCH 4/8 powerpc: remove superflous inclusions of asm/feature-fixups.h

In reply to Christophe Leroy

files not using feature fixup don't need asm/feature-fixups.h

---
 arch/powerpc/include/asm/cputable.h | 1 -
 arch/powerpc/include/asm/firmware.h | 1 -
 arch/powerpc/include/asm/mmu.h      | 1 -
 arch/powerpc/include/asm/reg.h      | 1 +
 4 files changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/include/asm/cputable.h +0 -1
index 7518dafa7cd4..e99905274a77 100644
@@ -4,7 +4,6 @@
 
 
 #include <linux/types.h>
-#include <asm/feature-fixups.h>
 #include <uapi/asm/cputable.h>
 
 #ifndef __ASSEMBLY__
arch/powerpc/include/asm/firmware.h +0 -1
index 535add3f7791..59ae44cf0bb8 100644
@@ -15,7 +15,6 @@
 #ifdef __KERNEL__
 
 #include <asm/asm-compat.h>
-#include <asm/feature-fixups.h>
 
 /* firmware feature bitmask values */
 
arch/powerpc/include/asm/mmu.h +0 -1
index 61d15ce92278..61d0d2d69583 100644
@@ -6,7 +6,6 @@
 #include <linux/types.h>
 
 #include <asm/asm-compat.h>
-#include <asm/feature-fixups.h>
 
 /*
  * MMU features bit definitions
arch/powerpc/include/asm/reg.h +1 -0
index cb0f272ce123..a7b8860ed896 100644
@@ -13,6 +13,7 @@
 
 #include <linux/stringify.h>
 #include <asm/cputable.h>
+#include <asm/feature-fixups.h>
 
 /* Pickup Book E specific registers. */
 #if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
Signature · 1 line
2.13.3
#5 lore raw

RFC PATCH 5/8 powerpc: remove superflous inclusions of asm/fixmap.h

In reply to Christophe Leroy

Files not using fixmap consts or functions don't need asm/fixmap.h

---
 arch/powerpc/include/asm/fixmap.h    | 2 --
 arch/powerpc/kernel/head_8xx.S       | 1 -
 arch/powerpc/mm/dump_hashpagetable.c | 1 -
 arch/powerpc/sysdev/cpm_common.c     | 1 -
 4 files changed, 5 deletions(-)
arch/powerpc/include/asm/fixmap.h +0 -2
index 6c40dfda5912..40efdf1d2d6e 100644
@@ -15,9 +15,7 @@
 #define _ASM_FIXMAP_H
 
 #ifndef __ASSEMBLY__
-#include <linux/kernel.h>
 #include <asm/page.h>
-#include <asm/pgtable.h>
 #ifdef CONFIG_HIGHMEM
 #include <linux/threads.h>
 #include <asm/kmap_types.h>
arch/powerpc/kernel/head_8xx.S +0 -1
index 6cab07e76732..95f6bdc0718f 100644
@@ -30,7 +30,6 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 #include <asm/ptrace.h>
-#include <asm/fixmap.h>
 #include <asm/export.h>
 
 #if CONFIG_TASK_SIZE <= 0x80000000 && CONFIG_PAGE_OFFSET >= 0x80000000
arch/powerpc/mm/dump_hashpagetable.c +0 -1
index 14cfb11b09d0..ddffb1513ddc 100644
@@ -19,7 +19,6 @@
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
-#include <asm/fixmap.h>
 #include <asm/pgtable.h>
 #include <linux/const.h>
 #include <asm/page.h>
arch/powerpc/sysdev/cpm_common.c +0 -1
index b74508175b67..010975c3422f 100644
@@ -28,7 +28,6 @@
 #include <asm/udbg.h>
 #include <asm/io.h>
 #include <asm/cpm.h>
-#include <asm/fixmap.h>
 #include <soc/fsl/qe/qe.h>
 
 #include <mm/mmu_decl.h>
Signature · 1 line
2.13.3
#6 lore raw

RFC PATCH 6/8 powerpc: declare set_breakpoint() static

In reply to Christophe Leroy

set_breakpoint() is only used in process.c so make it static

---
 arch/powerpc/include/asm/debug.h |  1 -
 arch/powerpc/kernel/process.c    | 14 +++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/debug.h +0 -1
index ce5da214ffe5..7756026b95ca 100644
@@ -45,7 +45,6 @@ static inline int debugger_break_match(struct pt_regs *regs) { return 0; }
 static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
 #endif
 
-void set_breakpoint(struct arch_hw_breakpoint *brk);
 void __set_breakpoint(struct arch_hw_breakpoint *brk);
 bool ppc_breakpoint_available(void);
 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
arch/powerpc/kernel/process.c +7 -7
index 1237f13fed51..3e66cf6f7f95 100644
@@ -714,6 +714,13 @@ void switch_booke_debug_regs(struct debug_reg *new_debug)
 EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
 #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
 #ifndef CONFIG_HAVE_HW_BREAKPOINT
+static void set_breakpoint(struct arch_hw_breakpoint *brk)
+{
+	preempt_disable();
+	__set_breakpoint(brk);
+	preempt_enable();
+}
+
 static void set_debug_reg_defaults(struct thread_struct *thread)
 {
 	thread->hw_brk.address = 0;
@@ -826,13 +833,6 @@ void __set_breakpoint(struct arch_hw_breakpoint *brk)
 		WARN_ON_ONCE(1);
 }
 
-void set_breakpoint(struct arch_hw_breakpoint *brk)
-{
-	preempt_disable();
-	__set_breakpoint(brk);
-	preempt_enable();
-}
-
 /* Check if we have DAWR or DABR hardware */
 bool ppc_breakpoint_available(void)
 {
Signature · 1 line
2.13.3
#7 lore raw

RFC PATCH 7/8 powerpc/book3s: Remove PPC_PIN_SIZE

In reply to Christophe Leroy

PPC_PIN_SIZE is specific to the 44x and is defined in mmu.h

---
 arch/powerpc/include/asm/book3s/32/pgtable.h | 5 -----
 arch/powerpc/include/asm/nohash/32/pgtable.h | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)
arch/powerpc/include/asm/book3s/32/pgtable.h +0 -5
index c615abdce119..0603479d04c3 100644
@@ -84,17 +84,12 @@
  * of RAM.  -- Cort
  */
 #define VMALLOC_OFFSET (0x1000000) /* 16M */
-#ifdef PPC_PIN_SIZE
-#define VMALLOC_START (((_ALIGN((long)high_memory, PPC_PIN_SIZE) + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)))
-#else
 #define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)))
-#endif
 #define VMALLOC_END	ioremap_bot
 
 #ifndef __ASSEMBLY__
 #include <linux/sched.h>
 #include <linux/threads.h>
-#include <asm/io.h>			/* For sub-arch specific PPC_PIN_SIZE */
 
 extern unsigned long ioremap_bot;
 
arch/powerpc/include/asm/nohash/32/pgtable.h +1 -1
index 987a658b18e1..35fa43c20b6e 100644
@@ -8,7 +8,7 @@
 #ifndef __ASSEMBLY__
 #include <linux/sched.h>
 #include <linux/threads.h>
-#include <asm/io.h>			/* For sub-arch specific PPC_PIN_SIZE */
+#include <asm/mmu.h>			/* For sub-arch specific PPC_PIN_SIZE */
 
 extern unsigned long ioremap_bot;
 
Signature · 1 line
2.13.3
#8 lore raw

RFC PATCH 8/8 powerpc: fix includes in asm/processor.h

In reply to Christophe Leroy

Remove superflous includes and add missing ones

---
 arch/powerpc/include/asm/hw_breakpoint.h | 1 +
 arch/powerpc/include/asm/processor.h     | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/hw_breakpoint.h +1 -0
index 8e7b09703ca4..3637588d3f6d 100644
@@ -55,6 +55,7 @@ struct arch_hw_breakpoint {
 struct perf_event;
 struct pmu;
 struct perf_sample_data;
+struct task_struct;
 
 #define HW_BREAKPOINT_ALIGN 0x7
 
arch/powerpc/include/asm/processor.h +2 -3
index c4b36a494a63..74ed654928f0 100644
@@ -39,10 +39,9 @@
 #endif /* CONFIG_PPC64 */
 
 #ifndef __ASSEMBLY__
-#include <linux/compiler.h>
-#include <linux/cache.h>
+#include <linux/types.h>
+#include <asm/thread_info.h>
 #include <asm/ptrace.h>
-#include <asm/types.h>
 #include <asm/hw_breakpoint.h>
 
 /* We do _not_ want to define new machine types at all, those must die
Signature · 1 line
2.13.3
#9 lore raw
In reply to Christophe Leroy
Quoted 6 lines · Christophe Leroy

The purpose of this serie is to limit the number of includes to only the necessary ones in order to reduce the number of files recompiled everytime a header file is modified.

This is the start of the work, please provide feedback if any so that I don't go in the wrong direction.

Thanks for starting on this.

There's a few build errors, summary below.

http://kisskb.ellerman.id.au/kisskb/head/14031/

cheers

arch/powerpc/kernel/machine_kexec.c:140:26: error: 'KDUMP_KERNELBASE' undeclared (first use in this function):
corenet32_smp_defconfig powerpc
corenet32_smp_defconfig powerpc-5.3
g5_defconfig powerpc
g5_defconfig powerpc-5.3
gamecube_defconfig powerpc
gamecube_defconfig powerpc-5.3
maple_defconfig powerpc
maple_defconfig powerpc-5.3
mpc85xx_defconfig powerpc
mpc85xx_defconfig powerpc-5.3
mpc85xx_smp_defconfig powerpc
mpc85xx_smp_defconfig powerpc-5.3
mpc86xx_defconfig powerpc
mpc86xx_defconfig powerpc-5.3
powernv_defconfig+NO_NUMA ppc64le
powernv_defconfig+NO_PERF ppc64le
powernv_defconfig+NO_RADIX ppc64le
powernv_defconfig+STRICT_RWX ppc64le
powernv_defconfig+THIN ppc64le
powerpc-randconfig powerpc-5.3
ppc64e_defconfig+KEXEC powerpc
ppc64e_defconfig+KEXEC powerpc-5.3
ps3_defconfig powerpc
ps3_defconfig powerpc-5.3
pseries_defconfig powerpc
pseries_defconfig powerpc-5.3
pseries_defconfig+NO_MEMORY_HOTPLUG powerpc
pseries_defconfig+NO_MEMORY_HOTPLUG powerpc-5.3
pseries_defconfig+NO_MEMORY_HOTREMOVE powerpc
pseries_defconfig+NO_SPLPAR powerpc
pseries_defconfig+NO_SPLPAR powerpc-5.3
pseries_le_defconfig ppc64le
pseries_le_defconfig+NO_NUMA ppc64le
pseries_le_defconfig+NO_SPLPAR ppc64le
skiroot_defconfig ppc64le
wii_defconfig powerpc
wii_defconfig powerpc-5.3

arch/powerpc/include/asm/cputable.h:146:23: error: implicit declaration of function 'ASM_CONST' [-Werror=implicit-function-declaration]:
amigaone_defconfig powerpc-5.3
corenet_basic_defconfig powerpc-5.3
holly_defconfig powerpc-5.3
mpc85xx_basic_defconfig powerpc-5.3
pmac32_defconfig powerpc-5.3
pmac32_defconfig+KVM powerpc-5.3
pmac32_defconfig+kexec powerpc-5.3

arch/powerpc/include/asm/cputable.h:538:6: error: enumerator value for 'CPU_FTRS_POSSIBLE' is not an integer constant:
44x/akebono_defconfig powerpc
44x/akebono_defconfig powerpc-5.3
44x/currituck_defconfig powerpc
44x/currituck_defconfig powerpc-5.3
amigaone_defconfig powerpc
amigaone_defconfig powerpc-5.3
chrp32_defconfig powerpc
chrp32_defconfig powerpc-5.3
corenet_basic_defconfig powerpc
corenet_basic_defconfig powerpc-5.3
holly_defconfig powerpc
holly_defconfig powerpc-5.3
mpc85xx_basic_defconfig powerpc
mpc85xx_basic_defconfig powerpc-5.3
pmac32_defconfig powerpc
pmac32_defconfig powerpc-5.3
pmac32_defconfig+KVM powerpc
pmac32_defconfig+KVM powerpc-5.3
pmac32_defconfig+SMP powerpc
pmac32_defconfig+SMP powerpc-5.3
pmac32_defconfig+kexec powerpc
pmac32_defconfig+kexec powerpc-5.3
ppc6xx_defconfig powerpc
ppc6xx_defconfig powerpc-5.3

arch/powerpc/include/asm/cputable.h:614:6: error: enumerator value for 'CPU_FTRS_ALWAYS' is not an integer constant:
44x/akebono_defconfig powerpc
44x/akebono_defconfig powerpc-5.3
44x/currituck_defconfig powerpc
44x/currituck_defconfig powerpc-5.3
amigaone_defconfig powerpc
amigaone_defconfig powerpc-5.3
chrp32_defconfig powerpc
chrp32_defconfig powerpc-5.3
corenet_basic_defconfig powerpc
corenet_basic_defconfig powerpc-5.3
holly_defconfig powerpc
holly_defconfig powerpc-5.3
mpc85xx_basic_defconfig powerpc
mpc85xx_basic_defconfig powerpc-5.3
pmac32_defconfig powerpc
pmac32_defconfig powerpc-5.3
pmac32_defconfig+KVM powerpc
pmac32_defconfig+KVM powerpc-5.3
pmac32_defconfig+SMP powerpc
pmac32_defconfig+SMP powerpc-5.3
pmac32_defconfig+kexec powerpc
pmac32_defconfig+kexec powerpc-5.3
ppc6xx_defconfig powerpc
ppc6xx_defconfig powerpc-5.3

arch/powerpc/include/asm/cputable.h:505:6: error: implicit declaration of function 'ASM_CONST' [-Werror=implicit-function-declaration]:
amigaone_defconfig powerpc
chrp32_defconfig powerpc
corenet_basic_defconfig powerpc
holly_defconfig powerpc
mpc85xx_basic_defconfig powerpc
pmac32_defconfig powerpc
pmac32_defconfig+KVM powerpc
pmac32_defconfig+SMP powerpc
pmac32_defconfig+kexec powerpc
ppc6xx_defconfig powerpc

arch/powerpc/kernel/machine_kexec.c:155:22: error: 'KDUMP_KERNELBASE' undeclared (first use in this function):
44x/fsp2_defconfig powerpc-5.3

arch/powerpc/include/asm/cputable.h:158:32: error: implicit declaration of function 'ASM_CONST' [-Werror=implicit-function-declaration]:
44x/akebono_defconfig powerpc-5.3
44x/currituck_defconfig powerpc-5.3
chrp32_defconfig powerpc-5.3
pmac32_defconfig+SMP powerpc-5.3
ppc6xx_defconfig powerpc-5.3

arch/powerpc/include/asm/cputable.h:515:6: error: implicit declaration of function 'ASM_CONST' [-Werror=implicit-function-declaration]:
44x/akebono_defconfig powerpc
44x/currituck_defconfig powerpc