net: bgmac: store MAC address directly in netdev->dev_addr
After commit 34a5102c32
("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>
This commit is contained in:

committed by
David S. Miller

parent
3105dfb2a9
commit
6850f8b509
@@ -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.
|
||||
|
Reference in New Issue
Block a user