aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-max6902.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-max6902.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-max6902.c')
-rw-r--r--drivers/rtc/rtc-max6902.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 78b2551fb19d..2f6507df7b49 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -124,15 +124,15 @@ static int max6902_get_datetime(struct device *dev, struct rtc_time *dt)
124 124
125 /* The chip sends data in this order: 125 /* The chip sends data in this order:
126 * Seconds, Minutes, Hours, Date, Month, Day, Year */ 126 * Seconds, Minutes, Hours, Date, Month, Day, Year */
127 dt->tm_sec = BCD2BIN(chip->buf[1]); 127 dt->tm_sec = bcd2bin(chip->buf[1]);
128 dt->tm_min = BCD2BIN(chip->buf[2]); 128 dt->tm_min = bcd2bin(chip->buf[2]);
129 dt->tm_hour = BCD2BIN(chip->buf[3]); 129 dt->tm_hour = bcd2bin(chip->buf[3]);
130 dt->tm_mday = BCD2BIN(chip->buf[4]); 130 dt->tm_mday = bcd2bin(chip->buf[4]);
131 dt->tm_mon = BCD2BIN(chip->buf[5]) - 1; 131 dt->tm_mon = bcd2bin(chip->buf[5]) - 1;
132 dt->tm_wday = BCD2BIN(chip->buf[6]); 132 dt->tm_wday = bcd2bin(chip->buf[6]);
133 dt->tm_year = BCD2BIN(chip->buf[7]); 133 dt->tm_year = bcd2bin(chip->buf[7]);
134 134
135 century = BCD2BIN(tmp) * 100; 135 century = bcd2bin(tmp) * 100;
136 136
137 dt->tm_year += century; 137 dt->tm_year += century;
138 dt->tm_year -= 1900; 138 dt->tm_year -= 1900;
@@ -168,15 +168,15 @@ static int max6902_set_datetime(struct device *dev, struct rtc_time *dt)
168 /* Remove write protection */ 168 /* Remove write protection */
169 max6902_set_reg(dev, 0xF, 0); 169 max6902_set_reg(dev, 0xF, 0);
170 170
171 max6902_set_reg(dev, 0x01, BIN2BCD(dt->tm_sec)); 171 max6902_set_reg(dev, 0x01, bin2bcd(dt->tm_sec));
172 max6902_set_reg(dev, 0x03, BIN2BCD(dt->tm_min)); 172 max6902_set_reg(dev, 0x03, bin2bcd(dt->tm_min));
173 max6902_set_reg(dev, 0x05, BIN2BCD(dt->tm_hour)); 173 max6902_set_reg(dev, 0x05, bin2bcd(dt->tm_hour));
174 174
175 max6902_set_reg(dev, 0x07, BIN2BCD(dt->tm_mday)); 175 max6902_set_reg(dev, 0x07, bin2bcd(dt->tm_mday));
176 max6902_set_reg(dev, 0x09, BIN2BCD(dt->tm_mon+1)); 176 max6902_set_reg(dev, 0x09, bin2bcd(dt->tm_mon+1));
177 max6902_set_reg(dev, 0x0B, BIN2BCD(dt->tm_wday)); 177 max6902_set_reg(dev, 0x0B, bin2bcd(dt->tm_wday));
178 max6902_set_reg(dev, 0x0D, BIN2BCD(dt->tm_year%100)); 178 max6902_set_reg(dev, 0x0D, bin2bcd(dt->tm_year%100));
179 max6902_set_reg(dev, 0x13, BIN2BCD(dt->tm_year/100)); 179 max6902_set_reg(dev, 0x13, bin2bcd(dt->tm_year/100));
180 180
181 /* Compulab used a delay here. However, the datasheet 181 /* Compulab used a delay here. However, the datasheet
182 * does not mention a delay being required anywhere... */ 182 * does not mention a delay being required anywhere... */