diff options
author | Adrian Bunk <bunk@kernel.org> | 2008-10-18 23:28:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 11:52:41 -0400 |
commit | fe20ba70abf7d6e5855c3dacc729490b3d0d077f (patch) | |
tree | 918619427cc051d22cb38b44e94c7e65f29ee928 /drivers/rtc/rtc-ds1742.c | |
parent | 4110a0d6206bd175419cc5503f80cc296d184cbf (diff) |
drivers/rtc/: use bcd2bin/bin2bcd
Change drivers/rtc/ to use the new bcd2bin/bin2bcd functions instead of
the obsolete BCD_TO_BIN/BIN_TO_BCD/BCD2BIN/BIN2BCD macros.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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 24d35ede2dbf..8bc8501bffc8 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) | |||
66 | void __iomem *ioaddr = pdata->ioaddr_rtc; | 66 | void __iomem *ioaddr = pdata->ioaddr_rtc; |
67 | u8 century; | 67 | u8 century; |
68 | 68 | ||
69 | century = BIN2BCD((tm->tm_year + 1900) / 100); | 69 | century = bin2bcd((tm->tm_year + 1900) / 100); |
70 | 70 | ||
71 | writeb(RTC_WRITE, ioaddr + RTC_CONTROL); | 71 | writeb(RTC_WRITE, ioaddr + RTC_CONTROL); |
72 | 72 | ||
73 | writeb(BIN2BCD(tm->tm_year % 100), ioaddr + RTC_YEAR); | 73 | writeb(bin2bcd(tm->tm_year % 100), ioaddr + RTC_YEAR); |
74 | writeb(BIN2BCD(tm->tm_mon + 1), ioaddr + RTC_MONTH); | 74 | writeb(bin2bcd(tm->tm_mon + 1), ioaddr + RTC_MONTH); |
75 | writeb(BIN2BCD(tm->tm_wday) & RTC_DAY_MASK, ioaddr + RTC_DAY); | 75 | writeb(bin2bcd(tm->tm_wday) & RTC_DAY_MASK, ioaddr + RTC_DAY); |
76 | writeb(BIN2BCD(tm->tm_mday), ioaddr + RTC_DATE); | 76 | writeb(bin2bcd(tm->tm_mday), ioaddr + RTC_DATE); |
77 | writeb(BIN2BCD(tm->tm_hour), ioaddr + RTC_HOURS); | 77 | writeb(bin2bcd(tm->tm_hour), ioaddr + RTC_HOURS); |
78 | writeb(BIN2BCD(tm->tm_min), ioaddr + RTC_MINUTES); | 78 | writeb(bin2bcd(tm->tm_min), ioaddr + RTC_MINUTES); |
79 | writeb(BIN2BCD(tm->tm_sec) & RTC_SECONDS_MASK, ioaddr + RTC_SECONDS); | 79 | writeb(bin2bcd(tm->tm_sec) & RTC_SECONDS_MASK, ioaddr + RTC_SECONDS); |
80 | 80 | ||
81 | /* RTC_CENTURY and RTC_CONTROL share same register */ | 81 | /* RTC_CENTURY and RTC_CONTROL share same register */ |
82 | writeb(RTC_WRITE | (century & RTC_CENTURY_MASK), ioaddr + RTC_CENTURY); | 82 | 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) | |||
106 | year = readb(ioaddr + RTC_YEAR); | 106 | year = readb(ioaddr + RTC_YEAR); |
107 | century = readb(ioaddr + RTC_CENTURY) & RTC_CENTURY_MASK; | 107 | century = readb(ioaddr + RTC_CENTURY) & RTC_CENTURY_MASK; |
108 | writeb(0, ioaddr + RTC_CONTROL); | 108 | writeb(0, ioaddr + RTC_CONTROL); |
109 | tm->tm_sec = BCD2BIN(second); | 109 | tm->tm_sec = bcd2bin(second); |
110 | tm->tm_min = BCD2BIN(minute); | 110 | tm->tm_min = bcd2bin(minute); |
111 | tm->tm_hour = BCD2BIN(hour); | 111 | tm->tm_hour = bcd2bin(hour); |
112 | tm->tm_mday = BCD2BIN(day); | 112 | tm->tm_mday = bcd2bin(day); |
113 | tm->tm_wday = BCD2BIN(week); | 113 | tm->tm_wday = bcd2bin(week); |
114 | tm->tm_mon = BCD2BIN(month) - 1; | 114 | tm->tm_mon = bcd2bin(month) - 1; |
115 | /* year is 1900 + tm->tm_year */ | 115 | /* year is 1900 + tm->tm_year */ |
116 | tm->tm_year = BCD2BIN(year) + BCD2BIN(century) * 100 - 1900; | 116 | tm->tm_year = bcd2bin(year) + bcd2bin(century) * 100 - 1900; |
117 | 117 | ||
118 | if (rtc_valid_tm(tm) < 0) { | 118 | if (rtc_valid_tm(tm) < 0) { |
119 | dev_err(dev, "retrieved date/time is not valid.\n"); | 119 | dev_err(dev, "retrieved date/time is not valid.\n"); |