amd: a2065/ariadne: use eth_hw_addr_set()
authorJakub Kicinski <kuba@kernel.org>
Fri, 19 Nov 2021 07:10:21 +0000 (23:10 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Nov 2021 11:05:20 +0000 (11:05 +0000)
dev_addr is initialized byte by byte from series.

Fixes build on x86 (32bit).

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

index 2f808db..3a351d3 100644 (file)
@@ -680,6 +680,7 @@ static int a2065_init_one(struct zorro_dev *z,
        unsigned long base_addr = board + A2065_LANCE;
        unsigned long mem_start = board + A2065_RAM;
        struct resource *r1, *r2;
+       u8 addr[ETH_ALEN];
        u32 serial;
        int err;
 
@@ -706,17 +707,18 @@ static int a2065_init_one(struct zorro_dev *z,
        r2->name = dev->name;
 
        serial = be32_to_cpu(z->rom.er_SerialNumber);
-       dev->dev_addr[0] = 0x00;
+       addr[0] = 0x00;
        if (z->id != ZORRO_PROD_AMERISTAR_A2065) {      /* Commodore */
-               dev->dev_addr[1] = 0x80;
-               dev->dev_addr[2] = 0x10;
+               addr[1] = 0x80;
+               addr[2] = 0x10;
        } else {                                        /* Ameristar */
-               dev->dev_addr[1] = 0x00;
-               dev->dev_addr[2] = 0x9f;
+               addr[1] = 0x00;
+               addr[2] = 0x9f;
        }
-       dev->dev_addr[3] = (serial >> 16) & 0xff;
-       dev->dev_addr[4] = (serial >> 8) & 0xff;
-       dev->dev_addr[5] = serial & 0xff;
+       addr[3] = (serial >> 16) & 0xff;
+       addr[4] = (serial >> 8) & 0xff;
+       addr[5] = serial & 0xff;
+       eth_hw_addr_set(dev, addr);
        dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
        dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
        dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
index 5e0f645..4ea7b9f 100644 (file)
@@ -441,11 +441,11 @@ static int ariadne_open(struct net_device *dev)
 
        /* Set the Ethernet Hardware Address */
        lance->RAP = CSR12;             /* Physical Address Register, PADR[15:0] */
-       lance->RDP = ((u_short *)&dev->dev_addr[0])[0];
+       lance->RDP = ((const u_short *)&dev->dev_addr[0])[0];
        lance->RAP = CSR13;             /* Physical Address Register, PADR[31:16] */
-       lance->RDP = ((u_short *)&dev->dev_addr[0])[1];
+       lance->RDP = ((const u_short *)&dev->dev_addr[0])[1];
        lance->RAP = CSR14;             /* Physical Address Register, PADR[47:32] */
-       lance->RDP = ((u_short *)&dev->dev_addr[0])[2];
+       lance->RDP = ((const u_short *)&dev->dev_addr[0])[2];
 
        /* Set the Init Block Mode */
        lance->RAP = CSR15;             /* Mode Register */
@@ -717,6 +717,7 @@ static int ariadne_init_one(struct zorro_dev *z,
        unsigned long mem_start = board + ARIADNE_RAM;
        struct resource *r1, *r2;
        struct net_device *dev;
+       u8 addr[ETH_ALEN];
        u32 serial;
        int err;
 
@@ -740,12 +741,13 @@ static int ariadne_init_one(struct zorro_dev *z,
        r2->name = dev->name;
 
        serial = be32_to_cpu(z->rom.er_SerialNumber);
-       dev->dev_addr[0] = 0x00;
-       dev->dev_addr[1] = 0x60;
-       dev->dev_addr[2] = 0x30;
-       dev->dev_addr[3] = (serial >> 16) & 0xff;
-       dev->dev_addr[4] = (serial >> 8) & 0xff;
-       dev->dev_addr[5] = serial & 0xff;
+       addr[0] = 0x00;
+       addr[1] = 0x60;
+       addr[2] = 0x30;
+       addr[3] = (serial >> 16) & 0xff;
+       addr[4] = (serial >> 8) & 0xff;
+       addr[5] = serial & 0xff;
+       eth_hw_addr_set(dev, addr);
        dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
        dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
        dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE;