m68k: use bcd2bin/bin2bcd

This patch changes m68k to use the new bcd2bin/bin2bcd functions instead
of the obsolete BCD_TO_BIN/BIN_TO_BCD/BCD2BIN/BIN2BCD macros.

It also remove local bcd2bin/bin2bcd implementations
in favor of the global ones.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Adrian Bunk
2008-10-13 21:58:47 +02:00
committed by Linus Torvalds
parent 4aba41ea8b
commit 5b1d5f953b
6 changed files with 62 additions and 84 deletions

View File

@@ -52,15 +52,15 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Ensure clock and real-time-mode-register are accessible */
rtc->ctrl = RTC_READ;
memset(&wtime, 0, sizeof(struct rtc_time));
wtime.tm_sec = BCD2BIN(rtc->bcd_sec);
wtime.tm_min = BCD2BIN(rtc->bcd_min);
wtime.tm_hour = BCD2BIN(rtc->bcd_hr);
wtime.tm_mday = BCD2BIN(rtc->bcd_dom);
wtime.tm_mon = BCD2BIN(rtc->bcd_mth)-1;
wtime.tm_year = BCD2BIN(rtc->bcd_year);
wtime.tm_sec = bcd2bin(rtc->bcd_sec);
wtime.tm_min = bcd2bin(rtc->bcd_min);
wtime.tm_hour = bcd2bin(rtc->bcd_hr);
wtime.tm_mday = bcd2bin(rtc->bcd_dom);
wtime.tm_mon = bcd2bin(rtc->bcd_mth)-1;
wtime.tm_year = bcd2bin(rtc->bcd_year);
if (wtime.tm_year < 70)
wtime.tm_year += 100;
wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1;
wtime.tm_wday = bcd2bin(rtc->bcd_dow)-1;
rtc->ctrl = 0;
local_irq_restore(flags);
return copy_to_user(argp, &wtime, sizeof wtime) ?
@@ -104,12 +104,12 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
local_irq_save(flags);
rtc->ctrl = RTC_WRITE;
rtc->bcd_sec = BIN2BCD(sec);
rtc->bcd_min = BIN2BCD(min);
rtc->bcd_hr = BIN2BCD(hrs);
rtc->bcd_dom = BIN2BCD(day);
rtc->bcd_mth = BIN2BCD(mon);
rtc->bcd_year = BIN2BCD(yrs%100);
rtc->bcd_sec = bin2bcd(sec);
rtc->bcd_min = bin2bcd(min);
rtc->bcd_hr = bin2bcd(hrs);
rtc->bcd_dom = bin2bcd(day);
rtc->bcd_mth = bin2bcd(mon);
rtc->bcd_year = bin2bcd(yrs%100);
rtc->ctrl = 0;
local_irq_restore(flags);