[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/3] x86/dmi: Drop trivial callback functions



dmi_check_system() returns the number of matches.  This being nonzero is more
efficient than calling into 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@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/ioport_emulate.c       | 18 +++---------------
 xen/arch/x86/x86_64/mmconf-fam10h.c | 10 ++--------
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/ioport_emulate.c b/xen/arch/x86/ioport_emulate.c
index c2aded7668..504bc513e2 100644
--- a/xen/arch/x86/ioport_emulate.c
+++ b/xen/arch/x86/ioport_emulate.c
@@ -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);
diff --git a/xen/arch/x86/x86_64/mmconf-fam10h.c 
b/xen/arch/x86/x86_64/mmconf-fam10h.c
index f997688ad4..fa2f5b4881 100644
--- a/xen/arch/x86/x86_64/mmconf-fam10h.c
+++ b/xen/arch/x86/x86_64/mmconf-fam10h.c
@@ -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;
 }
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.