]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: bgmac: store MAC address directly in netdev->dev_addr
authorTobias Klauser <tklauser@distanz.ch>
Thu, 16 Feb 2017 14:11:19 +0000 (15:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Feb 2017 18:03:39 +0000 (13:03 -0500)
After commit 34a5102c3235 ("net: bgmac: allocate struct bgmac just once
& don't copy it") the mac_addr member of struct bgmac is no longer
necessary to pass the MAC address to bgmac_enet_probe(). Instead it can
directly be stored in netdev->dev_addr.

Also use eth_hw_addr_random() instead of eth_random_addr() in case a
random MAC is nedded. This will make sure netdev->addr_assign_type will
be properly set.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Jon Mason <jon.mason@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bgmac-bcma.c
drivers/net/ethernet/broadcom/bgmac-platform.c
drivers/net/ethernet/broadcom/bgmac.c
drivers/net/ethernet/broadcom/bgmac.h

index 5ef60d4f12b48579ba775fdcdda946b1ba5b94c5..d59cfcc4c4d596d48957ecd06a77cf8a475090b7 100644 (file)
@@ -144,7 +144,7 @@ static int bgmac_probe(struct bcma_device *core)
                goto err;
        }
 
-       ether_addr_copy(bgmac->mac_addr, mac);
+       ether_addr_copy(bgmac->net_dev->dev_addr, mac);
 
        /* On BCM4706 we need common core to access PHY */
        if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
index 805e6ed6c390b0ee7900bcd353ec6fe4c435ef0f..7b1af950f312f30b2b6caae941a2a39e47caa3fd 100644 (file)
@@ -169,7 +169,7 @@ static int bgmac_probe(struct platform_device *pdev)
 
        mac_addr = of_get_mac_address(np);
        if (mac_addr)
-               ether_addr_copy(bgmac->mac_addr, mac_addr);
+               ether_addr_copy(bgmac->net_dev->dev_addr, mac_addr);
        else
                dev_warn(&pdev->dev, "MAC address not present in device tree\n");
 
index 20fe2520da429d2bd12bcd3fc2fdcae6e0d87478..415046750bb449853e794318c700d14f1a1de48d 100644 (file)
@@ -1477,14 +1477,13 @@ int bgmac_enet_probe(struct bgmac *bgmac)
        net_dev->irq = bgmac->irq;
        SET_NETDEV_DEV(net_dev, bgmac->dev);
 
-       if (!is_valid_ether_addr(bgmac->mac_addr)) {
+       if (!is_valid_ether_addr(net_dev->dev_addr)) {
                dev_err(bgmac->dev, "Invalid MAC addr: %pM\n",
-                       bgmac->mac_addr);
-               eth_random_addr(bgmac->mac_addr);
+                       net_dev->dev_addr);
+               eth_hw_addr_random(net_dev);
                dev_warn(bgmac->dev, "Using random MAC: %pM\n",
-                        bgmac->mac_addr);
+                        net_dev->dev_addr);
        }
-       ether_addr_copy(net_dev->dev_addr, bgmac->mac_addr);
 
        /* This (reset &) enable is not preset in specs or reference driver but
         * Broadcom does it in arch PCI code when enabling fake PCI device.
index ab2db76e4fb814eab0f310973da249c1d2e18992..248727dc62f22c2ae2aa6f640f1b2cf91230a133 100644 (file)
@@ -474,7 +474,6 @@ struct bgmac {
 
        struct device *dev;
        struct device *dma_dev;
-       unsigned char mac_addr[ETH_ALEN];
        u32 feature_flags;
 
        struct net_device *net_dev;