patch-2.3.16 linux/drivers/sbus/char/rtc.c
Next file: linux/drivers/sbus/char/sab82532.c
Previous file: linux/drivers/sbus/char/pcikbd.c
Back to the patch index
Back to the overall index
- Lines: 73
- Date:
Tue Aug 31 11:25:33 1999
- Orig file:
v2.3.15/linux/drivers/sbus/char/rtc.c
- Orig date:
Wed Jun 9 14:44:25 1999
diff -u --recursive --new-file v2.3.15/linux/drivers/sbus/char/rtc.c linux/drivers/sbus/char/rtc.c
@@ -1,4 +1,4 @@
-/* $Id: rtc.c,v 1.14 1999/06/03 15:02:38 davem Exp $
+/* $Id: rtc.c,v 1.17 1999/08/31 13:32:01 anton Exp $
*
* Linux/SPARC Real Time Clock Driver
* Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
@@ -29,12 +29,16 @@
/* Retrieve the current date and time from the real time clock. */
void get_rtc_time(struct rtc_time *t)
{
- register struct mostek48t02 *regs = mstk48t02_regs;
+ struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs;
unsigned long flags;
+ u8 tmp;
save_flags(flags);
cli();
- regs->creg |= MSTK_CREG_READ;
+
+ tmp = mostek_read(regs + MOSTEK_CREG);
+ tmp |= MSTK_CREG_READ;
+ mostek_write(regs + MOSTEK_CREG, tmp);
t->sec = MSTK_REG_SEC(regs);
t->min = MSTK_REG_MIN(regs);
@@ -44,19 +48,24 @@
t->month = MSTK_REG_MONTH(regs);
t->year = MSTK_CVT_YEAR( MSTK_REG_YEAR(regs) );
- regs->creg &= ~MSTK_CREG_READ;
+ tmp = mostek_read(regs + MOSTEK_CREG);
+ tmp &= ~MSTK_CREG_READ;
+ mostek_write(regs + MOSTEK_CREG, tmp);
restore_flags(flags);
}
/* Set the current date and time inthe real time clock. */
void set_rtc_time(struct rtc_time *t)
{
- register struct mostek48t02 *regs = mstk48t02_regs;
+ struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs;
unsigned long flags;
+ u8 tmp;
save_flags(flags);
cli();
- regs->creg |= MSTK_CREG_WRITE;
+ tmp = mostek_read(regs + MOSTEK_CREG);
+ tmp |= MSTK_CREG_WRITE;
+ mostek_write(regs + MOSTEK_CREG, tmp);
MSTK_SET_REG_SEC(regs,t->sec);
MSTK_SET_REG_MIN(regs,t->min);
@@ -66,7 +75,9 @@
MSTK_SET_REG_MONTH(regs,t->month);
MSTK_SET_REG_YEAR(regs,t->year - MSTK_YEAR_ZERO);
- regs->creg &= ~MSTK_CREG_WRITE;
+ tmp = mostek_read(regs + MOSTEK_CREG);
+ tmp &= ~MSTK_CREG_WRITE;
+ mostek_write(regs + MOSTEK_CREG, tmp);
restore_flags(flags);
}
@@ -145,7 +156,7 @@
#ifdef MODULE
int init_module(void)
#else
-__initfunc(int rtc_sun_init(void))
+int __init rtc_sun_init(void)
#endif
{
int error;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)