firmware/dmi_scan: Uninline dmi_get_bios_year() helper
Uninline dmi_get_bios_year() which, in particular, allows us
to optimize it in the future.
While doing this, convert the function to return an error code
when BIOS date is not present or not parsable, or CONFIG_DMI=n.
Additionally, during the move, add a bit of documentation.
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J . Wysocki <rjw@rjwysocki.net>
Cc: linux-acpi@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Fixes: 492a1abd61
("dmi: Introduce the dmi_get_bios_year() helper function")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

parent
4e07db9c8d
commit
3af3452586
@@ -1004,6 +1004,26 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL(dmi_get_date);
|
||||
|
||||
/**
|
||||
* dmi_get_bios_year - get a year out of DMI_BIOS_DATE field
|
||||
*
|
||||
* Returns year on success, -ENXIO if DMI is not selected,
|
||||
* or a different negative error code if DMI field is not present
|
||||
* or not parseable.
|
||||
*/
|
||||
int dmi_get_bios_year(void)
|
||||
{
|
||||
bool exists;
|
||||
int year;
|
||||
|
||||
exists = dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL);
|
||||
if (!exists)
|
||||
return -ENODATA;
|
||||
|
||||
return year ? year : -ERANGE;
|
||||
}
|
||||
EXPORT_SYMBOL(dmi_get_bios_year);
|
||||
|
||||
/**
|
||||
* dmi_walk - Walk the DMI table and get called back for every record
|
||||
* @decode: Callback function
|
||||
|
Reference in New Issue
Block a user