aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1216.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-ds1216.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-ds1216.c')
-rw-r--r--drivers/rtc/rtc-ds1216.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c
index 0b17770b032b..9a234a4ec06d 100644
--- a/drivers/rtc/rtc-ds1216.c
+++ b/drivers/rtc/rtc-ds1216.c
@@ -86,19 +86,19 @@ static int ds1216_rtc_read_time(struct device *dev, struct rtc_time *tm)
86 ds1216_switch_ds_to_clock(priv->ioaddr); 86 ds1216_switch_ds_to_clock(priv->ioaddr);
87 ds1216_read(priv->ioaddr, (u8 *)&regs); 87 ds1216_read(priv->ioaddr, (u8 *)&regs);
88 88
89 tm->tm_sec = BCD2BIN(regs.sec); 89 tm->tm_sec = bcd2bin(regs.sec);
90 tm->tm_min = BCD2BIN(regs.min); 90 tm->tm_min = bcd2bin(regs.min);
91 if (regs.hour & DS1216_HOUR_1224) { 91 if (regs.hour & DS1216_HOUR_1224) {
92 /* AM/PM mode */ 92 /* AM/PM mode */
93 tm->tm_hour = BCD2BIN(regs.hour & 0x1f); 93 tm->tm_hour = bcd2bin(regs.hour & 0x1f);
94 if (regs.hour & DS1216_HOUR_AMPM) 94 if (regs.hour & DS1216_HOUR_AMPM)
95 tm->tm_hour += 12; 95 tm->tm_hour += 12;
96 } else 96 } else
97 tm->tm_hour = BCD2BIN(regs.hour & 0x3f); 97 tm->tm_hour = bcd2bin(regs.hour & 0x3f);
98 tm->tm_wday = (regs.wday & 7) - 1; 98 tm->tm_wday = (regs.wday & 7) - 1;
99 tm->tm_mday = BCD2BIN(regs.mday & 0x3f); 99 tm->tm_mday = bcd2bin(regs.mday & 0x3f);
100 tm->tm_mon = BCD2BIN(regs.month & 0x1f); 100 tm->tm_mon = bcd2bin(regs.month & 0x1f);
101 tm->tm_year = BCD2BIN(regs.year); 101 tm->tm_year = bcd2bin(regs.year);
102 if (tm->tm_year < 70) 102 if (tm->tm_year < 70)
103 tm->tm_year += 100; 103 tm->tm_year += 100;
104 return 0; 104 return 0;
@@ -114,19 +114,19 @@ static int ds1216_rtc_set_time(struct device *dev, struct rtc_time *tm)
114 ds1216_read(priv->ioaddr, (u8 *)&regs); 114 ds1216_read(priv->ioaddr, (u8 *)&regs);
115 115
116 regs.tsec = 0; /* clear 0.1 and 0.01 seconds */ 116 regs.tsec = 0; /* clear 0.1 and 0.01 seconds */
117 regs.sec = BIN2BCD(tm->tm_sec); 117 regs.sec = bin2bcd(tm->tm_sec);
118 regs.min = BIN2BCD(tm->tm_min); 118 regs.min = bin2bcd(tm->tm_min);
119 regs.hour &= DS1216_HOUR_1224; 119 regs.hour &= DS1216_HOUR_1224;
120 if (regs.hour && tm->tm_hour > 12) { 120 if (regs.hour && tm->tm_hour > 12) {
121 regs.hour |= DS1216_HOUR_AMPM; 121 regs.hour |= DS1216_HOUR_AMPM;
122 tm->tm_hour -= 12; 122 tm->tm_hour -= 12;
123 } 123 }
124 regs.hour |= BIN2BCD(tm->tm_hour); 124 regs.hour |= bin2bcd(tm->tm_hour);
125 regs.wday &= ~7; 125 regs.wday &= ~7;
126 regs.wday |= tm->tm_wday; 126 regs.wday |= tm->tm_wday;
127 regs.mday = BIN2BCD(tm->tm_mday); 127 regs.mday = bin2bcd(tm->tm_mday);
128 regs.month = BIN2BCD(tm->tm_mon); 128 regs.month = bin2bcd(tm->tm_mon);
129 regs.year = BIN2BCD(tm->tm_year % 100); 129 regs.year = bin2bcd(tm->tm_year % 100);
130 130
131 ds1216_switch_ds_to_clock(priv->ioaddr); 131 ds1216_switch_ds_to_clock(priv->ioaddr);
132 ds1216_write(priv->ioaddr, (u8 *)&regs); 132 ds1216_write(priv->ioaddr, (u8 *)&regs);