aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2010-09-11 09:31:02 -0400
committerMatthew Garrett <mjg@redhat.com>2010-10-21 09:36:45 -0400
commit392bd8b58414106b129d72a33fa99b999b720237 (patch)
tree432b6aad41b2e511b7750917049335d04f80730e /drivers/platform
parent91e5d284a7f14c70187914056b0466163a5e2f03 (diff)
platform: x86: throw away custom methods
In 2.6.35 the hex_to_bin() was introduced. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Carlos Corbacho <carlos@strangeworlds.co.uk> Cc: Matthew Garrett <mjg@redhat.com> Cc: platform-driver-x86@vger.kernel.org Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/wmi.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index b2978a04317f..49806824a463 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -128,30 +128,18 @@ static struct acpi_driver acpi_wmi_driver = {
128 */ 128 */
129static int wmi_parse_hexbyte(const u8 *src) 129static int wmi_parse_hexbyte(const u8 *src)
130{ 130{
131 unsigned int x; /* For correct wrapping */
132 int h; 131 int h;
132 int value;
133 133
134 /* high part */ 134 /* high part */
135 x = src[0]; 135 h = value = hex_to_bin(src[0]);
136 if (x - '0' <= '9' - '0') { 136 if (value < 0)
137 h = x - '0';
138 } else if (x - 'a' <= 'f' - 'a') {
139 h = x - 'a' + 10;
140 } else if (x - 'A' <= 'F' - 'A') {
141 h = x - 'A' + 10;
142 } else {
143 return -1; 137 return -1;
144 }
145 h <<= 4;
146 138
147 /* low part */ 139 /* low part */
148 x = src[1]; 140 value = hex_to_bin(src[1]);
149 if (x - '0' <= '9' - '0') 141 if (value >= 0)
150 return h | (x - '0'); 142 return (h << 4) | value;
151 if (x - 'a' <= 'f' - 'a')
152 return h | (x - 'a' + 10);
153 if (x - 'A' <= 'F' - 'A')
154 return h | (x - 'A' + 10);
155 return -1; 143 return -1;
156} 144}
157 145