Commit 8ce218b6 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

ethernet: 8390: remove direct netdev->dev_addr writes

8390 contains a lot of loops assigning netdev->dev_addr
byte by byte. Convert what's possible directly to
eth_hw_addr_set(), use local buf in other places.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7639279
...@@ -320,8 +320,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) ...@@ -320,8 +320,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
i = request_irq(dev->irq, apne_interrupt, IRQF_SHARED, DRV_NAME, dev); i = request_irq(dev->irq, apne_interrupt, IRQF_SHARED, DRV_NAME, dev);
if (i) return i; if (i) return i;
for (i = 0; i < ETH_ALEN; i++) eth_hw_addr_set(dev, SA_prom);
dev->dev_addr[i] = SA_prom[i];
pr_cont(" %pM\n", dev->dev_addr); pr_cont(" %pM\n", dev->dev_addr);
......
...@@ -748,11 +748,13 @@ static int ax_init_dev(struct net_device *dev) ...@@ -748,11 +748,13 @@ static int ax_init_dev(struct net_device *dev)
/* load the mac-address from the device */ /* load the mac-address from the device */
if (ax->plat->flags & AXFLG_MAC_FROMDEV) { if (ax->plat->flags & AXFLG_MAC_FROMDEV) {
u8 addr[ETH_ALEN];
ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP, ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
ei_local->mem + E8390_CMD); /* 0x61 */ ei_local->mem + E8390_CMD); /* 0x61 */
for (i = 0; i < ETH_ALEN; i++) for (i = 0; i < ETH_ALEN; i++)
dev->dev_addr[i] = addr[i] = ei_inb(ioaddr + EN1_PHYS_SHIFT(i));
ei_inb(ioaddr + EN1_PHYS_SHIFT(i)); eth_hw_addr_set(dev, addr);
} }
if ((ax->plat->flags & AXFLG_MAC_FROMPLATFORM) && if ((ax->plat->flags & AXFLG_MAC_FROMPLATFORM) &&
......
...@@ -187,6 +187,7 @@ static int get_prom(struct pcmcia_device *link) ...@@ -187,6 +187,7 @@ static int get_prom(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
u8 addr[ETH_ALEN];
int i, j; int i, j;
/* This is based on drivers/net/ethernet/8390/ne.c */ /* This is based on drivers/net/ethernet/8390/ne.c */
...@@ -220,9 +221,11 @@ static int get_prom(struct pcmcia_device *link) ...@@ -220,9 +221,11 @@ static int get_prom(struct pcmcia_device *link)
for (i = 0; i < 6; i += 2) { for (i = 0; i < 6; i += 2) {
j = inw(ioaddr + AXNET_DATAPORT); j = inw(ioaddr + AXNET_DATAPORT);
dev->dev_addr[i] = j & 0xff; addr[i] = j & 0xff;
dev->dev_addr[i+1] = j >> 8; addr[i+1] = j >> 8;
} }
eth_hw_addr_set(dev, addr);
return 1; return 1;
} /* get_prom */ } /* get_prom */
......
...@@ -374,8 +374,7 @@ static int mcf8390_init(struct net_device *dev) ...@@ -374,8 +374,7 @@ static int mcf8390_init(struct net_device *dev)
if (ret) if (ret)
return ret; return ret;
for (i = 0; i < ETH_ALEN; i++) eth_hw_addr_set(dev, SA_prom);
dev->dev_addr[i] = SA_prom[i];
netdev_dbg(dev, "Found ethernet address: %pM\n", dev->dev_addr); netdev_dbg(dev, "Found ethernet address: %pM\n", dev->dev_addr);
......
...@@ -500,9 +500,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) ...@@ -500,9 +500,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
for (i = 0; i < ETH_ALEN; i++) { eth_hw_addr_set(dev, SA_prom);
dev->dev_addr[i] = SA_prom[i];
}
pr_cont("%pM\n", dev->dev_addr); pr_cont("%pM\n", dev->dev_addr);
......
...@@ -278,6 +278,7 @@ static struct hw_info *get_hwinfo(struct pcmcia_device *link) ...@@ -278,6 +278,7 @@ static struct hw_info *get_hwinfo(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
u_char __iomem *base, *virt; u_char __iomem *base, *virt;
u8 addr[ETH_ALEN];
int i, j; int i, j;
/* Allocate a small memory window */ /* Allocate a small memory window */
...@@ -302,7 +303,8 @@ static struct hw_info *get_hwinfo(struct pcmcia_device *link) ...@@ -302,7 +303,8 @@ static struct hw_info *get_hwinfo(struct pcmcia_device *link)
(readb(base+2) == hw_info[i].a1) && (readb(base+2) == hw_info[i].a1) &&
(readb(base+4) == hw_info[i].a2)) { (readb(base+4) == hw_info[i].a2)) {
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++)
dev->dev_addr[j] = readb(base + (j<<1)); addr[j] = readb(base + (j<<1));
eth_hw_addr_set(dev, addr);
break; break;
} }
} }
...@@ -324,6 +326,7 @@ static struct hw_info *get_prom(struct pcmcia_device *link) ...@@ -324,6 +326,7 @@ static struct hw_info *get_prom(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
u8 addr[ETH_ALEN];
u_char prom[32]; u_char prom[32];
int i, j; int i, j;
...@@ -362,7 +365,8 @@ static struct hw_info *get_prom(struct pcmcia_device *link) ...@@ -362,7 +365,8 @@ static struct hw_info *get_prom(struct pcmcia_device *link)
} }
if ((i < NR_INFO) || ((prom[28] == 0x57) && (prom[30] == 0x57))) { if ((i < NR_INFO) || ((prom[28] == 0x57) && (prom[30] == 0x57))) {
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++)
dev->dev_addr[j] = prom[j<<1]; addr[j] = prom[j<<1];
eth_hw_addr_set(dev, addr);
return (i < NR_INFO) ? hw_info+i : &default_info; return (i < NR_INFO) ? hw_info+i : &default_info;
} }
return NULL; return NULL;
...@@ -377,6 +381,7 @@ static struct hw_info *get_prom(struct pcmcia_device *link) ...@@ -377,6 +381,7 @@ static struct hw_info *get_prom(struct pcmcia_device *link)
static struct hw_info *get_dl10019(struct pcmcia_device *link) static struct hw_info *get_dl10019(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
u8 addr[ETH_ALEN];
int i; int i;
u_char sum; u_char sum;
...@@ -385,7 +390,8 @@ static struct hw_info *get_dl10019(struct pcmcia_device *link) ...@@ -385,7 +390,8 @@ static struct hw_info *get_dl10019(struct pcmcia_device *link)
if (sum != 0xff) if (sum != 0xff)
return NULL; return NULL;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev->dev_addr[i] = inb_p(dev->base_addr + 0x14 + i); addr[i] = inb_p(dev->base_addr + 0x14 + i);
eth_hw_addr_set(dev, addr);
i = inb(dev->base_addr + 0x1f); i = inb(dev->base_addr + 0x1f);
return ((i == 0x91)||(i == 0x99)) ? &dl10022_info : &dl10019_info; return ((i == 0x91)||(i == 0x99)) ? &dl10022_info : &dl10019_info;
} }
...@@ -400,6 +406,7 @@ static struct hw_info *get_ax88190(struct pcmcia_device *link) ...@@ -400,6 +406,7 @@ static struct hw_info *get_ax88190(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
u8 addr[ETH_ALEN];
int i, j; int i, j;
/* Not much of a test, but the alternatives are messy */ /* Not much of a test, but the alternatives are messy */
...@@ -413,9 +420,10 @@ static struct hw_info *get_ax88190(struct pcmcia_device *link) ...@@ -413,9 +420,10 @@ static struct hw_info *get_ax88190(struct pcmcia_device *link)
for (i = 0; i < 6; i += 2) { for (i = 0; i < 6; i += 2) {
j = inw(ioaddr + PCNET_DATAPORT); j = inw(ioaddr + PCNET_DATAPORT);
dev->dev_addr[i] = j & 0xff; addr[i] = j & 0xff;
dev->dev_addr[i+1] = j >> 8; addr[i+1] = j >> 8;
} }
eth_hw_addr_set(dev, addr);
return NULL; return NULL;
} }
...@@ -430,6 +438,7 @@ static struct hw_info *get_ax88190(struct pcmcia_device *link) ...@@ -430,6 +438,7 @@ static struct hw_info *get_ax88190(struct pcmcia_device *link)
static struct hw_info *get_hwired(struct pcmcia_device *link) static struct hw_info *get_hwired(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
u8 addr[ETH_ALEN];
int i; int i;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
...@@ -438,7 +447,8 @@ static struct hw_info *get_hwired(struct pcmcia_device *link) ...@@ -438,7 +447,8 @@ static struct hw_info *get_hwired(struct pcmcia_device *link)
return NULL; return NULL;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev->dev_addr[i] = hw_addr[i]; addr[i] = hw_addr[i];
eth_hw_addr_set(dev, addr);
return &default_info; return &default_info;
} /* get_hwired */ } /* get_hwired */
......
...@@ -104,8 +104,8 @@ STNIC_WRITE (int reg, byte val) ...@@ -104,8 +104,8 @@ STNIC_WRITE (int reg, byte val)
static int __init stnic_probe(void) static int __init stnic_probe(void)
{ {
struct net_device *dev; struct net_device *dev;
int i, err;
struct ei_device *ei_local; struct ei_device *ei_local;
int err;
/* If we are not running on a SolutionEngine, give up now */ /* If we are not running on a SolutionEngine, give up now */
if (! MACH_SE) if (! MACH_SE)
...@@ -119,8 +119,7 @@ static int __init stnic_probe(void) ...@@ -119,8 +119,7 @@ static int __init stnic_probe(void)
#ifdef CONFIG_SH_STANDARD_BIOS #ifdef CONFIG_SH_STANDARD_BIOS
sh_bios_get_node_addr (stnic_eadr); sh_bios_get_node_addr (stnic_eadr);
#endif #endif
for (i = 0; i < ETH_ALEN; i++) eth_hw_addr_set(dev, stnic_eadr);
dev->dev_addr[i] = stnic_eadr[i];
/* Set the base address to point to the NIC, not the "real" base! */ /* Set the base address to point to the NIC, not the "real" base! */
dev->base_addr = 0x1000; dev->base_addr = 0x1000;
......
...@@ -364,8 +364,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board, ...@@ -364,8 +364,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board,
if (i) if (i)
return i; return i;
for (i = 0; i < ETH_ALEN; i++) eth_hw_addr_set(dev, SA_prom);
dev->dev_addr[i] = SA_prom[i];
pr_debug("Found ethernet address: %pM\n", dev->dev_addr); pr_debug("Found ethernet address: %pM\n", dev->dev_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment