[PATCH] [3/5] Add warning when RTC clock reports binary

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <tglx@...>, <mingo@...>, <linux-kernel@...>
Date: Saturday, February 9, 2008 - 11:16 am

We tend to assume the RTC clock is BCD, so print a warning
if it claims to be binary.

Signed-off-by: Andi Kleen <ak@suse.de>

Index: linux/arch/x86/kernel/rtc.c
===================================================================
--- linux.orig/arch/x86/kernel/rtc.c
+++ linux/arch/x86/kernel/rtc.c
@@ -94,6 +94,8 @@ int mach_set_rtc_mmss(unsigned long nowt
 
 unsigned long mach_get_cmos_time(void)
 {
+	unsigned status;
+	static int warned;
 	unsigned int year, mon, day, hour, min, sec, century = 0;
 
 	/*
@@ -119,7 +121,13 @@ unsigned long mach_get_cmos_time(void)
 		century = CMOS_READ(acpi_gbl_FADT.century);
 #endif
 
-	if (RTC_ALWAYS_BCD || !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)) {
+	status = CMOS_READ(RTC_CONTROL);
+	if (RTC_ALWAYS_BCD && (status & RTC_DM_BINARY) && !warned) {
+		printk(KERN_INFO "RTC clock reports binary. Ignored\n");
+		warned = 1;
+	}
+
+	if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) {
 		BCD_TO_BIN(sec);
 		BCD_TO_BIN(min);
 		BCD_TO_BIN(hour);
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [4/5] Fix wrong comment, Andi Kleen, (Sat Feb 9, 11:17 am)
[PATCH] [3/5] Add warning when RTC clock reports binary , Andi Kleen, (Sat Feb 9, 11:16 am)
Re: [PATCH] [3/5] Add warning when RTC clock reports binary , Thomas Gleixner, (Sat Feb 16, 3:38 pm)
[PATCH] [2/5] Use 2000 offset for 32bit kernels, Andi Kleen, (Sat Feb 9, 11:16 am)
Re: [PATCH] [2/5] Use 2000 offset for 32bit kernels, Thomas Gleixner, (Sat Feb 16, 3:24 pm)
Re: [PATCH] [2/5] Use 2000 offset for 32bit kernels, Thomas Gleixner, (Wed Feb 20, 6:07 am)
Re: [PATCH] [2/5] Use 2000 offset for 32bit kernels, Andi Kleen, (Wed Feb 20, 6:23 am)