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-at91rm9200.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-at91rm9200.c')
-rw-r--r-- | drivers/rtc/rtc-at91rm9200.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 37082616482b..b5bf93706913 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, | |||
53 | } while ((time != at91_sys_read(timereg)) || | 53 | } while ((time != at91_sys_read(timereg)) || |
54 | (date != at91_sys_read(calreg))); | 54 | (date != at91_sys_read(calreg))); |
55 | 55 | ||
56 | tm->tm_sec = BCD2BIN((time & AT91_RTC_SEC) >> 0); | 56 | tm->tm_sec = bcd2bin((time & AT91_RTC_SEC) >> 0); |
57 | tm->tm_min = BCD2BIN((time & AT91_RTC_MIN) >> 8); | 57 | tm->tm_min = bcd2bin((time & AT91_RTC_MIN) >> 8); |
58 | tm->tm_hour = BCD2BIN((time & AT91_RTC_HOUR) >> 16); | 58 | tm->tm_hour = bcd2bin((time & AT91_RTC_HOUR) >> 16); |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * The Calendar Alarm register does not have a field for | 61 | * The Calendar Alarm register does not have a field for |
62 | * the year - so these will return an invalid value. When an | 62 | * the year - so these will return an invalid value. When an |
63 | * alarm is set, at91_alarm_year wille store the current year. | 63 | * alarm is set, at91_alarm_year wille store the current year. |
64 | */ | 64 | */ |
65 | tm->tm_year = BCD2BIN(date & AT91_RTC_CENT) * 100; /* century */ | 65 | tm->tm_year = bcd2bin(date & AT91_RTC_CENT) * 100; /* century */ |
66 | tm->tm_year += BCD2BIN((date & AT91_RTC_YEAR) >> 8); /* year */ | 66 | tm->tm_year += bcd2bin((date & AT91_RTC_YEAR) >> 8); /* year */ |
67 | 67 | ||
68 | tm->tm_wday = BCD2BIN((date & AT91_RTC_DAY) >> 21) - 1; /* day of the week [0-6], Sunday=0 */ | 68 | tm->tm_wday = bcd2bin((date & AT91_RTC_DAY) >> 21) - 1; /* day of the week [0-6], Sunday=0 */ |
69 | tm->tm_mon = BCD2BIN((date & AT91_RTC_MONTH) >> 16) - 1; | 69 | tm->tm_mon = bcd2bin((date & AT91_RTC_MONTH) >> 16) - 1; |
70 | tm->tm_mday = BCD2BIN((date & AT91_RTC_DATE) >> 24); | 70 | tm->tm_mday = bcd2bin((date & AT91_RTC_DATE) >> 24); |
71 | } | 71 | } |
72 | 72 | ||
73 | /* | 73 | /* |
@@ -106,16 +106,16 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
106 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); | 106 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); |
107 | 107 | ||
108 | at91_sys_write(AT91_RTC_TIMR, | 108 | at91_sys_write(AT91_RTC_TIMR, |
109 | BIN2BCD(tm->tm_sec) << 0 | 109 | bin2bcd(tm->tm_sec) << 0 |
110 | | BIN2BCD(tm->tm_min) << 8 | 110 | | bin2bcd(tm->tm_min) << 8 |
111 | | BIN2BCD(tm->tm_hour) << 16); | 111 | | bin2bcd(tm->tm_hour) << 16); |
112 | 112 | ||
113 | at91_sys_write(AT91_RTC_CALR, | 113 | at91_sys_write(AT91_RTC_CALR, |
114 | BIN2BCD((tm->tm_year + 1900) / 100) /* century */ | 114 | bin2bcd((tm->tm_year + 1900) / 100) /* century */ |
115 | | BIN2BCD(tm->tm_year % 100) << 8 /* year */ | 115 | | bin2bcd(tm->tm_year % 100) << 8 /* year */ |
116 | | BIN2BCD(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ | 116 | | bin2bcd(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ |
117 | | BIN2BCD(tm->tm_wday + 1) << 21 /* day of the week [0-6], Sunday=0 */ | 117 | | bin2bcd(tm->tm_wday + 1) << 21 /* day of the week [0-6], Sunday=0 */ |
118 | | BIN2BCD(tm->tm_mday) << 24); | 118 | | bin2bcd(tm->tm_mday) << 24); |
119 | 119 | ||
120 | /* Restart Time/Calendar */ | 120 | /* Restart Time/Calendar */ |
121 | cr = at91_sys_read(AT91_RTC_CR); | 121 | cr = at91_sys_read(AT91_RTC_CR); |
@@ -162,13 +162,13 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
162 | 162 | ||
163 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 163 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
164 | at91_sys_write(AT91_RTC_TIMALR, | 164 | at91_sys_write(AT91_RTC_TIMALR, |
165 | BIN2BCD(tm.tm_sec) << 0 | 165 | bin2bcd(tm.tm_sec) << 0 |
166 | | BIN2BCD(tm.tm_min) << 8 | 166 | | bin2bcd(tm.tm_min) << 8 |
167 | | BIN2BCD(tm.tm_hour) << 16 | 167 | | bin2bcd(tm.tm_hour) << 16 |
168 | | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); | 168 | | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); |
169 | at91_sys_write(AT91_RTC_CALALR, | 169 | at91_sys_write(AT91_RTC_CALALR, |
170 | BIN2BCD(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ | 170 | bin2bcd(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ |
171 | | BIN2BCD(tm.tm_mday) << 24 | 171 | | bin2bcd(tm.tm_mday) << 24 |
172 | | AT91_RTC_DATEEN | AT91_RTC_MTHEN); | 172 | | AT91_RTC_DATEEN | AT91_RTC_MTHEN); |
173 | 173 | ||
174 | if (alrm->enabled) { | 174 | if (alrm->enabled) { |