From fe20ba70abf7d6e5855c3dacc729490b3d0d077f Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 18 Oct 2008 20:28:41 -0700 Subject: 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 Acked-by: Alessandro Zummo Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/rtc/rtc-at91rm9200.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'drivers/rtc/rtc-at91rm9200.c') diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 37082616482..b5bf9370691 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c @@ -53,21 +53,21 @@ static void at91_rtc_decodetime(unsigned int timereg, unsigned int calreg, } while ((time != at91_sys_read(timereg)) || (date != at91_sys_read(calreg))); - tm->tm_sec = BCD2BIN((time & AT91_RTC_SEC) >> 0); - tm->tm_min = BCD2BIN((time & AT91_RTC_MIN) >> 8); - tm->tm_hour = BCD2BIN((time & AT91_RTC_HOUR) >> 16); + tm->tm_sec = bcd2bin((time & AT91_RTC_SEC) >> 0); + tm->tm_min = bcd2bin((time & AT91_RTC_MIN) >> 8); + tm->tm_hour = bcd2bin((time & AT91_RTC_HOUR) >> 16); /* * The Calendar Alarm register does not have a field for * the year - so these will return an invalid value. When an * alarm is set, at91_alarm_year wille store the current year. */ - tm->tm_year = BCD2BIN(date & AT91_RTC_CENT) * 100; /* century */ - tm->tm_year += BCD2BIN((date & AT91_RTC_YEAR) >> 8); /* year */ + tm->tm_year = bcd2bin(date & AT91_RTC_CENT) * 100; /* century */ + tm->tm_year += bcd2bin((date & AT91_RTC_YEAR) >> 8); /* year */ - tm->tm_wday = BCD2BIN((date & AT91_RTC_DAY) >> 21) - 1; /* day of the week [0-6], Sunday=0 */ - tm->tm_mon = BCD2BIN((date & AT91_RTC_MONTH) >> 16) - 1; - tm->tm_mday = BCD2BIN((date & AT91_RTC_DATE) >> 24); + tm->tm_wday = bcd2bin((date & AT91_RTC_DAY) >> 21) - 1; /* day of the week [0-6], Sunday=0 */ + tm->tm_mon = bcd2bin((date & AT91_RTC_MONTH) >> 16) - 1; + tm->tm_mday = bcd2bin((date & AT91_RTC_DATE) >> 24); } /* @@ -106,16 +106,16 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); at91_sys_write(AT91_RTC_TIMR, - BIN2BCD(tm->tm_sec) << 0 - | BIN2BCD(tm->tm_min) << 8 - | BIN2BCD(tm->tm_hour) << 16); + bin2bcd(tm->tm_sec) << 0 + | bin2bcd(tm->tm_min) << 8 + | bin2bcd(tm->tm_hour) << 16); at91_sys_write(AT91_RTC_CALR, - BIN2BCD((tm->tm_year + 1900) / 100) /* century */ - | BIN2BCD(tm->tm_year % 100) << 8 /* year */ - | BIN2BCD(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ - | BIN2BCD(tm->tm_wday + 1) << 21 /* day of the week [0-6], Sunday=0 */ - | BIN2BCD(tm->tm_mday) << 24); + bin2bcd((tm->tm_year + 1900) / 100) /* century */ + | bin2bcd(tm->tm_year % 100) << 8 /* year */ + | bin2bcd(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ + | bin2bcd(tm->tm_wday + 1) << 21 /* day of the week [0-6], Sunday=0 */ + | bin2bcd(tm->tm_mday) << 24); /* Restart Time/Calendar */ cr = at91_sys_read(AT91_RTC_CR); @@ -162,13 +162,13 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); at91_sys_write(AT91_RTC_TIMALR, - BIN2BCD(tm.tm_sec) << 0 - | BIN2BCD(tm.tm_min) << 8 - | BIN2BCD(tm.tm_hour) << 16 + bin2bcd(tm.tm_sec) << 0 + | bin2bcd(tm.tm_min) << 8 + | bin2bcd(tm.tm_hour) << 16 | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); at91_sys_write(AT91_RTC_CALALR, - BIN2BCD(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ - | BIN2BCD(tm.tm_mday) << 24 + bin2bcd(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ + | bin2bcd(tm.tm_mday) << 24 | AT91_RTC_DATEEN | AT91_RTC_MTHEN); if (alrm->enabled) { -- cgit v1.2.2