• Jean Delvare's avatar
    firmware: dmi: Optimize dmi_matches · 8cf4e6a0
    Jean Delvare authored
    Function dmi_matches can me made a bit faster:
    
    * The documented purpose of dmi_initialized is to catch too early
      calls to dmi_check_system(). I'm not fully convinced it justifies
      slowing down the initialization of all systems out there, but at
      least the check should not have been moved from dmi_check_system()
      to dmi_matches(). dmi_matches() is being called for every entry of
      the table passed to dmi_check_system(), causing the same redundant
      check to be performed again and again. So move it back to
      dmi_check_system(), reverting this specific portion of commit
      d7b1956f ("DMI: Introduce dmi_first_match to make the interface
      more flexible").
    
    * Don't check for the exact_match flag again when we already know its
      value.
    Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
    Fixes: d7b1956f ("DMI: Introduce dmi_first_match to make the interface more flexible")
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Daniel Vetter <daniel.vetter@intel.com>
    Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: Jeff Garzik <jgarzik@redhat.com>
    8cf4e6a0
dmi_scan.c 26.2 KB