x86/time: pull cmos_rtc_probe outside of function and rename

Rename cmos_rtc_probe to opt_cmos_rtc_probe in order to better describe it
being a command line option, and rename cmos_probe() function to
cmos_rtc_probe().

Also move opt_cmos_rtc_probe to being a static global variable in preparation
for further changes that will require the variable being global to the file.

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Roger Pau Monné authored and Jan Beulich committed 2024-09-11 12:52:57 +02:00
1 parent 5b4664b9e4
commit 6da090b4b7
1 file changed
+8 -7
+8 -7
View File
@@ -1291,7 +1291,10 @@ static bool __get_cmos_time(struct rtc_time *rtc)
return t1 <= SECONDS(1) && t2 < MILLISECS(3);
}
static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
static bool __read_mostly opt_cmos_rtc_probe;
boolean_param("cmos-rtc-probe", opt_cmos_rtc_probe);
static bool cmos_rtc_probe(struct rtc_time *rtc_p)
{
unsigned int seconds = 60;
@@ -1300,7 +1303,7 @@ static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
bool success = __get_cmos_time(rtc_p);
struct rtc_time rtc = *rtc_p;
if ( likely(!cmos_rtc_probe) )
if ( likely(!opt_cmos_rtc_probe) )
return true;
if ( !success ||
@@ -1332,8 +1335,6 @@ static unsigned long get_cmos_time(void)
{
unsigned long res;
struct rtc_time rtc;
static bool __read_mostly cmos_rtc_probe;
boolean_param("cmos-rtc-probe", cmos_rtc_probe);
if ( efi_enabled(EFI_RS) )
{
@@ -1343,12 +1344,12 @@ static unsigned long get_cmos_time(void)
}
if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
cmos_rtc_probe = false;
else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
opt_cmos_rtc_probe = false;
else if ( system_state < SYS_STATE_smp_boot && !opt_cmos_rtc_probe )
panic("System with no CMOS RTC advertised must be booted from EFI"
" (or with command line option \"cmos-rtc-probe\")\n");
if ( !cmos_probe(&rtc, cmos_rtc_probe) )
if ( !cmos_rtc_probe(&rtc) )
panic("No CMOS RTC found - system must be booted from EFI\n");
return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.