natsemi: macsonic: use eth_hw_addr_set()
authorJakub Kicinski <kuba@kernel.org>
Fri, 19 Nov 2021 07:10:33 +0000 (23:10 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Nov 2021 11:05:21 +0000 (11:05 +0000)
Byte by byte assignments.

Fixes build on m68k.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/natsemi/macsonic.c

index 8709d70..b16f7c8 100644 (file)
@@ -203,6 +203,7 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
        struct sonic_local *lp = netdev_priv(dev);
        const int prom_addr = ONBOARD_SONIC_PROM_BASE;
        unsigned short val;
+       u8 addr[ETH_ALEN];
 
        /*
         * On NuBus boards we can sometimes look in the ROM resources.
@@ -213,7 +214,8 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
                int i;
 
                for (i = 0; i < 6; i++)
-                       dev->dev_addr[i] = SONIC_READ_PROM(i);
+                       addr[i] = SONIC_READ_PROM(i);
+               eth_hw_addr_set(dev, addr);
                if (!INVALID_MAC(dev->dev_addr))
                        return;
 
@@ -222,7 +224,8 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
                 * source has a rather long and detailed historical account of
                 * why this is so.
                 */
-               bit_reverse_addr(dev->dev_addr);
+               bit_reverse_addr(addr);
+               eth_hw_addr_set(dev, addr);
                if (!INVALID_MAC(dev->dev_addr))
                        return;
 
@@ -243,14 +246,15 @@ static void mac_onboard_sonic_ethernet_addr(struct net_device *dev)
        SONIC_WRITE(SONIC_CEP, 15);
 
        val = SONIC_READ(SONIC_CAP2);
-       dev->dev_addr[5] = val >> 8;
-       dev->dev_addr[4] = val & 0xff;
+       addr[5] = val >> 8;
+       addr[4] = val & 0xff;
        val = SONIC_READ(SONIC_CAP1);
-       dev->dev_addr[3] = val >> 8;
-       dev->dev_addr[2] = val & 0xff;
+       addr[3] = val >> 8;
+       addr[2] = val & 0xff;
        val = SONIC_READ(SONIC_CAP0);
-       dev->dev_addr[1] = val >> 8;
-       dev->dev_addr[0] = val & 0xff;
+       addr[1] = val >> 8;
+       addr[0] = val & 0xff;
+       eth_hw_addr_set(dev, addr);
 
        if (!INVALID_MAC(dev->dev_addr))
                return;
@@ -355,13 +359,16 @@ static int mac_onboard_sonic_probe(struct net_device *dev)
 static int mac_sonic_nubus_ethernet_addr(struct net_device *dev,
                                         unsigned long prom_addr, int id)
 {
+       u8 addr[ETH_ALEN];
        int i;
+
        for(i = 0; i < 6; i++)
-               dev->dev_addr[i] = SONIC_READ_PROM(i);
+               addr[i] = SONIC_READ_PROM(i);
 
        /* Some of the addresses are bit-reversed */
        if (id != MACSONIC_DAYNA)
-               bit_reverse_addr(dev->dev_addr);
+               bit_reverse_addr(addr);
+       eth_hw_addr_set(dev, addr);
 
        return 0;
 }