]> xenbits.xensource.com Git - xen.git/commitdiff
x86/APIC: drop probe_default()
authorJan Beulich <jbeulich@suse.com>
Fri, 5 Nov 2021 12:34:57 +0000 (13:34 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 29 Nov 2021 13:53:05 +0000 (13:53 +0000)
The function does nothing but return success. Simply treat absence of a
probe hook to mean just this. This then eliminates the (purely
theoretical at this point) risk of trying to call through
apic_x2apic_{cluster,phys}'s respective NULL pointers.

While doing this also eliminate generic_apic_probe()'s "changed"
variable: apic_probe[]'s default entry will now be used unconditionally
in yet more obvious a way, such that separately setting genapic from
apic_default is (hopefully) no longer justified. Yet that was the main
purpose of the variable.

To help prove that apic_default's probe() hook doesn't get used
elsewhere, further make apic_probe[] static at this occasion.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/genapic/default.c
xen/arch/x86/genapic/probe.c

index bfd068cdc69fc4db61faaaa0e24b3d7c917af174..2c63c1f9179a3ad58579fb9b4064348b209c68df 100644 (file)
 #include <asm/io_apic.h>
 
 /* should be called last. */
-static __init int probe_default(void)
-{ 
-       return 1;
-} 
-
 const struct genapic __initconstrel apic_default = {
-       APIC_INIT("default", probe_default),
+       APIC_INIT("default", NULL),
        GENAPIC_FLAT
 };
index b963dc5ec0844ab03e63c0da69195c96fd221852..1ee6cd73cd887fa2c70adef6e276d8f3a81be862 100644 (file)
@@ -18,7 +18,7 @@
 
 struct genapic __read_mostly genapic;
 
-const struct genapic *const __initconstrel apic_probe[] = {
+static const struct genapic *const __initconstrel apic_probe[] = {
        &apic_bigsmp, 
        &apic_default,  /* must be last */
        NULL,
@@ -59,22 +59,20 @@ custom_param("apic", genapic_apic_force);
 
 void __init generic_apic_probe(void) 
 { 
-       bool changed;
        int i;
 
        record_boot_APIC_mode();
 
        check_x2apic_preenabled();
-       cmdline_apic = changed = !!genapic.name;
 
-       for (i = 0; !changed && apic_probe[i]; i++) { 
-               if (apic_probe[i]->probe()) {
-                       changed = 1;
+       cmdline_apic = genapic.name;
+
+       for (i = 0; !genapic.name && apic_probe[i]; i++) {
+               if (!apic_probe[i]->probe || apic_probe[i]->probe())
                        genapic = *apic_probe[i];
-               } 
        }
-       if (!changed) 
-               genapic = apic_default;
+
+       BUG_ON(!genapic.name);
 
        printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
 }