X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-generic%2Frtc.h;h=d3238f1f70a684c109df2f4b976e2bc89eff22f2;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=1a1ea0200e1fe523a6d0e532c1fa2f7e801c0af4;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h index 1a1ea0200..d3238f1f7 100644 --- a/include/asm-generic/rtc.h +++ b/include/asm-generic/rtc.h @@ -1,5 +1,5 @@ /* - * inclue/asm-generic/rtc.h + * include/asm-generic/rtc.h * * Author: Tom Rini * @@ -46,7 +46,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) { unsigned long uip_watchdog = jiffies; unsigned char ctrl; -#ifdef CONFIG_DECSTATION +#ifdef CONFIG_MACH_DECSTATION unsigned int real_year; #endif @@ -79,7 +79,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) time->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); time->tm_mon = CMOS_READ(RTC_MONTH); time->tm_year = CMOS_READ(RTC_YEAR); -#ifdef CONFIG_DECSTATION +#ifdef CONFIG_MACH_DECSTATION real_year = CMOS_READ(RTC_DEC_YEAR); #endif ctrl = CMOS_READ(RTC_CONTROL); @@ -95,7 +95,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) BCD_TO_BIN(time->tm_year); } -#ifdef CONFIG_DECSTATION +#ifdef CONFIG_MACH_DECSTATION time->tm_year += real_year - 72; #endif @@ -114,10 +114,11 @@ 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; -#ifdef CONFIG_DECSTATION +#ifdef CONFIG_MACH_DECSTATION unsigned int real_yrs, leap_yr; #endif @@ -131,8 +132,8 @@ static inline int set_rtc_time(struct rtc_time *time) if (yrs > 255) /* They are unsigned */ return -EINVAL; - spin_lock_irq(&rtc_lock); -#ifdef CONFIG_DECSTATION + spin_lock_irqsave(&rtc_lock, flags); +#ifdef CONFIG_MACH_DECSTATION real_yrs = yrs; leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) || !((yrs + 1900) % 400)); @@ -152,7 +153,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; } @@ -174,7 +175,7 @@ static inline int set_rtc_time(struct rtc_time *time) save_freq_select = CMOS_READ(RTC_FREQ_SELECT); CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); -#ifdef CONFIG_DECSTATION +#ifdef CONFIG_MACH_DECSTATION CMOS_WRITE(real_yrs, RTC_DEC_YEAR); #endif CMOS_WRITE(yrs, RTC_YEAR); @@ -187,7 +188,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; }