[PATCH] RTC: Fix up some RTC whitespace and style

Fix up some RTC whitespace and style

Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Matt Mackall 2006-03-28 01:56:09 -08:00 committed by Linus Torvalds
parent 4c2e6f6a06
commit 41623b064f
3 changed files with 36 additions and 30 deletions

View File

@ -129,8 +129,8 @@ unsigned long chrp_get_rtc_time(void)
year = chrp_cmos_clock_read(RTC_YEAR); year = chrp_cmos_clock_read(RTC_YEAR);
} while (sec != chrp_cmos_clock_read(RTC_SECONDS)); } while (sec != chrp_cmos_clock_read(RTC_SECONDS));
if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
{ || RTC_ALWAYS_BCD) {
BCD_TO_BIN(sec); BCD_TO_BIN(sec);
BCD_TO_BIN(min); BCD_TO_BIN(min);
BCD_TO_BIN(hour); BCD_TO_BIN(hour);
@ -138,7 +138,9 @@ unsigned long chrp_get_rtc_time(void)
BCD_TO_BIN(mon); BCD_TO_BIN(mon);
BCD_TO_BIN(year); BCD_TO_BIN(year);
} }
if ((year += 1900) < 1970)
year += 1900;
if (year < 1970)
year += 100; year += 100;
return mktime(year, mon, day, hour, min, sec); return mktime(year, mon, day, hour, min, sec);
} }

View File

@ -34,8 +34,7 @@ unsigned long get_cmos_time(void)
year = CMOS_READ(RTC_YEAR); year = CMOS_READ(RTC_YEAR);
} while (sec != CMOS_READ(RTC_SECONDS)); } while (sec != CMOS_READ(RTC_SECONDS));
if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
{
BCD_TO_BIN(sec); BCD_TO_BIN(sec);
BCD_TO_BIN(min); BCD_TO_BIN(min);
BCD_TO_BIN(hour); BCD_TO_BIN(hour);
@ -43,9 +42,13 @@ unsigned long get_cmos_time(void)
BCD_TO_BIN(mon); BCD_TO_BIN(mon);
BCD_TO_BIN(year); BCD_TO_BIN(year);
} }
spin_unlock(&rtc_lock); spin_unlock(&rtc_lock);
if ((year += 1900) < 1970)
year += 1900;
if (year < 1970)
year += 100; year += 100;
return mktime(year, mon, day, hour, min, sec); return mktime(year, mon, day, hour, min, sec);
} }

View File

@ -92,8 +92,7 @@ static inline unsigned long mach_get_cmos_time(void)
year = CMOS_READ(RTC_YEAR); year = CMOS_READ(RTC_YEAR);
} while (sec != CMOS_READ(RTC_SECONDS)); } while (sec != CMOS_READ(RTC_SECONDS));
if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
{
BCD_TO_BIN(sec); BCD_TO_BIN(sec);
BCD_TO_BIN(min); BCD_TO_BIN(min);
BCD_TO_BIN(hour); BCD_TO_BIN(hour);
@ -101,7 +100,9 @@ static inline unsigned long mach_get_cmos_time(void)
BCD_TO_BIN(mon); BCD_TO_BIN(mon);
BCD_TO_BIN(year); BCD_TO_BIN(year);
} }
if ((year += 1900) < 1970)
year += 1900;
if (year < 1970)
year += 100; year += 100;
return mktime(year, mon, day, hour, min, sec); return mktime(year, mon, day, hour, min, sec);