diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-21 15:52:04 +1100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-21 15:52:04 +1100 |
commit | a02efb906d12c9d4eb2ab7c59049ba9545e5412d (patch) | |
tree | bf1f6467978ec63a22f42299ecac2ee7f7e73336 /drivers/rtc/rtc-ds1742.c | |
parent | 84dfcb4b318463cd4883b6a19937824f49aee564 (diff) | |
parent | 2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4 (diff) |
Merge commit 'origin' into master
Manual merge of:
arch/powerpc/Kconfig
arch/powerpc/include/asm/page.h
Diffstat (limited to 'drivers/rtc/rtc-ds1742.c')
-rw-r--r-- | drivers/rtc/rtc-ds1742.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 24d35ede2db..8bc8501bffc 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c @@ -66,17 +66,17 @@ static int ds1742_rtc_set_time(struct device *dev, struct rtc_time *tm) void __iomem *ioaddr = pdata->ioaddr_rtc; u8 century; - century = BIN2BCD((tm->tm_year + 1900) / 100); + century = bin2bcd((tm->tm_year + 1900) / 100); writeb(RTC_WRITE, ioaddr + RTC_CONTROL); - writeb(BIN2BCD(tm->tm_year % 100), ioaddr + RTC_YEAR); - writeb(BIN2BCD(tm->tm_mon + 1), ioaddr + RTC_MONTH); - writeb(BIN2BCD(tm->tm_wday) & RTC_DAY_MASK, ioaddr + RTC_DAY); - writeb(BIN2BCD(tm->tm_mday), ioaddr + RTC_DATE); - writeb(BIN2BCD(tm->tm_hour), ioaddr + RTC_HOURS); - writeb(BIN2BCD(tm->tm_min), ioaddr + RTC_MINUTES); - writeb(BIN2BCD(tm->tm_sec) & RTC_SECONDS_MASK, ioaddr + RTC_SECONDS); + writeb(bin2bcd(tm->tm_year % 100), ioaddr + RTC_YEAR); + writeb(bin2bcd(tm->tm_mon + 1), ioaddr + RTC_MONTH); + writeb(bin2bcd(tm->tm_wday) & RTC_DAY_MASK, ioaddr + RTC_DAY); + writeb(bin2bcd(tm->tm_mday), ioaddr + RTC_DATE); + writeb(bin2bcd(tm->tm_hour), ioaddr + RTC_HOURS); + writeb(bin2bcd(tm->tm_min), ioaddr + RTC_MINUTES); + writeb(bin2bcd(tm->tm_sec) & RTC_SECONDS_MASK, ioaddr + RTC_SECONDS); /* RTC_CENTURY and RTC_CONTROL share same register */ writeb(RTC_WRITE | (century & RTC_CENTURY_MASK), ioaddr + RTC_CENTURY); @@ -106,14 +106,14 @@ static int ds1742_rtc_read_time(struct device *dev, struct rtc_time *tm) year = readb(ioaddr + RTC_YEAR); century = readb(ioaddr + RTC_CENTURY) & RTC_CENTURY_MASK; writeb(0, ioaddr + RTC_CONTROL); - tm->tm_sec = BCD2BIN(second); - tm->tm_min = BCD2BIN(minute); - tm->tm_hour = BCD2BIN(hour); - tm->tm_mday = BCD2BIN(day); - tm->tm_wday = BCD2BIN(week); - tm->tm_mon = BCD2BIN(month) - 1; + tm->tm_sec = bcd2bin(second); + tm->tm_min = bcd2bin(minute); + tm->tm_hour = bcd2bin(hour); + tm->tm_mday = bcd2bin(day); + tm->tm_wday = bcd2bin(week); + tm->tm_mon = bcd2bin(month) - 1; /* year is 1900 + tm->tm_year */ - tm->tm_year = BCD2BIN(year) + BCD2BIN(century) * 100 - 1900; + tm->tm_year = bcd2bin(year) + bcd2bin(century) * 100 - 1900; if (rtc_valid_tm(tm) < 0) { dev_err(dev, "retrieved date/time is not valid.\n"); |