ethernet: use eth_hw_addr_set() in unmaintained drivers
authorJakub Kicinski <kuba@kernel.org>
Fri, 15 Oct 2021 21:53:04 +0000 (14:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Oct 2021 12:20:38 +0000 (13:20 +0100)
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>
21 files changed:
drivers/net/ethernet/calxeda/xgmac.c
drivers/net/ethernet/cirrus/cs89x0.c
drivers/net/ethernet/davicom/dm9000.c
drivers/net/ethernet/ethoc.c
drivers/net/ethernet/fealnx.c
drivers/net/ethernet/fujitsu/fmvj18x_cs.c
drivers/net/ethernet/huawei/hinic/hinic_main.c
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/micrel/ks8842.c
drivers/net/ethernet/micrel/ks8851_common.c
drivers/net/ethernet/micrel/ksz884x.c
drivers/net/ethernet/microchip/encx24j600.c
drivers/net/ethernet/natsemi/natsemi.c
drivers/net/ethernet/natsemi/ns83820.c
drivers/net/ethernet/packetengines/hamachi.c
drivers/net/ethernet/packetengines/yellowfin.c
drivers/net/ethernet/silan/sc92031.c
drivers/net/ethernet/smsc/smc91c92_cs.c
drivers/net/ethernet/sun/sunvnet.c
drivers/net/ethernet/toshiba/tc35815.c
drivers/net/ethernet/xircom/xirc2ps_cs.c

index 9ad89a53c3e64bab39a5912ccb70c41ba0ea434f..457cb71210003ee617796c827cb648ca0bd9eb7d 100644 (file)
@@ -1693,6 +1693,7 @@ static int xgmac_probe(struct platform_device *pdev)
        struct resource *res;
        struct net_device *ndev = NULL;
        struct xgmac_priv *priv = NULL;
+       u8 addr[ETH_ALEN];
        u32 uid;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1785,7 +1786,8 @@ static int xgmac_probe(struct platform_device *pdev)
        ndev->max_mtu = XGMAC_MAX_MTU;
 
        /* Get the MAC address */
-       xgmac_get_mac_addr(priv->base, ndev->dev_addr, 0);
+       xgmac_get_mac_addr(priv->base, addr, 0);
+       eth_hw_addr_set(ndev, addr);
        if (!is_valid_ether_addr(ndev->dev_addr))
                netdev_warn(ndev, "MAC address %pM not valid",
                         ndev->dev_addr);
index bd7920ab166f45861273282cef2336245da91887..4a97aa8e1387d262ad96309e4f298a5562e3d8fa 100644 (file)
@@ -1314,6 +1314,7 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular)
        int tmp;
        unsigned rev_type = 0;
        int eeprom_buff[CHKSUM_LEN];
+       u8 addr[ETH_ALEN];
        int retval;
 
        /* Initialize the device structure. */
@@ -1387,9 +1388,10 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular)
                for (i = 0; i < ETH_ALEN / 2; i++) {
                        unsigned int Addr;
                        Addr = readreg(dev, PP_IA + i * 2);
-                       dev->dev_addr[i * 2] = Addr & 0xFF;
-                       dev->dev_addr[i * 2 + 1] = Addr >> 8;
+                       addr[i * 2] = Addr & 0xFF;
+                       addr[i * 2 + 1] = Addr >> 8;
                }
+               eth_hw_addr_set(dev, addr);
 
                /* Load the Adapter Configuration.
                 * Note:  Barring any more specific information from some
@@ -1464,9 +1466,10 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular)
                /* eeprom_buff has 32-bit ints, so we can't just memcpy it */
                /* store the initial memory base address */
                for (i = 0; i < ETH_ALEN / 2; i++) {
-                       dev->dev_addr[i * 2] = eeprom_buff[i];
-                       dev->dev_addr[i * 2 + 1] = eeprom_buff[i] >> 8;
+                       addr[i * 2] = eeprom_buff[i];
+                       addr[i * 2 + 1] = eeprom_buff[i] >> 8;
                }
+               eth_hw_addr_set(dev, addr);
                cs89_dbg(1, debug, "%s: new adapter_cnf: 0x%x\n",
                         dev->name, lp->adapter_cnf);
        }
index e13dd53a8b3b26f825a5d6b0ee76ce4eb128087c..0985ab216566b10cea9275ebf0bb45c485d49f0a 100644 (file)
@@ -1425,6 +1425,7 @@ dm9000_probe(struct platform_device *pdev)
        enum of_gpio_flags flags;
        struct regulator *power;
        bool inv_mac_addr = false;
+       u8 addr[ETH_ALEN];
 
        power = devm_regulator_get(dev, "vcc");
        if (IS_ERR(power)) {
@@ -1666,7 +1667,8 @@ dm9000_probe(struct platform_device *pdev)
 
        /* try reading the node address from the attached EEPROM */
        for (i = 0; i < 6; i += 2)
-               dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i);
+               dm9000_read_eeprom(db, i / 2, addr + i);
+       eth_hw_addr_set(ndev, addr);
 
        if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
                mac_src = "platform data";
@@ -1678,7 +1680,8 @@ dm9000_probe(struct platform_device *pdev)
 
                mac_src = "chip";
                for (i = 0; i < 6; i++)
-                       ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
+                       addr[i] = ior(db, i + DM9000_PAR);
+               eth_hw_addr_set(ndev, pdata->dev_addr);
        }
 
        if (!is_valid_ether_addr(ndev->dev_addr)) {
index ed2ef167cdb2c20eb3281c44cc3a3958593f7c32..b1c8ffea6ad299f8a7d09a2e3b6a126d400fc5bd 100644 (file)
@@ -1154,8 +1154,12 @@ static int ethoc_probe(struct platform_device *pdev)
        /* Check that the given MAC address is valid. If it isn't, read the
         * current MAC from the controller.
         */
-       if (!is_valid_ether_addr(netdev->dev_addr))
-               ethoc_get_mac_address(netdev, netdev->dev_addr);
+       if (!is_valid_ether_addr(netdev->dev_addr)) {
+               u8 addr[ETH_ALEN];
+
+               ethoc_get_mac_address(netdev, addr);
+               eth_hw_addr_set(netdev, addr);
+       }
 
        /* Check the MAC again for validity, if it still isn't choose and
         * program a random one.
index ab194c9b0691e3fe6a5348932e4ecba03e0a3dd6..b3939a5f7b03320df1a821b741725553e9295a39 100644 (file)
@@ -482,6 +482,7 @@ static int fealnx_init_one(struct pci_dev *pdev,
        struct net_device *dev;
        void *ring_space;
        dma_addr_t ring_dma;
+       u8 addr[ETH_ALEN];
 #ifdef USE_IO_OPS
        int bar = 0;
 #else
@@ -525,7 +526,8 @@ static int fealnx_init_one(struct pci_dev *pdev,
 
        /* read ethernet id */
        for (i = 0; i < 6; ++i)
-               dev->dev_addr[i] = ioread8(ioaddr + PAR0 + i);
+               addr[i] = ioread8(ioaddr + PAR0 + i);
+       eth_hw_addr_set(dev, addr);
 
        /* Reset the chip to erase previous misconfiguration. */
        iowrite32(0x00000001, ioaddr + BCR);
index 62600153b96493251e7f1a0a4068777ab4cb50b5..b0d733e9a7c66a58a38ff3976701a4a62a456ea2 100644 (file)
@@ -334,6 +334,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
     u8 *buf;
     size_t len;
     u_char buggybuf[32];
+    u8 addr[ETH_ALEN];
 
     dev_dbg(&link->dev, "fmvj18x_config\n");
 
@@ -489,7 +490,8 @@ static int fmvj18x_config(struct pcmcia_device *link)
     case UNGERMANN:
        /* Read MACID from register */
        for (i = 0; i < 6; i++) 
-           dev->dev_addr[i] = inb(ioaddr + UNGERMANN_MAC_ID + i);
+           addr[i] = inb(ioaddr + UNGERMANN_MAC_ID + i);
+       eth_hw_addr_set(dev, addr);
        card_name = "Access/CARD";
        break;
     case XXX10304:
@@ -505,7 +507,8 @@ static int fmvj18x_config(struct pcmcia_device *link)
     default:
        /* Read MACID from register */
        for (i = 0; i < 6; i++) 
-           dev->dev_addr[i] = inb(ioaddr + MAC_ID + i);
+           addr[i] = inb(ioaddr + MAC_ID + i);
+       eth_hw_addr_set(dev, addr);
        card_name = "FMV-J181";
        break;
     }
index 6414e922cf8c209b4eff81b9df641727f8b741aa..f9a766b8ac43486df47595548145efd6de635ae6 100644 (file)
@@ -1181,6 +1181,7 @@ static int nic_dev_init(struct pci_dev *pdev)
        struct net_device *netdev;
        struct hinic_hwdev *hwdev;
        struct devlink *devlink;
+       u8 addr[ETH_ALEN];
        int err, num_qps;
 
        devlink = hinic_devlink_alloc(&pdev->dev);
@@ -1259,11 +1260,12 @@ static int nic_dev_init(struct pci_dev *pdev)
 
        pci_set_drvdata(pdev, netdev);
 
-       err = hinic_port_get_mac(nic_dev, netdev->dev_addr);
+       err = hinic_port_get_mac(nic_dev, addr);
        if (err) {
                dev_err(&pdev->dev, "Failed to get mac address\n");
                goto err_get_mac;
        }
+       eth_hw_addr_set(netdev, addr);
 
        if (!is_valid_ether_addr(netdev->dev_addr)) {
                if (!HINIC_IS_VF(nic_dev->hwdev->hwif)) {
index bb5341020803cb9153194f6f215e707ad46a53cb..6c02e1740609d8f1b412eeb2b5936a7a8a991394 100644 (file)
@@ -1436,9 +1436,13 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
        err = of_get_ethdev_address(pdev->dev.of_node, dev);
        if (err) {
+               u8 addr[ETH_ALEN];
+
                /* try reading the mac address, if set by the bootloader */
-               pxa168_eth_get_mac_address(dev, dev->dev_addr);
-               if (!is_valid_ether_addr(dev->dev_addr)) {
+               pxa168_eth_get_mac_address(dev, addr);
+               if (is_valid_ether_addr(addr)) {
+                       eth_hw_addr_set(dev, addr);
+               } else {
                        dev_info(&pdev->dev, "Using random mac address\n");
                        eth_hw_addr_random(dev);
                }
index 0f2cdcd4a4c0eeec84fa2c651bb6c486eb1db4e1..c11b118dc4158dc3eaad2fb73d89e36bb830099f 100644 (file)
@@ -348,13 +348,15 @@ static void ks8842_reset_hw(struct ks8842_adapter *adapter)
        ks8842_write16(adapter, 32, 0x1, REG_SW_ID_AND_ENABLE);
 }
 
-static void ks8842_read_mac_addr(struct ks8842_adapter *adapter, u8 *dest)
+static void ks8842_init_mac_addr(struct ks8842_adapter *adapter)
 {
+       u8 addr[ETH_ALEN];
        int i;
        u16 mac;
 
        for (i = 0; i < ETH_ALEN; i++)
-               dest[ETH_ALEN - i - 1] = ks8842_read8(adapter, 2, REG_MARL + i);
+               addr[ETH_ALEN - i - 1] = ks8842_read8(adapter, 2, REG_MARL + i);
+       eth_hw_addr_set(adapter->netdev, addr);
 
        if (adapter->conf_flags & MICREL_KS884X) {
                /*
@@ -1195,7 +1197,7 @@ static int ks8842_probe(struct platform_device *pdev)
        }
 
        if (i == netdev->addr_len) {
-               ks8842_read_mac_addr(adapter, netdev->dev_addr);
+               ks8842_init_mac_addr(adapter);
 
                if (!is_valid_ether_addr(netdev->dev_addr))
                        eth_hw_addr_random(netdev);
index 499258b8662a52505459d2f3a1df335584320e04..691206f19ea7bc43df299a8a6409ab9c5bcbd37f 100644 (file)
@@ -165,6 +165,7 @@ static void ks8851_read_mac_addr(struct net_device *dev)
 {
        struct ks8851_net *ks = netdev_priv(dev);
        unsigned long flags;
+       u8 addr[ETH_ALEN];
        u16 reg;
        int i;
 
@@ -172,9 +173,10 @@ static void ks8851_read_mac_addr(struct net_device *dev)
 
        for (i = 0; i < ETH_ALEN; i += 2) {
                reg = ks8851_rdreg16(ks, KS_MAR(i));
-               dev->dev_addr[i] = reg >> 8;
-               dev->dev_addr[i + 1] = reg & 0xff;
+               addr[i] = reg >> 8;
+               addr[i + 1] = reg & 0xff;
        }
+       eth_hw_addr_set(dev, addr);
 
        ks8851_unlock(ks, &flags);
 }
index 03ad8bdc1f0d501551785bba864ecee3851a5475..99c0c1491af20ab18da6d1d43c8b6fd1b50448cc 100644 (file)
@@ -7007,9 +7007,12 @@ static int pcidev_init(struct pci_dev *pdev, const struct pci_device_id *id)
                if (MAIN_PORT == i)
                        eth_hw_addr_set(dev, hw_priv->hw.override_addr);
                else {
-                       eth_hw_addr_set(dev, sw->other_addr);
+                       u8 addr[ETH_ALEN];
+
+                       ether_addr_copy(addr, sw->other_addr);
                        if (ether_addr_equal(sw->other_addr, hw->override_addr))
-                               dev->dev_addr[5] += port->first_port;
+                               addr[5] += port->first_port;
+                       eth_hw_addr_set(dev, addr);
                }
 
                dev->netdev_ops = &netdev_ops;
index 79167c3a31794445b1d7c72cfe51dbe430a2f86b..b90efc80fb59fa6f6b1e3b1a193d666976fd6e98 100644 (file)
@@ -1001,6 +1001,7 @@ static int encx24j600_spi_probe(struct spi_device *spi)
        struct net_device *ndev;
        struct encx24j600_priv *priv;
        u16 eidled;
+       u8 addr[ETH_ALEN];
 
        ndev = alloc_etherdev(sizeof(struct encx24j600_priv));
 
@@ -1056,7 +1057,8 @@ static int encx24j600_spi_probe(struct spi_device *spi)
        }
 
        /* Get the MAC address from the chip */
-       encx24j600_hw_get_macaddr(priv, ndev->dev_addr);
+       encx24j600_hw_get_macaddr(priv, addr);
+       eth_hw_addr_set(ndev, addr);
 
        ndev->ethtool_ops = &encx24j600_ethtool_ops;
 
index 3f982033944bc6cb1a34bca5b8e28138b0a03568..82a22711ce45898372b24ed539d15c96a6c15d9c 100644 (file)
@@ -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;
index 72794d15887118cd8c3fc1d36d0aefe1bcf2799a..49ea130c906712ccb4c842ed8bb8945247ffaab7 100644 (file)
@@ -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;
index 1a6336a56d3da9e47157e12e046f8d54b4a0a4b9..9c408328be0db40ea4c925f9db7c0479b0d7dcf7 100644 (file)
@@ -592,6 +592,7 @@ static int hamachi_init_one(struct pci_dev *pdev,
        void *ring_space;
        dma_addr_t ring_dma;
        int ret = -ENOMEM;
+       u8 addr[ETH_ALEN];
 
 /* when built into the kernel, we only print version if device is found */
 #ifndef MODULE
@@ -628,8 +629,8 @@ static int hamachi_init_one(struct pci_dev *pdev,
        SET_NETDEV_DEV(dev, &pdev->dev);
 
        for (i = 0; i < 6; i++)
-               dev->dev_addr[i] = 1 ? read_eeprom(ioaddr, 4 + i)
-                       : readb(ioaddr + StationAddr + i);
+               addr[i] = read_eeprom(ioaddr, 4 + i);
+       eth_hw_addr_set(dev, addr);
 
 #if ! defined(final_version)
        if (hamachi_debug > 4)
index f5cd8f51be7c460083f691cebaa569094a25cf57..12105f62cbddb75aeb245ca26b327c613164de25 100644 (file)
@@ -384,6 +384,7 @@ static int yellowfin_init_one(struct pci_dev *pdev,
 #else
        int bar = 1;
 #endif
+       u8 addr[ETH_ALEN];
 
 /* when built into the kernel, we only print version if device is found */
 #ifndef MODULE
@@ -416,12 +417,13 @@ static int yellowfin_init_one(struct pci_dev *pdev,
 
        if (drv_flags & DontUseEeprom)
                for (i = 0; i < 6; i++)
-                       dev->dev_addr[i] = ioread8(ioaddr + StnAddr + i);
+                       addr[i] = ioread8(ioaddr + StnAddr + i);
        else {
                int ee_offset = (read_eeprom(ioaddr, 6) == 0xff ? 0x100 : 0);
                for (i = 0; i < 6; i++)
-                       dev->dev_addr[i] = read_eeprom(ioaddr, ee_offset + i);
+                       addr[i] = read_eeprom(ioaddr, ee_offset + i);
        }
+       eth_hw_addr_set(dev, addr);
 
        /* Reset the chip. */
        iowrite32(0x80000000, ioaddr + DMACtrl);
index 1fd08a04bd4ec129ef07633d19c4320e0d4b4fdf..ff4197f5e46dd2a024003b8302ec1c6efff29296 100644 (file)
@@ -1400,6 +1400,7 @@ static int sc92031_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        void __iomem* port_base;
        struct net_device *dev;
        struct sc92031_priv *priv;
+       u8 addr[ETH_ALEN];
        u32 mac0, mac1;
 
        err = pci_enable_device(pdev);
@@ -1458,12 +1459,13 @@ static int sc92031_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        mac0 = ioread32(port_base + MAC0);
        mac1 = ioread32(port_base + MAC0 + 4);
-       dev->dev_addr[0] = mac0 >> 24;
-       dev->dev_addr[1] = mac0 >> 16;
-       dev->dev_addr[2] = mac0 >> 8;
-       dev->dev_addr[3] = mac0;
-       dev->dev_addr[4] = mac1 >> 8;
-       dev->dev_addr[5] = mac1;
+       addr[0] = mac0 >> 24;
+       addr[1] = mac0 >> 16;
+       addr[2] = mac0 >> 8;
+       addr[3] = mac0;
+       addr[4] = mac1 >> 8;
+       addr[5] = mac1;
+       eth_hw_addr_set(dev, addr);
 
        err = register_netdev(dev);
        if (err < 0)
index e5658aa39765baa1e8111863fd288f4ed17404f2..37c822e27207a000e81e5ae9c6349a4bdaa78b77 100644 (file)
@@ -347,6 +347,7 @@ static void smc91c92_detach(struct pcmcia_device *link)
 
 static int cvt_ascii_address(struct net_device *dev, char *s)
 {
+    u8 mac[ETH_ALEN];
     int i, j, da, c;
 
     if (strlen(s) != 12)
@@ -359,8 +360,9 @@ static int cvt_ascii_address(struct net_device *dev, char *s)
            da += ((c >= '0') && (c <= '9')) ?
                (c - '0') : ((c & 0x0f) + 9);
        }
-       dev->dev_addr[i] = da;
+       mac[i] = da;
     }
+    eth_hw_addr_set(dev, mac);
     return 0;
 }
 
@@ -539,6 +541,7 @@ static int mot_setup(struct pcmcia_device *link)
     struct net_device *dev = link->priv;
     unsigned int ioaddr = dev->base_addr;
     int i, wait, loop;
+    u8 mac[ETH_ALEN];
     u_int addr;
 
     /* Read Ethernet address from Serial EEPROM */
@@ -559,9 +562,10 @@ static int mot_setup(struct pcmcia_device *link)
            return -1;
        
        addr = inw(ioaddr + GENERAL);
-       dev->dev_addr[2*i]   = addr & 0xff;
-       dev->dev_addr[2*i+1] = (addr >> 8) & 0xff;
+       mac[2*i]   = addr & 0xff;
+       mac[2*i+1] = (addr >> 8) & 0xff;
     }
+    eth_hw_addr_set(dev, mac);
 
     return 0;
 }
index 58ee89223951e1e6884cc3e8236f87a02ce0f16d..da8119625cf33484812053033f2b16e8977e5f7e 100644 (file)
@@ -285,6 +285,7 @@ static struct vnet *vnet_new(const u64 *local_mac,
                             struct vio_dev *vdev)
 {
        struct net_device *dev;
+       u8 addr[ETH_ALEN];
        struct vnet *vp;
        int err, i;
 
@@ -295,7 +296,8 @@ static struct vnet *vnet_new(const u64 *local_mac,
        dev->needed_tailroom = 8;
 
        for (i = 0; i < ETH_ALEN; i++)
-               dev->dev_addr[i] = (*local_mac >> (5 - i) * 8) & 0xff;
+               addr[i] = (*local_mac >> (5 - i) * 8) & 0xff;
+       eth_hw_addr_set(dev, addr);
 
        vp = netdev_priv(dev);
 
index f8b9d10dc05621f33274bab7298e56ab92f3eeae..ce38f751522545d0cb4b28512c8fb62f0abae59f 100644 (file)
@@ -725,6 +725,7 @@ static int tc35815_init_dev_addr(struct net_device *dev)
 {
        struct tc35815_regs __iomem *tr =
                (struct tc35815_regs __iomem *)dev->base_addr;
+       u8 addr[ETH_ALEN];
        int i;
 
        while (tc_readl(&tr->PROM_Ctl) & PROM_Busy)
@@ -735,9 +736,10 @@ static int tc35815_init_dev_addr(struct net_device *dev)
                while (tc_readl(&tr->PROM_Ctl) & PROM_Busy)
                        ;
                data = tc_readl(&tr->PROM_Data);
-               dev->dev_addr[i] = data & 0xff;
-               dev->dev_addr[i+1] = data >> 8;
+               addr[i] = data & 0xff;
+               addr[i+1] = data >> 8;
        }
+       eth_hw_addr_set(dev, addr);
        if (!is_valid_ether_addr(dev->dev_addr))
                return tc35815_read_plat_dev_addr(dev);
        return 0;
index ab513dcc3b2254e1f5fb1c1e29ada4750d4a7495..f9587e55b842831a1e820392e6f2930ffe2cf22e 100644 (file)
@@ -671,7 +671,6 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev,
                             void *priv)
 {
        struct net_device *dev = priv;
-       int i;
 
        if (tuple->TupleDataLen != 13)
                return -EINVAL;
@@ -679,8 +678,7 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev,
                (tuple->TupleData[2] != 6))
                return -EINVAL;
        /* another try  (James Lehmer's CE2 version 4.1)*/
-       for (i = 2; i < 6; i++)
-               dev->dev_addr[i] = tuple->TupleData[i+2];
+       dev_addr_mod(dev, 2, &tuple->TupleData[2], 4);
        return 0;
 };
 
@@ -742,11 +740,9 @@ xirc2ps_config(struct pcmcia_device * link)
            len = pcmcia_get_tuple(link, 0x89, &buf);
            /* data layout looks like tuple 0x22 */
            if (buf && len == 8) {
-                   if (*buf == CISTPL_FUNCE_LAN_NODE_ID) {
-                           int i;
-                           for (i = 2; i < 6; i++)
-                                   dev->dev_addr[i] = buf[i+2];
-                   } else
+                   if (*buf == CISTPL_FUNCE_LAN_NODE_ID)
+                           dev_addr_mod(dev, 2, &buf[2], 4);
+                   else
                            err = -1;
            }
            kfree(buf);