Commit a802b873 authored by Andrew Morton's avatar Andrew Morton Committed by James Bottomley

[PATCH] Fix gen_rtc compilation error

From: Geert Uytterhoeven <geert@linux-m68k.org>

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.
parent ed49cb09
...@@ -22,9 +22,8 @@ ...@@ -22,9 +22,8 @@
#define RTC_AIE 0x20 /* alarm interrupt enable */ #define RTC_AIE 0x20 /* alarm interrupt enable */
#define RTC_UIE 0x10 /* update-finished interrupt enable */ #define RTC_UIE 0x10 /* update-finished interrupt enable */
extern void gen_rtc_interrupt(unsigned long);
/* some dummy definitions */ /* some dummy definitions */
#define RTC_BATT_BAD 0x100 /* battery bad */
#define RTC_SQWE 0x08 /* enable square-wave output */ #define RTC_SQWE 0x08 /* enable square-wave output */
#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ #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 */ #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
...@@ -43,7 +42,7 @@ static inline unsigned char rtc_is_updating(void) ...@@ -43,7 +42,7 @@ static inline unsigned char rtc_is_updating(void)
return uip; 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 long uip_watchdog = jiffies;
unsigned char ctrl; unsigned char ctrl;
...@@ -108,6 +107,8 @@ static inline void get_rtc_time(struct rtc_time *time) ...@@ -108,6 +107,8 @@ static inline void get_rtc_time(struct rtc_time *time)
time->tm_year += 100; time->tm_year += 100;
time->tm_mon--; time->tm_mon--;
return RTC_24H;
} }
/* Set the current date and time in the real time clock. */ /* Set the current date and time in the real time clock. */
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define RTC_AIE 0x20 /* alarm interrupt enable */ #define RTC_AIE 0x20 /* alarm interrupt enable */
#define RTC_UIE 0x10 /* update-finished 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 */ /* some dummy definitions */
#define RTC_SQWE 0x08 /* enable square-wave output */ #define RTC_SQWE 0x08 /* enable square-wave output */
...@@ -44,16 +44,16 @@ static const unsigned short int __mon_yday[2][13] = ...@@ -44,16 +44,16 @@ static const unsigned short int __mon_yday[2][13] =
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } { 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; struct pdc_tod tod_data;
long int days, rem, y; long int days, rem, y;
const unsigned short int *ip; const unsigned short int *ip;
if(pdc_tod_read(&tod_data) < 0) if(pdc_tod_read(&tod_data) < 0)
return -1; return RTC_24H | RTC_BATT_BAD;
// most of the remainder of this function is: // most of the remainder of this function is:
// Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc. // Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc.
// This was originally a part of the GNU C Library. // This was originally a part of the GNU C Library.
...@@ -69,7 +69,7 @@ static int get_rtc_time(struct rtc_time *wtime) ...@@ -69,7 +69,7 @@ static int get_rtc_time(struct rtc_time *wtime)
wtime->tm_sec = rem % 60; wtime->tm_sec = rem % 60;
y = 1970; y = 1970;
#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0)) #define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
#define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400)) #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 *wtime) ...@@ -92,8 +92,8 @@ static int get_rtc_time(struct rtc_time *wtime)
days -= ip[y]; days -= ip[y];
wtime->tm_mon = y; wtime->tm_mon = y;
wtime->tm_mday = days + 1; wtime->tm_mday = days + 1;
return 0; return RTC_24H;
} }
static int set_rtc_time(struct rtc_time *wtime) static int set_rtc_time(struct rtc_time *wtime)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment