Advertisement
danielhilst

*vc-diff*

Oct 10th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.18 KB | None | 0 0
  1. Index: smsc95xx.c
  2. ===================================================================
  3. --- smsc95xx.c  (revision 12158)
  4. +++ smsc95xx.c  (working copy)
  5. @@ -63,6 +63,10 @@
  6.  module_param(turbo_mode, bool, 0644);
  7.  MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
  8.  
  9. +static char *macaddr = NULL;
  10. +module_param(macaddr, charp, 0644);
  11. +MODULE_PARM_DESC(macaddr, "Set MAC address on command line");
  12. +
  13.  static int smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data)
  14.  {
  15.     u32 *buf = kmalloc(4, GFP_KERNEL);
  16. @@ -649,6 +653,26 @@
  17.         }
  18.     }
  19.  
  20. +   /* check for module param */
  21. +   if (macaddr) {
  22. +       char *ptr = macaddr;
  23. +       int i = 0;
  24. +
  25. +       /* Parse macaddr string and copy to &dev->net->dev_addr */
  26. +       do {
  27. +           sscanf(ptr, "%hhx", &dev->net->dev_addr[i]);
  28. +           if (!(ptr = strchr(ptr + 1, ':')))
  29. +               break;
  30. +           ptr++, i++;
  31. +       } while (i < ETH_ALEN);
  32. +
  33. +       if (is_valid_ether_addr(dev->net->dev_addr)) {
  34. +           netif_info(dev, ifup, dev->net, "MAC address read from module argument\n");
  35. +           return;
  36. +       }
  37. +
  38. +   }
  39. +
  40.     /* no eeprom, or eeprom values are invalid. generate random MAC */
  41.     random_ether_addr(dev->net->dev_addr);
  42.     netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement