Commit 562ef98a authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

ethernet: replace netdev->dev_addr assignment loops



A handful of drivers contains loops assigning the mac
addr byte by byte. Convert those to eth_hw_addr_set().

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 68a06402
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -305,7 +305,6 @@ static int __init lance_probe( struct net_device *dev)
	unsigned long ioaddr;

	struct lance_private	*lp;
	int 			i;
	static int 		did_version;
	volatile unsigned short *ioaddr_probe;
	unsigned short tmp1, tmp2;
@@ -373,8 +372,7 @@ static int __init lance_probe( struct net_device *dev)
		   dev->irq);

	/* copy in the ethernet address from the prom */
	for(i = 0; i < 6 ; i++)
	     dev->dev_addr[i] = idprom->id_ethaddr[i];
	eth_hw_addr_set(dev, idprom->id_ethaddr);

	/* tell the card it's ether address, bytes swapped */
	MEM->init.hwaddr[0] = dev->dev_addr[1];
+1 −3
Original line number Diff line number Diff line
@@ -1301,7 +1301,6 @@ static int sparc_lance_probe_one(struct platform_device *op,
	struct device_node *dp = op->dev.of_node;
	struct lance_private *lp;
	struct net_device *dev;
	int    i;

	dev = alloc_etherdev(sizeof(struct lance_private) + 8);
	if (!dev)
@@ -1315,8 +1314,7 @@ static int sparc_lance_probe_one(struct platform_device *op,
	 * will copy the address in the device structure to the lance
	 * initialization block.
	 */
	for (i = 0; i < 6; i++)
		dev->dev_addr[i] = idprom->id_ethaddr[i];
	eth_hw_addr_set(dev, idprom->id_ethaddr);

	/* Get the IO region */
	lp->lregs = of_ioremap(&op->resource[0], 0,
+2 −5
Original line number Diff line number Diff line
@@ -521,17 +521,14 @@ static int bmac_resume(struct macio_dev *mdev)
static int bmac_set_address(struct net_device *dev, void *addr)
{
	struct bmac_data *bp = netdev_priv(dev);
	unsigned char *p = addr;
	const unsigned short *pWord16;
	unsigned long flags;
	int i;

	XXDEBUG(("bmac: enter set_address\n"));
	spin_lock_irqsave(&bp->lock, flags);

	for (i = 0; i < 6; ++i) {
		dev->dev_addr[i] = p[i];
	}
	eth_hw_addr_set(dev, addr);

	/* load up the hardware address */
	pWord16  = (const unsigned short *)dev->dev_addr;
	bmwrite(dev, MADD0, *pWord16++);
+1 −2
Original line number Diff line number Diff line
@@ -349,8 +349,7 @@ parse_eeprom (struct net_device *dev)
	}

	/* Set MAC address */
	for (i = 0; i < 6; i++)
		dev->dev_addr[i] = psrom->mac_addr[i];
	eth_hw_addr_set(dev, psrom->mac_addr);

	if (np->chip_id == CHIP_IP1000A) {
		np->led_mode = psrom->led_mode;
+2 −5
Original line number Diff line number Diff line
@@ -468,8 +468,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
		    goto failed;
	    }
	    /* Read MACID from CIS */
	    for (i = 0; i < 6; i++)
		    dev->dev_addr[i] = buf[i + 5];
	    eth_hw_addr_set(dev, &buf[5]);
	    kfree(buf);
	} else {
	    if (pcmcia_get_mac_from_cis(link, dev))
@@ -499,9 +498,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
	    pr_notice("unable to read hardware net address\n");
	    goto failed;
	}
	for (i = 0 ; i < 6; i++) {
	    dev->dev_addr[i] = buggybuf[i];
	}
	eth_hw_addr_set(dev, buggybuf);
	card_name = "FMV-J182";
	break;
    case MBH10302:
Loading