aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/bvme6000
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@kernel.org>2008-10-13 15:58:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-14 13:23:26 -0400
commit5b1d5f953bbb50dcbdf93719cb622aa128ba7527 (patch)
treed1f826b007e909bbf340498376c83a0452359af4 /arch/m68k/bvme6000
parent4aba41ea8bdc1b475861f5e5c1649ab20251090c (diff)
m68k: use bcd2bin/bin2bcd
This patch changes m68k to use the new bcd2bin/bin2bcd functions instead of the obsolete BCD_TO_BIN/BIN_TO_BCD/BCD2BIN/BIN2BCD macros. It also remove local bcd2bin/bin2bcd implementations in favor of the global ones. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68k/bvme6000')
-rw-r--r--arch/m68k/bvme6000/config.c15
-rw-r--r--arch/m68k/bvme6000/rtc.c30
2 files changed, 16 insertions, 29 deletions
diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index 9433a88a33c4..65c9204ab9ac 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -25,6 +25,7 @@
25#include <linux/genhd.h> 25#include <linux/genhd.h>
26#include <linux/rtc.h> 26#include <linux/rtc.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/bcd.h>
28 29
29#include <asm/bootinfo.h> 30#include <asm/bootinfo.h>
30#include <asm/system.h> 31#include <asm/system.h>
@@ -46,9 +47,6 @@ extern void bvme6000_reset (void);
46extern void bvme6000_waitbut(void); 47extern void bvme6000_waitbut(void);
47void bvme6000_set_vectors (void); 48void bvme6000_set_vectors (void);
48 49
49static unsigned char bcd2bin (unsigned char b);
50static unsigned char bin2bcd (unsigned char b);
51
52/* Save tick handler routine pointer, will point to do_timer() in 50/* Save tick handler routine pointer, will point to do_timer() in
53 * kernel/sched.c, called via bvme6000_process_int() */ 51 * kernel/sched.c, called via bvme6000_process_int() */
54 52
@@ -264,17 +262,6 @@ unsigned long bvme6000_gettimeoffset (void)
264 return v; 262 return v;
265} 263}
266 264
267static unsigned char bcd2bin (unsigned char b)
268{
269 return ((b>>4)*10 + (b&15));
270}
271
272static unsigned char bin2bcd (unsigned char b)
273{
274 return (((b/10)*16) + (b%10));
275}
276
277
278/* 265/*
279 * Looks like op is non-zero for setting the clock, and zero for 266 * Looks like op is non-zero for setting the clock, and zero for
280 * reading the clock. 267 * reading the clock.
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
index e8ac3f7d72df..808c9018b115 100644
--- a/arch/m68k/bvme6000/rtc.c
+++ b/arch/m68k/bvme6000/rtc.c
@@ -57,16 +57,16 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
57 rtc->msr = 0x40; 57 rtc->msr = 0x40;
58 memset(&wtime, 0, sizeof(struct rtc_time)); 58 memset(&wtime, 0, sizeof(struct rtc_time));
59 do { 59 do {
60 wtime.tm_sec = BCD2BIN(rtc->bcd_sec); 60 wtime.tm_sec = bcd2bin(rtc->bcd_sec);
61 wtime.tm_min = BCD2BIN(rtc->bcd_min); 61 wtime.tm_min = bcd2bin(rtc->bcd_min);
62 wtime.tm_hour = BCD2BIN(rtc->bcd_hr); 62 wtime.tm_hour = bcd2bin(rtc->bcd_hr);
63 wtime.tm_mday = BCD2BIN(rtc->bcd_dom); 63 wtime.tm_mday = bcd2bin(rtc->bcd_dom);
64 wtime.tm_mon = BCD2BIN(rtc->bcd_mth)-1; 64 wtime.tm_mon = bcd2bin(rtc->bcd_mth)-1;
65 wtime.tm_year = BCD2BIN(rtc->bcd_year); 65 wtime.tm_year = bcd2bin(rtc->bcd_year);
66 if (wtime.tm_year < 70) 66 if (wtime.tm_year < 70)
67 wtime.tm_year += 100; 67 wtime.tm_year += 100;
68 wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1; 68 wtime.tm_wday = bcd2bin(rtc->bcd_dow)-1;
69 } while (wtime.tm_sec != BCD2BIN(rtc->bcd_sec)); 69 } while (wtime.tm_sec != bcd2bin(rtc->bcd_sec));
70 rtc->msr = msr; 70 rtc->msr = msr;
71 local_irq_restore(flags); 71 local_irq_restore(flags);
72 return copy_to_user(argp, &wtime, sizeof wtime) ? 72 return copy_to_user(argp, &wtime, sizeof wtime) ?
@@ -114,14 +114,14 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
114 114
115 rtc->t0cr_rtmr = yrs%4; 115 rtc->t0cr_rtmr = yrs%4;
116 rtc->bcd_tenms = 0; 116 rtc->bcd_tenms = 0;
117 rtc->bcd_sec = BIN2BCD(sec); 117 rtc->bcd_sec = bin2bcd(sec);
118 rtc->bcd_min = BIN2BCD(min); 118 rtc->bcd_min = bin2bcd(min);
119 rtc->bcd_hr = BIN2BCD(hrs); 119 rtc->bcd_hr = bin2bcd(hrs);
120 rtc->bcd_dom = BIN2BCD(day); 120 rtc->bcd_dom = bin2bcd(day);
121 rtc->bcd_mth = BIN2BCD(mon); 121 rtc->bcd_mth = bin2bcd(mon);
122 rtc->bcd_year = BIN2BCD(yrs%100); 122 rtc->bcd_year = bin2bcd(yrs%100);
123 if (rtc_tm.tm_wday >= 0) 123 if (rtc_tm.tm_wday >= 0)
124 rtc->bcd_dow = BIN2BCD(rtc_tm.tm_wday+1); 124 rtc->bcd_dow = bin2bcd(rtc_tm.tm_wday+1);
125 rtc->t0cr_rtmr = yrs%4 | 0x08; 125 rtc->t0cr_rtmr = yrs%4 | 0x08;
126 126
127 rtc->msr = msr; 127 rtc->msr = msr;