aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-m41t94.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-m41t94.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-m41t94.c')
-rw-r--r--drivers/rtc/rtc-m41t94.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index 9b19499c829e..c3a18c58daf6 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -41,17 +41,17 @@ static int m41t94_set_time(struct device *dev, struct rtc_time *tm)
41 tm->tm_mon, tm->tm_year, tm->tm_wday); 41 tm->tm_mon, tm->tm_year, tm->tm_wday);
42 42
43 buf[0] = 0x80 | M41T94_REG_SECONDS; /* write time + date */ 43 buf[0] = 0x80 | M41T94_REG_SECONDS; /* write time + date */
44 buf[M41T94_REG_SECONDS] = BIN2BCD(tm->tm_sec); 44 buf[M41T94_REG_SECONDS] = bin2bcd(tm->tm_sec);
45 buf[M41T94_REG_MINUTES] = BIN2BCD(tm->tm_min); 45 buf[M41T94_REG_MINUTES] = bin2bcd(tm->tm_min);
46 buf[M41T94_REG_HOURS] = BIN2BCD(tm->tm_hour); 46 buf[M41T94_REG_HOURS] = bin2bcd(tm->tm_hour);
47 buf[M41T94_REG_WDAY] = BIN2BCD(tm->tm_wday + 1); 47 buf[M41T94_REG_WDAY] = bin2bcd(tm->tm_wday + 1);
48 buf[M41T94_REG_DAY] = BIN2BCD(tm->tm_mday); 48 buf[M41T94_REG_DAY] = bin2bcd(tm->tm_mday);
49 buf[M41T94_REG_MONTH] = BIN2BCD(tm->tm_mon + 1); 49 buf[M41T94_REG_MONTH] = bin2bcd(tm->tm_mon + 1);
50 50
51 buf[M41T94_REG_HOURS] |= M41T94_BIT_CEB; 51 buf[M41T94_REG_HOURS] |= M41T94_BIT_CEB;
52 if (tm->tm_year >= 100) 52 if (tm->tm_year >= 100)
53 buf[M41T94_REG_HOURS] |= M41T94_BIT_CB; 53 buf[M41T94_REG_HOURS] |= M41T94_BIT_CB;
54 buf[M41T94_REG_YEAR] = BIN2BCD(tm->tm_year % 100); 54 buf[M41T94_REG_YEAR] = bin2bcd(tm->tm_year % 100);
55 55
56 return spi_write(spi, buf, 8); 56 return spi_write(spi, buf, 8);
57} 57}
@@ -82,14 +82,14 @@ static int m41t94_read_time(struct device *dev, struct rtc_time *tm)
82 spi_write(spi, buf, 2); 82 spi_write(spi, buf, 2);
83 } 83 }
84 84
85 tm->tm_sec = BCD2BIN(spi_w8r8(spi, M41T94_REG_SECONDS)); 85 tm->tm_sec = bcd2bin(spi_w8r8(spi, M41T94_REG_SECONDS));
86 tm->tm_min = BCD2BIN(spi_w8r8(spi, M41T94_REG_MINUTES)); 86 tm->tm_min = bcd2bin(spi_w8r8(spi, M41T94_REG_MINUTES));
87 hour = spi_w8r8(spi, M41T94_REG_HOURS); 87 hour = spi_w8r8(spi, M41T94_REG_HOURS);
88 tm->tm_hour = BCD2BIN(hour & 0x3f); 88 tm->tm_hour = bcd2bin(hour & 0x3f);
89 tm->tm_wday = BCD2BIN(spi_w8r8(spi, M41T94_REG_WDAY)) - 1; 89 tm->tm_wday = bcd2bin(spi_w8r8(spi, M41T94_REG_WDAY)) - 1;
90 tm->tm_mday = BCD2BIN(spi_w8r8(spi, M41T94_REG_DAY)); 90 tm->tm_mday = bcd2bin(spi_w8r8(spi, M41T94_REG_DAY));
91 tm->tm_mon = BCD2BIN(spi_w8r8(spi, M41T94_REG_MONTH)) - 1; 91 tm->tm_mon = bcd2bin(spi_w8r8(spi, M41T94_REG_MONTH)) - 1;
92 tm->tm_year = BCD2BIN(spi_w8r8(spi, M41T94_REG_YEAR)); 92 tm->tm_year = bcd2bin(spi_w8r8(spi, M41T94_REG_YEAR));
93 if ((hour & M41T94_BIT_CB) || !(hour & M41T94_BIT_CEB)) 93 if ((hour & M41T94_BIT_CB) || !(hour & M41T94_BIT_CEB))
94 tm->tm_year += 100; 94 tm->tm_year += 100;
95 95