X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fchar%2Fds1286.c;h=59146e3365bac8bbda37b45d33297c0c9d071b7e;hb=ec09cd562135158dcb8a6c08e5a9efa36febedb1;hp=21c8229f544388cfb2d75f68218abaac215b4c17;hpb=62322d2554d2f9680c8ace7bbf1f97d8fa84ad1a;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c index 21c8229..59146e3 100644 --- a/drivers/char/ds1286.c +++ b/drivers/char/ds1286.c @@ -104,7 +104,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, switch (cmd) { case RTC_AIE_OFF: /* Mask alarm int. enab. bit */ { - unsigned int flags; + unsigned long flags; unsigned char val; if (!capable(CAP_SYS_TIME)) @@ -120,7 +120,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, } case RTC_AIE_ON: /* Allow alarm interrupts. */ { - unsigned int flags; + unsigned long flags; unsigned char val; if (!capable(CAP_SYS_TIME)) @@ -136,7 +136,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, } case RTC_WIE_OFF: /* Mask watchdog int. enab. bit */ { - unsigned int flags; + unsigned long flags; unsigned char val; if (!capable(CAP_SYS_TIME)) @@ -152,7 +152,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, } case RTC_WIE_ON: /* Allow watchdog interrupts. */ { - unsigned int flags; + unsigned long flags; unsigned char val; if (!capable(CAP_SYS_TIME)) @@ -197,6 +197,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, hrs = alm_tm.tm_hour; min = alm_tm.tm_min; + sec = alm_tm.tm_sec; if (hrs >= 24) hrs = 0xff; @@ -204,9 +205,11 @@ static int ds1286_ioctl(struct inode *inode, struct file *file, if (min >= 60) min = 0xff; - BIN_TO_BCD(sec); - BIN_TO_BCD(min); - BIN_TO_BCD(hrs); + if (sec != 0) + return -EINVAL; + + min = BIN2BCD(min); + min = BIN2BCD(hrs); spin_lock(&ds1286_lock); rtc_write(hrs, RTC_HOURS_ALARM); @@ -434,7 +437,7 @@ static inline unsigned char ds1286_is_updating(void) static void ds1286_get_time(struct rtc_time *rtc_tm) { unsigned char save_control; - unsigned int flags; + unsigned long flags; unsigned long uip_watchdog = jiffies; /* @@ -494,7 +497,8 @@ static int ds1286_set_time(struct rtc_time *rtc_tm) { unsigned char mon, day, hrs, min, sec, leap_yr; unsigned char save_control; - unsigned int yrs, flags; + unsigned int yrs; + unsigned long flags; yrs = rtc_tm->tm_year + 1900; @@ -552,7 +556,7 @@ static int ds1286_set_time(struct rtc_time *rtc_tm) static void ds1286_get_alm_time(struct rtc_time *alm_tm) { unsigned char cmd; - unsigned int flags; + unsigned long flags; /* * Only the values that we read from the RTC are set. That