brcm2708: update linux 4.4 patches to latest version
[openwrt/staging/dedeckeh.git] / target / linux / brcm2708 / patches-4.4 / 0147-Updated-smsc95xx-driver-to-check-for-a-valid-MAC-add.patch
1 From b94760d282632d4542f5b0fa785b8213311b1484 Mon Sep 17 00:00:00 2001
2 From: Craig Roberts <cjr@craigroberts.net>
3 Date: Tue, 16 Feb 2016 10:03:42 +0000
4 Subject: [PATCH 147/304] Updated smsc95xx driver to check for a valid MAC
5 address in eeprom before using smsc95xx.macaddr parameter passed on command
6 line.
7
8 The built-in RPi adaptor will still get a MAC address based on the parameter passed on the command line as the RPi hardware does not have an eeprom,
9 however usb->ethernet adaptors using the same driver should have an eeprom with MAC address as part of their hardware and therefore will use this
10 meaning they don't end up with the same MAC address as the built-in RPi adaptor.
11 ---
12 drivers/net/usb/smsc95xx.c | 10 +++++-----
13 1 file changed, 5 insertions(+), 5 deletions(-)
14
15 --- a/drivers/net/usb/smsc95xx.c
16 +++ b/drivers/net/usb/smsc95xx.c
17 @@ -817,10 +817,6 @@ static int smsc95xx_is_macaddr_param(str
18
19 static void smsc95xx_init_mac_address(struct usbnet *dev)
20 {
21 - /* Check module parameters */
22 - if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr))
23 - return;
24 -
25 /* try reading mac address from EEPROM */
26 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
27 dev->net->dev_addr) == 0) {
28 @@ -831,7 +827,11 @@ static void smsc95xx_init_mac_address(st
29 }
30 }
31
32 - /* no eeprom, or eeprom values are invalid. generate random MAC */
33 + /* Check module parameters */
34 + if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr))
35 + return;
36 +
37 + /* no eeprom, or eeprom values are invalid, and no module parameter specified to set MAC. Generate random MAC */
38 eth_hw_addr_random(dev->net);
39 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
40 }