mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
ethernet: Convert ETHER_ADDR_LEN uses to ETH_ALEN
Reduce the number of #defines, use the normal #define from if_ether.h Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6a3c910ca0
commit
104bf3fb96
16 changed files with 22 additions and 28 deletions
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
#define TX_PAGES 12 /* Two Tx slots */
|
#define TX_PAGES 12 /* Two Tx slots */
|
||||||
|
|
||||||
#define ETHER_ADDR_LEN 6
|
|
||||||
|
|
||||||
/* The 8390 specific per-packet-header format. */
|
/* The 8390 specific per-packet-header format. */
|
||||||
struct e8390_pkt_hdr {
|
struct e8390_pkt_hdr {
|
||||||
unsigned char status; /* status */
|
unsigned char status; /* status */
|
||||||
|
|
|
@ -318,7 +318,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 < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = SA_prom[i];
|
dev->dev_addr[i] = SA_prom[i];
|
||||||
|
|
||||||
printk(" %pM\n", dev->dev_addr);
|
printk(" %pM\n", dev->dev_addr);
|
||||||
|
|
|
@ -735,15 +735,14 @@ static int ax_init_dev(struct net_device *dev)
|
||||||
if (ax->plat->flags & AXFLG_MAC_FROMDEV) {
|
if (ax->plat->flags & AXFLG_MAC_FROMDEV) {
|
||||||
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 < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] =
|
dev->dev_addr[i] =
|
||||||
ei_inb(ioaddr + EN1_PHYS_SHIFT(i));
|
ei_inb(ioaddr + EN1_PHYS_SHIFT(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ax->plat->flags & AXFLG_MAC_FROMPLATFORM) &&
|
if ((ax->plat->flags & AXFLG_MAC_FROMPLATFORM) &&
|
||||||
ax->plat->mac_addr)
|
ax->plat->mac_addr)
|
||||||
memcpy(dev->dev_addr, ax->plat->mac_addr,
|
memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN);
|
||||||
ETHER_ADDR_LEN);
|
|
||||||
|
|
||||||
ax_reset_8390(dev);
|
ax_reset_8390(dev);
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ static int __init es_probe1(struct net_device *dev, int ioaddr)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ETHER_ADDR_LEN ; i++)
|
for (i = 0; i < ETH_ALEN ; i++)
|
||||||
dev->dev_addr[i] = inb(ioaddr + ES_SA_PROM + i);
|
dev->dev_addr[i] = inb(ioaddr + ES_SA_PROM + i);
|
||||||
|
|
||||||
/* Check the Racal vendor ID as well. */
|
/* Check the Racal vendor ID as well. */
|
||||||
|
|
|
@ -202,7 +202,7 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr)
|
||||||
/* Retrieve and checksum the station address. */
|
/* Retrieve and checksum the station address. */
|
||||||
outw(MAC_Page, ioaddr + HP_PAGING);
|
outw(MAC_Page, ioaddr + HP_PAGING);
|
||||||
|
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++) {
|
for(i = 0; i < ETH_ALEN; i++) {
|
||||||
unsigned char inval = inb(ioaddr + 8 + i);
|
unsigned char inval = inb(ioaddr + 8 + i);
|
||||||
dev->dev_addr[i] = inval;
|
dev->dev_addr[i] = inval;
|
||||||
checksum += inval;
|
checksum += inval;
|
||||||
|
|
|
@ -156,7 +156,7 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
|
||||||
|
|
||||||
printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);
|
printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);
|
||||||
|
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++)
|
for(i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = inb(ioaddr + i);
|
dev->dev_addr[i] = inb(ioaddr + i);
|
||||||
|
|
||||||
printk(" %pM", dev->dev_addr);
|
printk(" %pM", dev->dev_addr);
|
||||||
|
|
|
@ -129,7 +129,7 @@ static int __devinit hydra_init(struct zorro_dev *z)
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
for(j = 0; j < ETHER_ADDR_LEN; j++)
|
for (j = 0; j < ETH_ALEN; j++)
|
||||||
dev->dev_addr[j] = *((u8 *)(board + HYDRA_ADDRPROM + 2*j));
|
dev->dev_addr[j] = *((u8 *)(board + HYDRA_ADDRPROM + 2*j));
|
||||||
|
|
||||||
/* We must set the 8390 for word mode. */
|
/* We must set the 8390 for word mode. */
|
||||||
|
|
|
@ -191,14 +191,14 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
|
||||||
|| inb(ioaddr + LNE390_SA_PROM + 1) != LNE390_ADDR1
|
|| inb(ioaddr + LNE390_SA_PROM + 1) != LNE390_ADDR1
|
||||||
|| inb(ioaddr + LNE390_SA_PROM + 2) != LNE390_ADDR2 ) {
|
|| inb(ioaddr + LNE390_SA_PROM + 2) != LNE390_ADDR2 ) {
|
||||||
printk("lne390.c: card not found");
|
printk("lne390.c: card not found");
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
printk(" %02x", inb(ioaddr + LNE390_SA_PROM + i));
|
printk(" %02x", inb(ioaddr + LNE390_SA_PROM + i));
|
||||||
printk(" (invalid prefix).\n");
|
printk(" (invalid prefix).\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = inb(ioaddr + LNE390_SA_PROM + i);
|
dev->dev_addr[i] = inb(ioaddr + LNE390_SA_PROM + i);
|
||||||
printk("lne390.c: LNE390%X in EISA slot %d, address %pM.\n",
|
printk("lne390.c: LNE390%X in EISA slot %d, address %pM.\n",
|
||||||
0xa+revision, ioaddr/0x1000, dev->dev_addr);
|
0xa+revision, ioaddr/0x1000, dev->dev_addr);
|
||||||
|
|
|
@ -312,7 +312,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
|
||||||
|
|
||||||
dev->base_addr = ioaddr;
|
dev->base_addr = ioaddr;
|
||||||
|
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = SA_prom[i];
|
dev->dev_addr[i] = SA_prom[i];
|
||||||
printk(" %pM\n", dev->dev_addr);
|
printk(" %pM\n", dev->dev_addr);
|
||||||
|
|
||||||
|
|
|
@ -503,12 +503,12 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
|
||||||
#ifdef CONFIG_PLAT_MAPPI
|
#ifdef CONFIG_PLAT_MAPPI
|
||||||
outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
|
outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
|
||||||
ioaddr + E8390_CMD); /* 0x61 */
|
ioaddr + E8390_CMD); /* 0x61 */
|
||||||
for (i = 0 ; i < ETHER_ADDR_LEN ; i++) {
|
for (i = 0; i < ETH_ALEN; i++) {
|
||||||
dev->dev_addr[i] = SA_prom[i]
|
dev->dev_addr[i] = SA_prom[i]
|
||||||
= inb_p(ioaddr + EN1_PHYS_SHIFT(i));
|
= inb_p(ioaddr + EN1_PHYS_SHIFT(i));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++) {
|
for (i = 0; i < ETH_ALEN; i++) {
|
||||||
dev->dev_addr[i] = SA_prom[i];
|
dev->dev_addr[i] = SA_prom[i];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -460,7 +460,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
|
||||||
|
|
||||||
dev->base_addr = base_addr;
|
dev->base_addr = base_addr;
|
||||||
|
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = SA_prom[i];
|
dev->dev_addr[i] = SA_prom[i];
|
||||||
|
|
||||||
printk(" %pM\n", dev->dev_addr);
|
printk(" %pM\n", dev->dev_addr);
|
||||||
|
|
|
@ -125,7 +125,7 @@ static int __init ne3210_eisa_probe (struct device *device)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
port_index = inb(ioaddr + NE3210_CFG2) >> 6;
|
port_index = inb(ioaddr + NE3210_CFG2) >> 6;
|
||||||
for(i = 0; i < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = inb(ioaddr + NE3210_SA_PROM + i);
|
dev->dev_addr[i] = inb(ioaddr + NE3210_SA_PROM + i);
|
||||||
printk("ne3210.c: NE3210 in EISA slot %d, media: %s, addr: %pM.\n",
|
printk("ne3210.c: NE3210 in EISA slot %d, media: %s, addr: %pM.\n",
|
||||||
edev->slot, ifmap[port_index], dev->dev_addr);
|
edev->slot, ifmap[port_index], dev->dev_addr);
|
||||||
|
|
|
@ -114,7 +114,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 < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = stnic_eadr[i];
|
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! */
|
||||||
|
|
|
@ -365,7 +365,7 @@ static int __devinit zorro8390_init(struct net_device *dev,
|
||||||
if (i)
|
if (i)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
for (i = 0; i < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
dev->dev_addr[i] = SA_prom[i];
|
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);
|
||||||
|
|
|
@ -160,8 +160,6 @@ Include Files
|
||||||
Defines
|
Defines
|
||||||
---------------------------------------------------------------------------- */
|
---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#define ETHER_ADDR_LEN ETH_ALEN
|
|
||||||
/* 6 bytes in an Ethernet Address */
|
|
||||||
#define MACE_LADRF_LEN 8
|
#define MACE_LADRF_LEN 8
|
||||||
/* 8 bytes in Logical Address Filter */
|
/* 8 bytes in Logical Address Filter */
|
||||||
|
|
||||||
|
@ -600,7 +598,7 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Set PADR register */
|
/* Set PADR register */
|
||||||
for (i = 0; i < ETHER_ADDR_LEN; i++)
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
mace_write(lp, ioaddr, MACE_PADR, enet_addr[i]);
|
mace_write(lp, ioaddr, MACE_PADR, enet_addr[i]);
|
||||||
|
|
||||||
/* MAC Configuration Control Register should be written last */
|
/* MAC Configuration Control Register should be written last */
|
||||||
|
@ -639,11 +637,11 @@ static int nmclan_config(struct pcmcia_device *link)
|
||||||
|
|
||||||
/* Read the ethernet address from the CIS. */
|
/* Read the ethernet address from the CIS. */
|
||||||
len = pcmcia_get_tuple(link, 0x80, &buf);
|
len = pcmcia_get_tuple(link, 0x80, &buf);
|
||||||
if (!buf || len < ETHER_ADDR_LEN) {
|
if (!buf || len < ETH_ALEN) {
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
memcpy(dev->dev_addr, buf, ETHER_ADDR_LEN);
|
memcpy(dev->dev_addr, buf, ETH_ALEN);
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
|
|
||||||
/* Verify configuration by reading the MACE ID. */
|
/* Verify configuration by reading the MACE ID. */
|
||||||
|
@ -1421,7 +1419,7 @@ Output
|
||||||
static void set_multicast_list(struct net_device *dev)
|
static void set_multicast_list(struct net_device *dev)
|
||||||
{
|
{
|
||||||
mace_private *lp = netdev_priv(dev);
|
mace_private *lp = netdev_priv(dev);
|
||||||
int adr[ETHER_ADDR_LEN] = {0}; /* Ethernet address */
|
int adr[ETH_ALEN] = {0}; /* Ethernet address */
|
||||||
struct netdev_hw_addr *ha;
|
struct netdev_hw_addr *ha;
|
||||||
|
|
||||||
#ifdef PCMCIA_DEBUG
|
#ifdef PCMCIA_DEBUG
|
||||||
|
@ -1443,7 +1441,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||||
/* Calculate multicast logical address filter */
|
/* Calculate multicast logical address filter */
|
||||||
memset(lp->multicast_ladrf, 0, MACE_LADRF_LEN);
|
memset(lp->multicast_ladrf, 0, MACE_LADRF_LEN);
|
||||||
netdev_for_each_mc_addr(ha, dev) {
|
netdev_for_each_mc_addr(ha, dev) {
|
||||||
memcpy(adr, ha->addr, ETHER_ADDR_LEN);
|
memcpy(adr, ha->addr, ETH_ALEN);
|
||||||
BuildLAF(lp->multicast_ladrf, adr);
|
BuildLAF(lp->multicast_ladrf, adr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,6 @@ enum sbmac_state {
|
||||||
#define SBMAC_MAX_TXDESCR 256
|
#define SBMAC_MAX_TXDESCR 256
|
||||||
#define SBMAC_MAX_RXDESCR 256
|
#define SBMAC_MAX_RXDESCR 256
|
||||||
|
|
||||||
#define ETHER_ADDR_LEN 6
|
|
||||||
#define ENET_PACKET_SIZE 1518
|
#define ENET_PACKET_SIZE 1518
|
||||||
/*#define ENET_PACKET_SIZE 9216 */
|
/*#define ENET_PACKET_SIZE 9216 */
|
||||||
|
|
||||||
|
@ -266,7 +265,7 @@ struct sbmac_softc {
|
||||||
int sbm_pause; /* current pause setting */
|
int sbm_pause; /* current pause setting */
|
||||||
int sbm_link; /* current link state */
|
int sbm_link; /* current link state */
|
||||||
|
|
||||||
unsigned char sbm_hwaddr[ETHER_ADDR_LEN];
|
unsigned char sbm_hwaddr[ETH_ALEN];
|
||||||
|
|
||||||
struct sbmacdma sbm_txdma; /* only channel 0 for now */
|
struct sbmacdma sbm_txdma; /* only channel 0 for now */
|
||||||
struct sbmacdma sbm_rxdma;
|
struct sbmacdma sbm_rxdma;
|
||||||
|
|
Loading…
Reference in a new issue