aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1511.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@kernel.org>2008-10-18 23:28:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 11:52:41 -0400
commitfe20ba70abf7d6e5855c3dacc729490b3d0d077f (patch)
tree918619427cc051d22cb38b44e94c7e65f29ee928 /drivers/rtc/rtc-ds1511.c
parent4110a0d6206bd175419cc5503f80cc296d184cbf (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-ds1511.c')
-rw-r--r--drivers/rtc/rtc-ds1511.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 86981d34fbb6..7bb0a962ad21 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -153,8 +153,8 @@ ds1511_wdog_set(unsigned long deciseconds)
153 /* 153 /*
154 * set the wdog values in the wdog registers 154 * set the wdog values in the wdog registers
155 */ 155 */
156 rtc_write(BIN2BCD(deciseconds % 100), DS1511_WD_MSEC); 156 rtc_write(bin2bcd(deciseconds % 100), DS1511_WD_MSEC);
157 rtc_write(BIN2BCD(deciseconds / 100), DS1511_WD_SEC); 157 rtc_write(bin2bcd(deciseconds / 100), DS1511_WD_SEC);
158 /* 158 /*
159 * set wdog enable and wdog 'steering' bit to issue a reset 159 * set wdog enable and wdog 'steering' bit to issue a reset
160 */ 160 */
@@ -220,13 +220,13 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
220 /* 220 /*
221 * each register is a different number of valid bits 221 * each register is a different number of valid bits
222 */ 222 */
223 sec = BIN2BCD(sec) & 0x7f; 223 sec = bin2bcd(sec) & 0x7f;
224 min = BIN2BCD(min) & 0x7f; 224 min = bin2bcd(min) & 0x7f;
225 hrs = BIN2BCD(hrs) & 0x3f; 225 hrs = bin2bcd(hrs) & 0x3f;
226 day = BIN2BCD(day) & 0x3f; 226 day = bin2bcd(day) & 0x3f;
227 mon = BIN2BCD(mon) & 0x1f; 227 mon = bin2bcd(mon) & 0x1f;
228 yrs = BIN2BCD(yrs) & 0xff; 228 yrs = bin2bcd(yrs) & 0xff;
229 cen = BIN2BCD(cen) & 0xff; 229 cen = bin2bcd(cen) & 0xff;
230 230
231 spin_lock_irqsave(&ds1511_lock, flags); 231 spin_lock_irqsave(&ds1511_lock, flags);
232 rtc_disable_update(); 232 rtc_disable_update();
@@ -264,14 +264,14 @@ static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm)
264 rtc_enable_update(); 264 rtc_enable_update();
265 spin_unlock_irqrestore(&ds1511_lock, flags); 265 spin_unlock_irqrestore(&ds1511_lock, flags);
266 266
267 rtc_tm->tm_sec = BCD2BIN(rtc_tm->tm_sec); 267 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
268 rtc_tm->tm_min = BCD2BIN(rtc_tm->tm_min); 268 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
269 rtc_tm->tm_hour = BCD2BIN(rtc_tm->tm_hour); 269 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
270 rtc_tm->tm_mday = BCD2BIN(rtc_tm->tm_mday); 270 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
271 rtc_tm->tm_wday = BCD2BIN(rtc_tm->tm_wday); 271 rtc_tm->tm_wday = bcd2bin(rtc_tm->tm_wday);
272 rtc_tm->tm_mon = BCD2BIN(rtc_tm->tm_mon); 272 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
273 rtc_tm->tm_year = BCD2BIN(rtc_tm->tm_year); 273 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
274 century = BCD2BIN(century) * 100; 274 century = bcd2bin(century) * 100;
275 275
276 /* 276 /*
277 * Account for differences between how the RTC uses the values 277 * Account for differences between how the RTC uses the values
@@ -304,16 +304,16 @@ ds1511_rtc_update_alarm(struct rtc_plat_data *pdata)
304 304
305 spin_lock_irqsave(&pdata->rtc->irq_lock, flags); 305 spin_lock_irqsave(&pdata->rtc->irq_lock, flags);
306 rtc_write(pdata->alrm_mday < 0 || (pdata->irqen & RTC_UF) ? 306 rtc_write(pdata->alrm_mday < 0 || (pdata->irqen & RTC_UF) ?
307 0x80 : BIN2BCD(pdata->alrm_mday) & 0x3f, 307 0x80 : bin2bcd(pdata->alrm_mday) & 0x3f,
308 RTC_ALARM_DATE); 308 RTC_ALARM_DATE);
309 rtc_write(pdata->alrm_hour < 0 || (pdata->irqen & RTC_UF) ? 309 rtc_write(pdata->alrm_hour < 0 || (pdata->irqen & RTC_UF) ?
310 0x80 : BIN2BCD(pdata->alrm_hour) & 0x3f, 310 0x80 : bin2bcd(pdata->alrm_hour) & 0x3f,
311 RTC_ALARM_HOUR); 311 RTC_ALARM_HOUR);
312 rtc_write(pdata->alrm_min < 0 || (pdata->irqen & RTC_UF) ? 312 rtc_write(pdata->alrm_min < 0 || (pdata->irqen & RTC_UF) ?
313 0x80 : BIN2BCD(pdata->alrm_min) & 0x7f, 313 0x80 : bin2bcd(pdata->alrm_min) & 0x7f,
314 RTC_ALARM_MIN); 314 RTC_ALARM_MIN);
315 rtc_write(pdata->alrm_sec < 0 || (pdata->irqen & RTC_UF) ? 315 rtc_write(pdata->alrm_sec < 0 || (pdata->irqen & RTC_UF) ?
316 0x80 : BIN2BCD(pdata->alrm_sec) & 0x7f, 316 0x80 : bin2bcd(pdata->alrm_sec) & 0x7f,
317 RTC_ALARM_SEC); 317 RTC_ALARM_SEC);
318 rtc_write(rtc_read(RTC_CMD) | (pdata->irqen ? RTC_TIE : 0), RTC_CMD); 318 rtc_write(rtc_read(RTC_CMD) | (pdata->irqen ? RTC_TIE : 0), RTC_CMD);
319 rtc_read(RTC_CMD1); /* clear interrupts */ 319 rtc_read(RTC_CMD1); /* clear interrupts */