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-pcf8563.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-pcf8563.c')
-rw-r--r-- | drivers/rtc/rtc-pcf8563.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index a829f20ad6d6..b725913ccbe8 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c | |||
@@ -97,13 +97,13 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
97 | buf[8]); | 97 | buf[8]); |
98 | 98 | ||
99 | 99 | ||
100 | tm->tm_sec = BCD2BIN(buf[PCF8563_REG_SC] & 0x7F); | 100 | tm->tm_sec = bcd2bin(buf[PCF8563_REG_SC] & 0x7F); |
101 | tm->tm_min = BCD2BIN(buf[PCF8563_REG_MN] & 0x7F); | 101 | tm->tm_min = bcd2bin(buf[PCF8563_REG_MN] & 0x7F); |
102 | tm->tm_hour = BCD2BIN(buf[PCF8563_REG_HR] & 0x3F); /* rtc hr 0-23 */ | 102 | tm->tm_hour = bcd2bin(buf[PCF8563_REG_HR] & 0x3F); /* rtc hr 0-23 */ |
103 | tm->tm_mday = BCD2BIN(buf[PCF8563_REG_DM] & 0x3F); | 103 | tm->tm_mday = bcd2bin(buf[PCF8563_REG_DM] & 0x3F); |
104 | tm->tm_wday = buf[PCF8563_REG_DW] & 0x07; | 104 | tm->tm_wday = buf[PCF8563_REG_DW] & 0x07; |
105 | tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */ | 105 | tm->tm_mon = bcd2bin(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */ |
106 | tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR]); | 106 | tm->tm_year = bcd2bin(buf[PCF8563_REG_YR]); |
107 | if (tm->tm_year < 70) | 107 | if (tm->tm_year < 70) |
108 | tm->tm_year += 100; /* assume we are in 1970...2069 */ | 108 | tm->tm_year += 100; /* assume we are in 1970...2069 */ |
109 | /* detect the polarity heuristically. see note above. */ | 109 | /* detect the polarity heuristically. see note above. */ |
@@ -138,17 +138,17 @@ static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
138 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); | 138 | tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); |
139 | 139 | ||
140 | /* hours, minutes and seconds */ | 140 | /* hours, minutes and seconds */ |
141 | buf[PCF8563_REG_SC] = BIN2BCD(tm->tm_sec); | 141 | buf[PCF8563_REG_SC] = bin2bcd(tm->tm_sec); |
142 | buf[PCF8563_REG_MN] = BIN2BCD(tm->tm_min); | 142 | buf[PCF8563_REG_MN] = bin2bcd(tm->tm_min); |
143 | buf[PCF8563_REG_HR] = BIN2BCD(tm->tm_hour); | 143 | buf[PCF8563_REG_HR] = bin2bcd(tm->tm_hour); |
144 | 144 | ||
145 | buf[PCF8563_REG_DM] = BIN2BCD(tm->tm_mday); | 145 | buf[PCF8563_REG_DM] = bin2bcd(tm->tm_mday); |
146 | 146 | ||
147 | /* month, 1 - 12 */ | 147 | /* month, 1 - 12 */ |
148 | buf[PCF8563_REG_MO] = BIN2BCD(tm->tm_mon + 1); | 148 | buf[PCF8563_REG_MO] = bin2bcd(tm->tm_mon + 1); |
149 | 149 | ||
150 | /* year and century */ | 150 | /* year and century */ |
151 | buf[PCF8563_REG_YR] = BIN2BCD(tm->tm_year % 100); | 151 | buf[PCF8563_REG_YR] = bin2bcd(tm->tm_year % 100); |
152 | if (pcf8563->c_polarity ? (tm->tm_year >= 100) : (tm->tm_year < 100)) | 152 | if (pcf8563->c_polarity ? (tm->tm_year >= 100) : (tm->tm_year < 100)) |
153 | buf[PCF8563_REG_MO] |= PCF8563_MO_C; | 153 | buf[PCF8563_REG_MO] |= PCF8563_MO_C; |
154 | 154 | ||