diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-10-15 14:53:04 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-10-18 13:20:38 +0100 |
commit | 4abd7cffc09a38015fa14a22471e3de48a4ca032 (patch) | |
tree | b6a0100f08a5de51263210934a6ce8f4fec1f4f0 /drivers/net/ethernet/natsemi | |
parent | 0e9e7598c68f1dc17ce1053b08494b8ed6dd4985 (diff) |
ethernet: use eth_hw_addr_set() in unmaintained drivers
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/natsemi')
-rw-r--r-- | drivers/net/ethernet/natsemi/natsemi.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/natsemi/ns83820.c | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c index 3f982033944b..82a22711ce45 100644 --- a/drivers/net/ethernet/natsemi/natsemi.c +++ b/drivers/net/ethernet/natsemi/natsemi.c @@ -809,6 +809,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) unsigned long iosize; void __iomem *ioaddr; const int pcibar = 1; /* PCI base address register */ + u8 addr[ETH_ALEN]; int prev_eedata; u32 tmp; @@ -859,10 +860,11 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent) prev_eedata = eeprom_read(ioaddr, 6); for (i = 0; i < 3; i++) { int eedata = eeprom_read(ioaddr, i + 7); - dev->dev_addr[i*2] = (eedata << 1) + (prev_eedata >> 15); - dev->dev_addr[i*2+1] = eedata >> 7; + addr[i*2] = (eedata << 1) + (prev_eedata >> 15); + addr[i*2+1] = eedata >> 7; prev_eedata = eedata; } + eth_hw_addr_set(dev, addr); np = netdev_priv(dev); np->ioaddr = ioaddr; diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c index 72794d158871..49ea130c9067 100644 --- a/drivers/net/ethernet/natsemi/ns83820.c +++ b/drivers/net/ethernet/natsemi/ns83820.c @@ -1649,9 +1649,11 @@ failed: return ret; } -static void ns83820_getmac(struct ns83820 *dev, u8 *mac) +static void ns83820_getmac(struct ns83820 *dev, struct net_device *ndev) { + u8 mac[ETH_ALEN]; unsigned i; + for (i=0; i<3; i++) { u32 data; @@ -1661,9 +1663,10 @@ static void ns83820_getmac(struct ns83820 *dev, u8 *mac) writel(i*2, dev->base + RFCR); data = readl(dev->base + RFDR); - *mac++ = data; - *mac++ = data >> 8; + mac[i * 2] = data; + mac[i * 2 + 1] = data >> 8; } + eth_hw_addr_set(ndev, mac); } static void ns83820_set_multicast(struct net_device *ndev) @@ -2136,7 +2139,7 @@ static int ns83820_init_one(struct pci_dev *pci_dev, /* Disable Wake On Lan */ writel(0, dev->base + WCSR); - ns83820_getmac(dev, ndev->dev_addr); + ns83820_getmac(dev, ndev); /* Yes, we support dumb IP checksum on transmit */ ndev->features |= NETIF_F_SG; |