diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/bcd.c | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Makefile b/lib/Makefile index 818c4d455518..9085ad6fa53d 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -18,7 +18,7 @@ lib-$(CONFIG_SMP) += cpumask.o | |||
18 | 18 | ||
19 | lib-y += kobject.o kref.o klist.o | 19 | lib-y += kobject.o kref.o klist.o |
20 | 20 | ||
21 | obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | 21 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ |
22 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o | 22 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o |
23 | 23 | ||
24 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) | 24 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) |
diff --git a/lib/bcd.c b/lib/bcd.c new file mode 100644 index 000000000000..d74257fd0fe7 --- /dev/null +++ b/lib/bcd.c | |||
@@ -0,0 +1,14 @@ | |||
1 | #include <linux/bcd.h> | ||
2 | #include <linux/module.h> | ||
3 | |||
4 | unsigned bcd2bin(unsigned char val) | ||
5 | { | ||
6 | return (val & 0x0f) + (val >> 4) * 10; | ||
7 | } | ||
8 | EXPORT_SYMBOL(bcd2bin); | ||
9 | |||
10 | unsigned char bin2bcd(unsigned val) | ||
11 | { | ||
12 | return ((val / 10) << 4) + val % 10; | ||
13 | } | ||
14 | EXPORT_SYMBOL(bin2bcd); | ||