diff options
author | Matt Mackall <mpm@selenic.com> | 2006-03-28 01:56:10 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 09:16:01 -0800 |
commit | 4f3a36a7d0eb420471506fcd46ee46f4b5cd4ebc (patch) | |
tree | 2f08f6e498346ae5e41c60f6d8abd1f5a7b091ad /arch/mips/momentum | |
parent | 41623b064fbd76de5901da7c0e3cd2136617d787 (diff) | |
download | linux-3.10-4f3a36a7d0eb420471506fcd46ee46f4b5cd4ebc.tar.gz linux-3.10-4f3a36a7d0eb420471506fcd46ee46f4b5cd4ebc.tar.bz2 linux-3.10-4f3a36a7d0eb420471506fcd46ee46f4b5cd4ebc.zip |
[PATCH] RTC: Remove some duplicate BCD definitions
Remove some duplicate BCD definitions
Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/mips/momentum')
-rw-r--r-- | arch/mips/momentum/ocelot_3/setup.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c index 969612eab8a..370e75d0e75 100644 --- a/arch/mips/momentum/ocelot_3/setup.c +++ b/arch/mips/momentum/ocelot_3/setup.c @@ -58,6 +58,7 @@ #include <linux/bootmem.h> #include <linux/mv643xx.h> #include <linux/pm.h> +#include <linux/bcd.h> #include <asm/time.h> #include <asm/page.h> @@ -131,9 +132,6 @@ void setup_wired_tlb_entries(void) add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M); } -#define CONV_BCD_TO_BIN(val) (((val) & 0xf) + (((val) >> 4) * 10)) -#define CONV_BIN_TO_BCD(val) (((val) % 10) + (((val) / 10) << 4)) - unsigned long m48t37y_get_time(void) { unsigned int year, month, day, hour, min, sec; @@ -143,16 +141,16 @@ unsigned long m48t37y_get_time(void) /* stop the update */ rtc_base[0x7ff8] = 0x40; - year = CONV_BCD_TO_BIN(rtc_base[0x7fff]); - year += CONV_BCD_TO_BIN(rtc_base[0x7ff1]) * 100; + year = BCD2BIN(rtc_base[0x7fff]); + year += BCD2BIN(rtc_base[0x7ff1]) * 100; - month = CONV_BCD_TO_BIN(rtc_base[0x7ffe]); + month = BCD2BIN(rtc_base[0x7ffe]); - day = CONV_BCD_TO_BIN(rtc_base[0x7ffd]); + day = BCD2BIN(rtc_base[0x7ffd]); - hour = CONV_BCD_TO_BIN(rtc_base[0x7ffb]); - min = CONV_BCD_TO_BIN(rtc_base[0x7ffa]); - sec = CONV_BCD_TO_BIN(rtc_base[0x7ff9]); + hour = BCD2BIN(rtc_base[0x7ffb]); + min = BCD2BIN(rtc_base[0x7ffa]); + sec = BCD2BIN(rtc_base[0x7ff9]); /* start the update */ rtc_base[0x7ff8] = 0x00; @@ -175,22 +173,22 @@ int m48t37y_set_time(unsigned long sec) rtc_base[0x7ff8] = 0x80; /* year */ - rtc_base[0x7fff] = CONV_BIN_TO_BCD(tm.tm_year % 100); - rtc_base[0x7ff1] = CONV_BIN_TO_BCD(tm.tm_year / 100); + rtc_base[0x7fff] = BIN2BCD(tm.tm_year % 100); + rtc_base[0x7ff1] = BIN2BCD(tm.tm_year / 100); /* month */ - rtc_base[0x7ffe] = CONV_BIN_TO_BCD(tm.tm_mon); + rtc_base[0x7ffe] = BIN2BCD(tm.tm_mon); /* day */ - rtc_base[0x7ffd] = CONV_BIN_TO_BCD(tm.tm_mday); + rtc_base[0x7ffd] = BIN2BCD(tm.tm_mday); /* hour/min/sec */ - rtc_base[0x7ffb] = CONV_BIN_TO_BCD(tm.tm_hour); - rtc_base[0x7ffa] = CONV_BIN_TO_BCD(tm.tm_min); - rtc_base[0x7ff9] = CONV_BIN_TO_BCD(tm.tm_sec); + rtc_base[0x7ffb] = BIN2BCD(tm.tm_hour); + rtc_base[0x7ffa] = BIN2BCD(tm.tm_min); + rtc_base[0x7ff9] = BIN2BCD(tm.tm_sec); /* day of week -- not really used, but let's keep it up-to-date */ - rtc_base[0x7ffc] = CONV_BIN_TO_BCD(tm.tm_wday + 1); + rtc_base[0x7ffc] = BIN2BCD(tm.tm_wday + 1); /* disable writing */ rtc_base[0x7ff8] = 0x00; |