]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/dmi: Drop trivial callback functions
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 24 Jul 2019 14:05:16 +0000 (15:05 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 25 Jul 2019 12:00:35 +0000 (13:00 +0100)
dmi_check_system() returns the number of matches.  This being nonzero is more
efficient than making a function pointer call to a trivial function to modify
a variable.

No functional change, but this results in less compiled code, which is
also (fractionally) quicker to run.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/ioport_emulate.c
xen/arch/x86/x86_64/mmconf-fam10h.c

index c2aded7668d3bbdd912ca2dc1b921f4b1e0be257..504bc513e2437b5a3d953da09385cf9ec76f5543 100644 (file)
@@ -33,12 +33,6 @@ static bool ioemul_handle_proliant_quirk(
     return true;
 }
 
-static int __init proliant_quirk(struct dmi_system_id *d)
-{
-    ioemul_handle_quirk = ioemul_handle_proliant_quirk;
-    return 0;
-}
-
 /* This table is the set of system-specific I/O emulation hooks. */
 static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
     /*
@@ -46,7 +40,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
      * 'special' SMM goodness.
      */
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant DL3xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -54,7 +47,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
         },
     },
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant DL5xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -62,7 +54,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
         },
     },
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant DL7xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -70,7 +61,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
         },
     },
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant ML3xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -78,7 +68,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
         },
     },
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant ML5xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -86,7 +75,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
         },
     },
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant BL2xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -94,7 +82,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
         },
     },
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant BL4xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -102,7 +89,6 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
         },
     },
     {
-        .callback = proliant_quirk,
         .ident = "HP ProLiant BL6xx",
         .matches = {
             DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -114,7 +100,9 @@ static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
 
 static int __init ioport_quirks_init(void)
 {
-    dmi_check_system(ioport_quirks_tbl);
+    if ( dmi_check_system(ioport_quirks_tbl) )
+        ioemul_handle_quirk = ioemul_handle_proliant_quirk;
+
     return 0;
 }
 __initcall(ioport_quirks_init);
index f997688ad459c6859923a9cc688f15fbb02314ee..fa2f5b4881a9fe731b675fd7cd3107cbb0e6ddb5 100644 (file)
@@ -185,15 +185,8 @@ void fam10h_check_enable_mmcfg(void)
        wrmsrl(MSR_FAM10H_MMIO_CONF_BASE, val);
 }
 
-static int __init set_check_enable_amd_mmconf(struct dmi_system_id *d)
-{
-        pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
-        return 0;
-}
-
 static struct dmi_system_id __initdata mmconf_dmi_table[] = {
        {
-               .callback = set_check_enable_amd_mmconf,
                .ident = "Sun Microsystems Machine",
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
@@ -204,5 +197,6 @@ static struct dmi_system_id __initdata mmconf_dmi_table[] = {
 
 void __init check_enable_amd_mmconf_dmi(void)
 {
-       dmi_check_system(mmconf_dmi_table);
+       if (dmi_check_system(mmconf_dmi_table))
+               pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
 }