simplify crypt_decode_key using simple_strotul as suggested by Andrew Morton

[Christophe Saout]
--- diff/drivers/md/dm-crypt.c	2004-01-03 12:14:13.000000000 +0000
+++ source/drivers/md/dm-crypt.c	2004-01-03 12:14:19.000000000 +0000
@@ -6,6 +6,7 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/bio.h>
 #include <linux/mempool.h>
 #include <linux/slab.h>
@@ -365,32 +366,20 @@
  */
 static int crypt_decode_key(u8 *key, char *hex, int size)
 {
+	char buffer[3];
+	char *endp;
 	int i;
+
+	buffer[2] = '\0';
+
 	for(i = 0; i < size; i++) {
-		int digits;
-		if (*hex >= 'a' && *hex <= 'f')
-			digits = *hex - ('a' - 10);
-		else if (*hex >= 'A' && *hex <= 'F')
-			digits = *hex - ('A' - 10);
-		else if (*hex >= '0' && *hex <= '9')
-			digits = *hex - '0';
-		else
-			return -EINVAL;
+		buffer[0] = *hex++;
+		buffer[1] = *hex++;
 
-		digits <<= 4;
-		hex++;
+		key[i] = (u8)simple_strtoul(buffer, &endp, 16);
 
-		if (*hex >= 'a' && *hex <= 'f')
-			digits += *hex - ('a' - 10);
-		else if (*hex >= 'A' && *hex <= 'F')
-			digits += *hex - ('A' - 10);
-		else if (*hex >= '0' && *hex <= '9')
-			digits += *hex - '0';
-		else
+		if (endp != &buffer[2])
 			return -EINVAL;
-
-		hex++;
-		key[i] = (u8)digits;
 	}
 
 	if (*hex != '\0')
