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>
This commit is contained in:
parent
91e5d284a7
commit
392bd8b584
|
@ -128,30 +128,18 @@ static struct acpi_driver acpi_wmi_driver = {
|
||||||
*/
|
*/
|
||||||
static int wmi_parse_hexbyte(const u8 *src)
|
static int wmi_parse_hexbyte(const u8 *src)
|
||||||
{
|
{
|
||||||
unsigned int x; /* For correct wrapping */
|
|
||||||
int h;
|
int h;
|
||||||
|
int value;
|
||||||
|
|
||||||
/* high part */
|
/* high part */
|
||||||
x = src[0];
|
h = value = hex_to_bin(src[0]);
|
||||||
if (x - '0' <= '9' - '0') {
|
if (value < 0)
|
||||||
h = x - '0';
|
|
||||||
} else if (x - 'a' <= 'f' - 'a') {
|
|
||||||
h = x - 'a' + 10;
|
|
||||||
} else if (x - 'A' <= 'F' - 'A') {
|
|
||||||
h = x - 'A' + 10;
|
|
||||||
} else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
h <<= 4;
|
|
||||||
|
|
||||||
/* low part */
|
/* low part */
|
||||||
x = src[1];
|
value = hex_to_bin(src[1]);
|
||||||
if (x - '0' <= '9' - '0')
|
if (value >= 0)
|
||||||
return h | (x - '0');
|
return (h << 4) | value;
|
||||||
if (x - 'a' <= 'f' - 'a')
|
|
||||||
return h | (x - 'a' + 10);
|
|
||||||
if (x - 'A' <= 'F' - 'A')
|
|
||||||
return h | (x - 'A' + 10);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue