]> git.openfabrics.org - ~emulex/compat.git/commitdiff
compat: backport hex_to_bin first introduced in v2.6.35
authorKshitij Kulshreshtha <kkhere.geo@gmail.com>
Sun, 1 Aug 2010 22:02:49 +0000 (00:02 +0200)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Mon, 2 Aug 2010 18:01:32 +0000 (11:01 -0700)
Signed-off-by: Kshitij Kulshreshtha <kkhere.geo@gmail.com>
compat/Makefile
compat/compat-2.6.35.c [new file with mode: 0644]
include/linux/compat-2.6.35.h

index 2005ff3a6cddbb56b4943b4e7f04117805abdeb5..bcd8fe76df0b369cd7c424ac6a5b330df6837b40 100644 (file)
@@ -26,3 +26,4 @@ compat-$(CONFIG_COMPAT_KERNEL_30) += compat-2.6.30.o
 compat-$(CONFIG_COMPAT_KERNEL_31) += compat-2.6.31.o
 compat-$(CONFIG_COMPAT_KERNEL_32) += compat-2.6.32.o
 compat-$(CONFIG_COMPAT_KERNEL_33) += compat-2.6.33.o
+compat-$(CONFIG_COMPAT_KERNEL_35) += compat-2.6.35.o
diff --git a/compat/compat-2.6.35.c b/compat/compat-2.6.35.c
new file mode 100644 (file)
index 0000000..0d702ed
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010    Kshitij Kulshreshtha <kkhere.geo@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Compatibility file for Linux wireless for kernels 2.6.35.
+ */
+
+#include <linux/compat.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+#include <linux/ctype.h>
+
+/**
+ * hex_to_bin - convert a hex digit to its real value
+ * @ch: ascii character represents hex digit
+ *
+ * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
+ * input.
+ */
+int hex_to_bin(char ch)
+{
+       if ((ch >= '0') && (ch <= '9'))
+               return ch - '0';
+       ch = tolower(ch);
+       if ((ch >= 'a') && (ch <= 'f'))
+               return ch - 'a' + 10;
+       return -1;
+}
+EXPORT_SYMBOL(hex_to_bin);
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) */
index c6e7136c0526dce838959f09f031d8013cef7c0c..f0562cd760068b30b55619175044b1985341a6da 100644 (file)
@@ -25,6 +25,8 @@ static inline wait_queue_head_t *sk_sleep(struct sock *sk)
 
 #define sdio_writeb_readb(func, write_byte, addr, err_ret) sdio_readb(func, addr, err_ret)
 
+int hex_to_bin(char ch);
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) */
 
 #endif /* LINUX_26_35_COMPAT_H */