From: Geert Uytterhoeven It updates include/asm-{generic,parisc}/rtc.h for the recent changes in drivers/char/genrtc.c and include/asm-{m68k,ppc}/rtc.h. get_rtc_time() now returns some RTC flags instead of a 0/-1 success/failure indicator. These flags include: - RTC_BATT_BAD: RTC battery is bad (can be detected on PA-RISC) - RTC_24H: Clock runs in 24 hour mode Most of these flags are the same as drivers/char/rtc.c, but RTC_BATT_BAD is a new one. include/asm-generic/rtc.h | 7 ++++--- include/asm-parisc/rtc.h | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff -puN include/asm-generic/rtc.h~gen_rtc-compile-fix include/asm-generic/rtc.h --- 25/include/asm-generic/rtc.h~gen_rtc-compile-fix 2003-04-09 01:57:19.000000000 -0700 +++ 25-akpm/include/asm-generic/rtc.h 2003-04-09 01:57:19.000000000 -0700 @@ -22,9 +22,8 @@ #define RTC_AIE 0x20 /* alarm interrupt enable */ #define RTC_UIE 0x10 /* update-finished interrupt enable */ -extern void gen_rtc_interrupt(unsigned long); - /* some dummy definitions */ +#define RTC_BATT_BAD 0x100 /* battery bad */ #define RTC_SQWE 0x08 /* enable square-wave output */ #define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ @@ -43,7 +42,7 @@ static inline unsigned char rtc_is_updat return uip; } -static inline void get_rtc_time(struct rtc_time *time) +static inline unsigned int get_rtc_time(struct rtc_time *time) { unsigned long uip_watchdog = jiffies; unsigned char ctrl; @@ -108,6 +107,8 @@ static inline void get_rtc_time(struct r time->tm_year += 100; time->tm_mon--; + + return RTC_24H; } /* Set the current date and time in the real time clock. */ diff -puN include/asm-parisc/rtc.h~gen_rtc-compile-fix include/asm-parisc/rtc.h --- 25/include/asm-parisc/rtc.h~gen_rtc-compile-fix 2003-04-09 01:57:19.000000000 -0700 +++ 25-akpm/include/asm-parisc/rtc.h 2003-04-09 01:57:19.000000000 -0700 @@ -24,7 +24,7 @@ #define RTC_AIE 0x20 /* alarm interrupt enable */ #define RTC_UIE 0x10 /* update-finished interrupt enable */ -extern void gen_rtc_interrupt(unsigned long); +#define RTC_BATT_BAD 0x100 /* battery bad */ /* some dummy definitions */ #define RTC_SQWE 0x08 /* enable square-wave output */ @@ -44,16 +44,16 @@ static const unsigned short int __mon_yd { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } }; -static int get_rtc_time(struct rtc_time *wtime) +static inline unsigned int get_rtc_time(struct rtc_time *wtime) { struct pdc_tod tod_data; long int days, rem, y; const unsigned short int *ip; if(pdc_tod_read(&tod_data) < 0) - return -1; + return RTC_24H | RTC_BATT_BAD; + - // most of the remainder of this function is: // Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc. // This was originally a part of the GNU C Library. @@ -69,7 +69,7 @@ static int get_rtc_time(struct rtc_time wtime->tm_sec = rem % 60; y = 1970; - + #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0)) #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400)) @@ -92,8 +92,8 @@ static int get_rtc_time(struct rtc_time days -= ip[y]; wtime->tm_mon = y; wtime->tm_mday = days + 1; - - return 0; + + return RTC_24H; } static int set_rtc_time(struct rtc_time *wtime) _