Commit 4b0dd004 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'dev_addr-conversions-part-1'



Jakub Kicinski says:

====================
ethernet: manual netdev->dev_addr conversions (part 1)

Manual conversions of drivers writing directly
to netdev->dev_addr (part 1 out of 3).
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a07a296b ec356ede
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -641,6 +641,7 @@ static int starfire_init_one(struct pci_dev *pdev,
	struct netdev_private *np;
	int i, irq, chip_idx = ent->driver_data;
	struct net_device *dev;
	u8 addr[ETH_ALEN];
	long ioaddr;
	void __iomem *base;
	int drv_flags, io_size;
@@ -696,7 +697,8 @@ static int starfire_init_one(struct pci_dev *pdev,

	/* Serial EEPROM reads are hidden by the hardware. */
	for (i = 0; i < 6; i++)
		dev->dev_addr[i] = readb(base + EEPROMCtrl + 20 - i);
		addr[i] = readb(base + EEPROMCtrl + 20 - i);
	eth_hw_addr_set(dev, addr);

#if ! defined(final_version) /* Dump the EEPROM contents during development. */
	if (debug > 4)
+3 −3
Original line number Diff line number Diff line
@@ -1346,6 +1346,7 @@ static int greth_of_probe(struct platform_device *ofdev)
	int i;
	int err;
	int tmp;
	u8 addr[ETH_ALEN];
	unsigned long timeout;

	dev = alloc_etherdev(sizeof(struct greth_private));
@@ -1449,8 +1450,6 @@ static int greth_of_probe(struct platform_device *ofdev)
			break;
	}
	if (i == 6) {
		u8 addr[ETH_ALEN];

		err = of_get_mac_address(ofdev->dev.of_node, addr);
		if (!err) {
			for (i = 0; i < 6; i++)
@@ -1464,7 +1463,8 @@ static int greth_of_probe(struct platform_device *ofdev)
	}

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

	macaddr[5]++;

+8 −6
Original line number Diff line number Diff line
@@ -869,6 +869,7 @@ static int ace_init(struct net_device *dev)
	int board_idx, ecode = 0;
	short i;
	unsigned char cache_size;
	u8 addr[ETH_ALEN];

	ap = netdev_priv(dev);
	regs = ap->regs;
@@ -988,12 +989,13 @@ static int ace_init(struct net_device *dev)
	writel(mac1, &regs->MacAddrHi);
	writel(mac2, &regs->MacAddrLo);

	dev->dev_addr[0] = (mac1 >> 8) & 0xff;
	dev->dev_addr[1] = mac1 & 0xff;
	dev->dev_addr[2] = (mac2 >> 24) & 0xff;
	dev->dev_addr[3] = (mac2 >> 16) & 0xff;
	dev->dev_addr[4] = (mac2 >> 8) & 0xff;
	dev->dev_addr[5] = mac2 & 0xff;
	addr[0] = (mac1 >> 8) & 0xff;
	addr[1] = mac1 & 0xff;
	addr[2] = (mac2 >> 24) & 0xff;
	addr[3] = (mac2 >> 16) & 0xff;
	addr[4] = (mac2 >> 8) & 0xff;
	addr[5] = mac2 & 0xff;
	eth_hw_addr_set(dev, addr);

	printk("MAC: %pM\n", dev->dev_addr);

+3 −1
Original line number Diff line number Diff line
@@ -1743,6 +1743,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev,
	unsigned long reg_addr, reg_len;
	struct amd8111e_priv *lp;
	struct net_device *dev;
	u8 addr[ETH_ALEN];

	err = pci_enable_device(pdev);
	if (err) {
@@ -1809,7 +1810,8 @@ static int amd8111e_probe_one(struct pci_dev *pdev,

	/* Initializing MAC address */
	for (i = 0; i < ETH_ALEN; i++)
		dev->dev_addr[i] = readb(lp->mmio + PADR + i);
		addr[i] = readb(lp->mmio + PADR + i);
	eth_hw_addr_set(dev, addr);

	/* Setting user defined parametrs */
	lp->ext_phy_option = speed_duplex[card_idx];
+9 −4
Original line number Diff line number Diff line
@@ -1595,6 +1595,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
	struct net_device *dev;
	const struct pcnet32_access *a = NULL;
	u8 promaddr[ETH_ALEN];
	u8 addr[ETH_ALEN];
	int ret = -ENODEV;

	/* reset the chip */
@@ -1760,9 +1761,10 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
		unsigned int val;
		val = a->read_csr(ioaddr, i + 12) & 0x0ffff;
		/* There may be endianness issues here. */
		dev->dev_addr[2 * i] = val & 0x0ff;
		dev->dev_addr[2 * i + 1] = (val >> 8) & 0x0ff;
		addr[2 * i] = val & 0x0ff;
		addr[2 * i + 1] = (val >> 8) & 0x0ff;
	}
	eth_hw_addr_set(dev, addr);

	/* read PROM address and compare with CSR address */
	for (i = 0; i < ETH_ALEN; i++)
@@ -1780,8 +1782,11 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
	}

	/* if the ethernet address is not valid, force to 00:00:00:00:00:00 */
	if (!is_valid_ether_addr(dev->dev_addr))
		eth_zero_addr(dev->dev_addr);
	if (!is_valid_ether_addr(dev->dev_addr)) {
		static const u8 zero_addr[ETH_ALEN] = {};

		eth_hw_addr_set(dev, zero_addr);
	}

	if (pcnet32_debug & NETIF_MSG_PROBE) {
		pr_cont(" %pM", dev->dev_addr);
Loading