[PATCH 1/5] x86/build: Rework includes in genapic/probe.c

Andrew Cooper posted 5 patches 2 months, 2 weeks ago
[PATCH 1/5] x86/build: Rework includes in genapic/probe.c
Posted by Andrew Cooper 2 months, 2 weeks ago
probe.c includes a large number of headers which are unused, and not from
churn so far as I can see in history.  Strip back to a reasonable set.

One complication is that genapic.h has to include xen/cpumask.h because
there's no way to forward declare a cpumask_t.

Also strip trailing whitespace while adjusting the file.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/x86/genapic/probe.c       | 34 ++++++++++++++----------------
 xen/arch/x86/include/asm/genapic.h |  2 ++
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c
index 10ceeae4d247..946c3d3ce364 100644
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -1,25 +1,23 @@
-/* Copyright 2003 Andi Kleen, SuSE Labs. 
- * Subject to the GNU Public License, v.2 
- * 
+/* Copyright 2003 Andi Kleen, SuSE Labs.
+ * Subject to the GNU Public License, v.2
+ *
  * Generic x86 APIC driver probe layer.
- */  
-#include <xen/cpumask.h>
-#include <xen/string.h>
-#include <xen/kernel.h>
-#include <xen/ctype.h>
+ */
+#include <xen/bug.h>
+#include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/param.h>
-#include <asm/cache.h>
-#include <asm/fixmap.h>
-#include <asm/mpspec.h>
-#include <asm/apicdef.h>
-#include <asm/mach-generic/mach_apic.h>
-#include <asm/setup.h>
+#include <xen/sections.h>
+#include <xen/string.h>
+#include <xen/types.h>
+
+#include <asm/apic.h>
+#include <asm/genapic.h>
 
 struct genapic __ro_after_init genapic;
 
 static const struct genapic *const __initconstrel apic_probe[] = {
-	&apic_bigsmp, 
+	&apic_bigsmp,
 	&apic_default,	/* must be last */
 	NULL,
 };
@@ -57,8 +55,8 @@ static int __init cf_check genapic_apic_force(const char *str)
 }
 custom_param("apic", genapic_apic_force);
 
-void __init generic_apic_probe(void) 
-{ 
+void __init generic_apic_probe(void)
+{
 	int i;
 
 	record_boot_APIC_mode();
@@ -75,4 +73,4 @@ void __init generic_apic_probe(void)
 	BUG_ON(!genapic.name);
 
 	printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
-} 
+}
diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h
index 970df8ffe0a4..a694371c6d16 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -1,6 +1,8 @@
 #ifndef _ASM_GENAPIC_H
 #define _ASM_GENAPIC_H 1
 
+#include <xen/cpumask.h>
+
 /*
  * Generic APIC driver interface.
  *
-- 
2.39.2


Re: [PATCH 1/5] x86/build: Rework includes in genapic/probe.c
Posted by Jan Beulich 2 months, 1 week ago
On 06.09.2024 00:08, Andrew Cooper wrote:
> probe.c includes a large number of headers which are unused, and not from
> churn so far as I can see in history.  Strip back to a reasonable set.
> 
> One complication is that genapic.h has to include xen/cpumask.h because
> there's no way to forward declare a cpumask_t.
> 
> Also strip trailing whitespace while adjusting the file.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>