Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: smsc95xx.c
- ===================================================================
- --- smsc95xx.c (revision 12158)
- +++ smsc95xx.c (working copy)
- @@ -63,6 +63,10 @@
- module_param(turbo_mode, bool, 0644);
- MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
- +static char *macaddr = NULL;
- +module_param(macaddr, charp, 0644);
- +MODULE_PARM_DESC(macaddr, "Set MAC address on command line");
- +
- static int smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data)
- {
- u32 *buf = kmalloc(4, GFP_KERNEL);
- @@ -649,6 +653,26 @@
- }
- }
- + /* check for module param */
- + if (macaddr) {
- + char *ptr = macaddr;
- + int i = 0;
- +
- + /* Parse macaddr string and copy to &dev->net->dev_addr */
- + do {
- + sscanf(ptr, "%hhx", &dev->net->dev_addr[i]);
- + if (!(ptr = strchr(ptr + 1, ':')))
- + break;
- + ptr++, i++;
- + } while (i < ETH_ALEN);
- +
- + if (is_valid_ether_addr(dev->net->dev_addr)) {
- + netif_info(dev, ifup, dev->net, "MAC address read from module argument\n");
- + return;
- + }
- +
- + }
- +
- /* no eeprom, or eeprom values are invalid. generate random MAC */
- random_ether_addr(dev->net->dev_addr);
- netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement