Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e644814a authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman
Browse files

usb: throw away custom hex digit methods



Recent kernel has common method to convert hex digit to its value.

Signed-off-by: default avatarAndy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a5cc8049
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -67,6 +67,7 @@
#include <linux/mutex.h>
#include <linux/mutex.h>
#include <linux/freezer.h>
#include <linux/freezer.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/kernel.h>


#include <asm/unaligned.h>
#include <asm/unaligned.h>


@@ -2436,7 +2437,6 @@ UEA_ATTR(firmid, 0);


/* Retrieve the device End System Identifier (MAC) */
/* Retrieve the device End System Identifier (MAC) */


#define htoi(x) (isdigit(x) ? x-'0' : toupper(x)-'A'+10)
static int uea_getesi(struct uea_softc *sc, u_char * esi)
static int uea_getesi(struct uea_softc *sc, u_char * esi)
{
{
	unsigned char mac_str[2 * ETH_ALEN + 1];
	unsigned char mac_str[2 * ETH_ALEN + 1];
@@ -2447,7 +2447,8 @@ static int uea_getesi(struct uea_softc *sc, u_char * esi)
		return 1;
		return 1;


	for (i = 0; i < ETH_ALEN; i++)
	for (i = 0; i < ETH_ALEN; i++)
		esi[i] = htoi(mac_str[2 * i]) * 16 + htoi(mac_str[2 * i + 1]);
		esi[i] = hex_to_bin(mac_str[2 * i]) * 16 +
			 hex_to_bin(mac_str[2 * i + 1]);


	return 0;
	return 0;
}
}
+2 −13
Original line number Original line Diff line number Diff line
@@ -704,17 +704,6 @@ static char *host_addr;
module_param(host_addr, charp, S_IRUGO);
module_param(host_addr, charp, S_IRUGO);
MODULE_PARM_DESC(host_addr, "Host Ethernet Address");
MODULE_PARM_DESC(host_addr, "Host Ethernet Address");



static u8 __init nibble(unsigned char c)
{
	if (isdigit(c))
		return c - '0';
	c = toupper(c);
	if (isxdigit(c))
		return 10 + c - 'A';
	return 0;
}

static int get_ether_addr(const char *str, u8 *dev_addr)
static int get_ether_addr(const char *str, u8 *dev_addr)
{
{
	if (str) {
	if (str) {
@@ -725,8 +714,8 @@ static int get_ether_addr(const char *str, u8 *dev_addr)


			if ((*str == '.') || (*str == ':'))
			if ((*str == '.') || (*str == ':'))
				str++;
				str++;
			num = nibble(*str++) << 4;
			num = hex_to_bin(*str++) << 4;
			num |= (nibble(*str++));
			num |= hex_to_bin(*str++);
			dev_addr [i] = num;
			dev_addr [i] = num;
		}
		}
		if (is_valid_ether_addr(dev_addr))
		if (is_valid_ether_addr(dev_addr))