dmi: Introduce the dmi_get_bios_year() helper function
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 22 Feb 2018 12:59:20 +0000 (14:59 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 23 Feb 2018 07:20:30 +0000 (08:20 +0100)
The pattern to only extract the year portion of date is used in
several places and more users may come.

By using this helper they may create slightly cleaner code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[ Minor stylistic cleanup. ]
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-acpi@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Link: http://lkml.kernel.org/r/20180222125923.57385-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/dmi.h

index 46e151172d95429f72ff5d6b4252ea8d2d430305..0bade156e908e654c64d246c6fb7af7325df6e38 100644 (file)
@@ -147,4 +147,13 @@ static inline const struct dmi_system_id *
 
 #endif
 
+static inline int dmi_get_bios_year(void)
+{
+       int year;
+
+       dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL);
+
+       return year;
+}
+
 #endif /* __DMI_H__ */