rtc: cmos: Refactor code by using the new dmi_get_bios_year() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 23 Jan 2020 13:14:37 +0000 (15:14 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 25 Jan 2020 20:55:14 +0000 (21:55 +0100)
Refactor code by using the new dmi_get_bios_year() helper instead of
open coding its functionality. This also makes logic slightly clearer.

No changes intended.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200123131437.28157-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-cmos.c

index aee55b658f856d5cb8690196c8f1e777a8e2c51f..b795fe4cbd2e9bb51a97292c6d6b4777a633a348 100644 (file)
@@ -1197,8 +1197,6 @@ static void rtc_wake_off(struct device *dev)
 /* Enable use_acpi_alarm mode for Intel platforms no earlier than 2015 */
 static void use_acpi_alarm_quirks(void)
 {
-       int year;
-
        if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
                return;
 
@@ -1208,8 +1206,10 @@ static void use_acpi_alarm_quirks(void)
        if (!is_hpet_enabled())
                return;
 
-       if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year >= 2015)
-               use_acpi_alarm = true;
+       if (dmi_get_bios_year() < 2015)
+               return;
+
+       use_acpi_alarm = true;
 }
 #else
 static inline void use_acpi_alarm_quirks(void) { }