+ lib-introduce-common-method-to-convert-hex-digits.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     lib: introduce common method to convert hex digits
has been added to the -mm tree.  Its filename is
     lib-introduce-common-method-to-convert-hex-digits.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: lib: introduce common method to convert hex digits
From: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>

hex_to_bin() is a little method which converts hex digit to its actual
value.  There are plenty of places where such functionality is needed.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>
Cc: Tilman Schmidt <tilman@xxxxxxx>
Cc: Duncan Sands <duncan.sands@xxxxxxx>
Cc: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
Cc: "Richard Russon (FlatCap)" <ldm@xxxxxxxxxxx>
Cc: John W. Linville <linville@xxxxxxxxxxxxx>
Cc: Len Brown <lenb@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/kernel.h |    2 ++
 lib/hexdump.c          |   19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff -puN include/linux/kernel.h~lib-introduce-common-method-to-convert-hex-digits include/linux/kernel.h
--- a/include/linux/kernel.h~lib-introduce-common-method-to-convert-hex-digits
+++ a/include/linux/kernel.h
@@ -373,6 +373,8 @@ static inline char *pack_hex_byte(char *
 	return buf;
 }
 
+extern int hex_to_bin(char ch);
+
 #ifndef pr_fmt
 #define pr_fmt(fmt) fmt
 #endif
diff -puN lib/hexdump.c~lib-introduce-common-method-to-convert-hex-digits lib/hexdump.c
--- a/lib/hexdump.c~lib-introduce-common-method-to-convert-hex-digits
+++ a/lib/hexdump.c
@@ -16,6 +16,25 @@ const char hex_asc[] = "0123456789abcdef
 EXPORT_SYMBOL(hex_asc);
 
 /**
+ * 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 >= 'a') && (ch <= 'f'))
+		return ch - 'a' + 10;
+	if ((ch >= '0') && (ch <= '9'))
+		return ch - '0';
+	if ((ch >= 'A') && (ch <= 'F'))
+		return ch - 'A' + 10;
+	return -1;
+}
+EXPORT_SYMBOL(hex_to_bin);
+
+/**
  * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
  * @buf: data blob to dump
  * @len: number of bytes in the @buf
_

Patches currently in -mm which might be from ext-andriy.shevchenko@xxxxxxxxx are

linux-next.patch
lib-introduce-common-method-to-convert-hex-digits.patch
drivers-isdn-use-new-hex_to_bin-method.patch
usb-atm-speedtch-use-new-hex_to_bin-method.patch
sysctl-dont-use-own-implementation-of-hex_to_bin.patch
staging-rt2860-use-new-hex_to_bin-method.patch
fs-ldm-dont-use-own-implementation-of-hex_to_bin.patch
drivers-wireless-use-new-hex_to_bin-method.patch
drivers-acpi-dont-use-own-implementation-of-hex_to_bin.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux