diff options
Diffstat (limited to 'drivers/rtc/rtc-m48t86.c')
-rw-r--r-- | drivers/rtc/rtc-m48t86.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c index 3f7f99a5d96a..7c045cffa9ff 100644 --- a/drivers/rtc/rtc-m48t86.c +++ b/drivers/rtc/rtc-m48t86.c | |||
@@ -62,14 +62,14 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
62 | tm->tm_wday = ops->readbyte(M48T86_REG_DOW); | 62 | tm->tm_wday = ops->readbyte(M48T86_REG_DOW); |
63 | } else { | 63 | } else { |
64 | /* bcd mode */ | 64 | /* bcd mode */ |
65 | tm->tm_sec = BCD2BIN(ops->readbyte(M48T86_REG_SEC)); | 65 | tm->tm_sec = bcd2bin(ops->readbyte(M48T86_REG_SEC)); |
66 | tm->tm_min = BCD2BIN(ops->readbyte(M48T86_REG_MIN)); | 66 | tm->tm_min = bcd2bin(ops->readbyte(M48T86_REG_MIN)); |
67 | tm->tm_hour = BCD2BIN(ops->readbyte(M48T86_REG_HOUR) & 0x3F); | 67 | tm->tm_hour = bcd2bin(ops->readbyte(M48T86_REG_HOUR) & 0x3F); |
68 | tm->tm_mday = BCD2BIN(ops->readbyte(M48T86_REG_DOM)); | 68 | tm->tm_mday = bcd2bin(ops->readbyte(M48T86_REG_DOM)); |
69 | /* tm_mon is 0-11 */ | 69 | /* tm_mon is 0-11 */ |
70 | tm->tm_mon = BCD2BIN(ops->readbyte(M48T86_REG_MONTH)) - 1; | 70 | tm->tm_mon = bcd2bin(ops->readbyte(M48T86_REG_MONTH)) - 1; |
71 | tm->tm_year = BCD2BIN(ops->readbyte(M48T86_REG_YEAR)) + 100; | 71 | tm->tm_year = bcd2bin(ops->readbyte(M48T86_REG_YEAR)) + 100; |
72 | tm->tm_wday = BCD2BIN(ops->readbyte(M48T86_REG_DOW)); | 72 | tm->tm_wday = bcd2bin(ops->readbyte(M48T86_REG_DOW)); |
73 | } | 73 | } |
74 | 74 | ||
75 | /* correct the hour if the clock is in 12h mode */ | 75 | /* correct the hour if the clock is in 12h mode */ |
@@ -103,13 +103,13 @@ static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
103 | ops->writebyte(tm->tm_wday, M48T86_REG_DOW); | 103 | ops->writebyte(tm->tm_wday, M48T86_REG_DOW); |
104 | } else { | 104 | } else { |
105 | /* bcd mode */ | 105 | /* bcd mode */ |
106 | ops->writebyte(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); | 106 | ops->writebyte(bin2bcd(tm->tm_sec), M48T86_REG_SEC); |
107 | ops->writebyte(BIN2BCD(tm->tm_min), M48T86_REG_MIN); | 107 | ops->writebyte(bin2bcd(tm->tm_min), M48T86_REG_MIN); |
108 | ops->writebyte(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); | 108 | ops->writebyte(bin2bcd(tm->tm_hour), M48T86_REG_HOUR); |
109 | ops->writebyte(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); | 109 | ops->writebyte(bin2bcd(tm->tm_mday), M48T86_REG_DOM); |
110 | ops->writebyte(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); | 110 | ops->writebyte(bin2bcd(tm->tm_mon + 1), M48T86_REG_MONTH); |
111 | ops->writebyte(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); | 111 | ops->writebyte(bin2bcd(tm->tm_year % 100), M48T86_REG_YEAR); |
112 | ops->writebyte(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); | 112 | ops->writebyte(bin2bcd(tm->tm_wday), M48T86_REG_DOW); |
113 | } | 113 | } |
114 | 114 | ||
115 | /* update ended */ | 115 | /* update ended */ |