]> err.no Git - linux-2.6/blobdiff - include/asm-generic/rtc.h
Merge git://git.infradead.org/mtd-2.6
[linux-2.6] / include / asm-generic / rtc.h
index cef08db34ada8a59b109efaee0996815e4e77fb7..dd1bed860e6487a3c325c2dfd66570efe8616066 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * inclue/asm-generic/rtc.h
+ * include/asm-generic/rtc.h
  *
  * Author: Tom Rini <trini@mvista.com>
  *
 static inline unsigned char rtc_is_updating(void)
 {
        unsigned char uip;
+       unsigned long flags;
 
-       spin_lock_irq(&rtc_lock);
+       spin_lock_irqsave(&rtc_lock, flags);
        uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
-       spin_unlock_irq(&rtc_lock);
+       spin_unlock_irqrestore(&rtc_lock, flags);
        return uip;
 }
 
@@ -46,6 +47,8 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
 {
        unsigned long uip_watchdog = jiffies;
        unsigned char ctrl;
+       unsigned long flags;
+
 #ifdef CONFIG_MACH_DECSTATION
        unsigned int real_year;
 #endif
@@ -72,7 +75,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
         * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
         * by the RTC when initially set to a non-zero value.
         */
-       spin_lock_irq(&rtc_lock);
+       spin_lock_irqsave(&rtc_lock, flags);
        time->tm_sec = CMOS_READ(RTC_SECONDS);
        time->tm_min = CMOS_READ(RTC_MINUTES);
        time->tm_hour = CMOS_READ(RTC_HOURS);
@@ -83,7 +86,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
        real_year = CMOS_READ(RTC_DEC_YEAR);
 #endif
        ctrl = CMOS_READ(RTC_CONTROL);
-       spin_unlock_irq(&rtc_lock);
+       spin_unlock_irqrestore(&rtc_lock, flags);
 
        if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
        {
@@ -114,6 +117,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
 /* Set the current date and time in the real time clock. */
 static inline int set_rtc_time(struct rtc_time *time)
 {
+       unsigned long flags;
        unsigned char mon, day, hrs, min, sec;
        unsigned char save_control, save_freq_select;
        unsigned int yrs;
@@ -131,7 +135,7 @@ static inline int set_rtc_time(struct rtc_time *time)
        if (yrs > 255)  /* They are unsigned */
                return -EINVAL;
 
-       spin_lock_irq(&rtc_lock);
+       spin_lock_irqsave(&rtc_lock, flags);
 #ifdef CONFIG_MACH_DECSTATION
        real_yrs = yrs;
        leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
@@ -152,7 +156,7 @@ static inline int set_rtc_time(struct rtc_time *time)
         * whether the chip is in binary mode or not.
         */
        if (yrs > 169) {
-               spin_unlock_irq(&rtc_lock);
+               spin_unlock_irqrestore(&rtc_lock, flags);
                return -EINVAL;
        }
 
@@ -187,7 +191,7 @@ static inline int set_rtc_time(struct rtc_time *time)
        CMOS_WRITE(save_control, RTC_CONTROL);
        CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
 
-       spin_unlock_irq(&rtc_lock);
+       spin_unlock_irqrestore(&rtc_lock, flags);
 
        return 0;
 }