Commit 91f06e66805dd94825885b3ec392c693fe9ef4d9

Authored by Andy Shevchenko
Committed by Linus Torvalds
1 parent 1356de06ce

fs: ldm: don't use own implementation of hex_to_bin()

Remove own implementation of hex_to_bin().

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: "Richard Russon (FlatCap)" <ldm@flatcap.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 9 additions and 9 deletions Side-by-side Diff

... ... @@ -26,6 +26,7 @@
26 26 #include <linux/slab.h>
27 27 #include <linux/pagemap.h>
28 28 #include <linux/stringify.h>
  29 +#include <linux/kernel.h>
29 30 #include "ldm.h"
30 31 #include "check.h"
31 32 #include "msdos.h"
32 33  
... ... @@ -77,17 +78,16 @@
77 78 int h;
78 79  
79 80 /* high part */
80   - if ((x = src[0] - '0') <= '9'-'0') h = x;
81   - else if ((x = src[0] - 'a') <= 'f'-'a') h = x+10;
82   - else if ((x = src[0] - 'A') <= 'F'-'A') h = x+10;
83   - else return -1;
84   - h <<= 4;
  81 + x = h = hex_to_bin(src[0]);
  82 + if (h < 0)
  83 + return -1;
85 84  
86 85 /* low part */
87   - if ((x = src[1] - '0') <= '9'-'0') return h | x;
88   - if ((x = src[1] - 'a') <= 'f'-'a') return h | (x+10);
89   - if ((x = src[1] - 'A') <= 'F'-'A') return h | (x+10);
90   - return -1;
  86 + h = hex_to_bin(src[1]);
  87 + if (h < 0)
  88 + return -1;
  89 +
  90 + return (x << 4) + h;
91 91 }
92 92  
93 93 /**