1 diff -Naur linux-3.10.10/drivers/net/usb/smsc95xx.c linux-c1af7c6db316763b9dce7137495cb9ada8fa17b4/drivers/net/usb/smsc95xx.c
2 --- linux-3.10.10/drivers/net/usb/smsc95xx.c 2013-08-29 18:47:51.000000000 +0200
3 +++ linux-c1af7c6db316763b9dce7137495cb9ada8fa17b4/drivers/net/usb/smsc95xx.c 2013-08-30 20:12:54.000000000 +0200
5 #define SUSPEND_SUSPEND3 (0x08)
6 #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \
7 SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3)
8 +#define MAC_ADDR_LEN (6)
10 struct smsc95xx_priv {
13 module_param(turbo_mode, bool, 0644);
14 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
16 +static char *macaddr = ":";
17 +module_param(macaddr, charp, 0);
18 +MODULE_PARM_DESC(macaddr, "MAC address");
20 static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index,
24 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
27 +/* Check the macaddr module parameter for a MAC address */
28 +static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac)
30 + int i, j, got_num, num;
31 + u8 mtbl[MAC_ADDR_LEN];
33 + if (macaddr[0] == ':')
40 + while (j < MAC_ADDR_LEN) {
41 + if (macaddr[i] && macaddr[i] != ':') {
43 + if ('0' <= macaddr[i] && macaddr[i] <= '9')
44 + num = num * 16 + macaddr[i] - '0';
45 + else if ('A' <= macaddr[i] && macaddr[i] <= 'F')
46 + num = num * 16 + 10 + macaddr[i] - 'A';
47 + else if ('a' <= macaddr[i] && macaddr[i] <= 'f')
48 + num = num * 16 + 10 + macaddr[i] - 'a';
52 + } else if (got_num == 2) {
53 + mtbl[j++] = (u8) num;
62 + if (j == MAC_ADDR_LEN) {
63 + netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: "
64 + "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2],
65 + mtbl[3], mtbl[4], mtbl[5]);
66 + for (i = 0; i < MAC_ADDR_LEN; i++)
67 + dev_mac[i] = mtbl[i];
74 static void smsc95xx_init_mac_address(struct usbnet *dev)
76 + /* Check module parameters */
77 + if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr))
80 /* try reading mac address from EEPROM */
81 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
82 dev->net->dev_addr) == 0) {