lantiq: Fix macaddr-setting code on DGN3500 and possibly other devices
authorDaniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
Fri, 27 May 2016 22:30:47 +0000 (15:30 -0700)
committerJohn Crispin <john@phrozen.org>
Fri, 27 May 2016 14:08:47 +0000 (16:08 +0200)
Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch

index 25852e2cca88429a60557b26deadf7ad3a76a037..91a884d2ea0fe981e2befc18575180e97a53feed 100644 (file)
@@ -379,7 +379,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +      eth_mac_set = mac_pton(str, eth_mac);
 +      return !eth_mac_set;
 +}
-+__setup("ethaddr=", setup_ethaddr);
++early_param("ethaddr", setup_ethaddr);
 +
 +int __init of_eth_mac_probe(struct platform_device *pdev)
 +{
@@ -620,10 +620,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                goto err_hw;
  
 -      memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr));
-+      if (priv->mac)
++      memcpy(&mac.sa_data, ltq_get_eth_mac(), ETH_ALEN);
++
++      if (priv->mac && !is_valid_ether_addr(mac.sa_data))
 +              memcpy(&mac.sa_data, priv->mac, ETH_ALEN);
-+      else
-+              memcpy(&mac.sa_data, ltq_get_eth_mac(), ETH_ALEN);
 +
        if (!is_valid_ether_addr(mac.sa_data)) {
                pr_warn("etop: invalid MAC, using random\n");