Skip to content

Commit 8199d0c

Browse files
committed
Merge branch 'dev_addr-const-fixes'
Jakub Kicinski says: ==================== ethernet: fix some esoteric drivers after netdev->dev_addr constification Looking at recent fixes for drivers which don't get included with allmodconfig builds I thought it's worth grepping for more instances of: dev->dev_addr\[.*\] = This set contains the fixes. v2: add last 3 patches which fix drivers for the RiscPC ARM platform. Thanks to Arnd Bergmann for explaining how to build test that. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 429c3be + 8eb86fc commit 8199d0c

File tree

6 files changed

+33
-26
lines changed

6 files changed

+33
-26
lines changed

drivers/net/ethernet/3com/typhoon.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,6 +2278,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
22782278
struct net_device *dev;
22792279
struct typhoon *tp;
22802280
int card_id = (int) ent->driver_data;
2281+
u8 addr[ETH_ALEN] __aligned(4);
22812282
void __iomem *ioaddr;
22822283
void *shared;
22832284
dma_addr_t shared_dma;
@@ -2409,8 +2410,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
24092410
goto error_out_reset;
24102411
}
24112412

2412-
*(__be16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1));
2413-
*(__be32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2));
2413+
*(__be16 *)&addr[0] = htons(le16_to_cpu(xp_resp[0].parm1));
2414+
*(__be32 *)&addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2));
2415+
eth_hw_addr_set(dev, addr);
24142416

24152417
if (!is_valid_ether_addr(dev->dev_addr)) {
24162418
err_msg = "Could not obtain valid ethernet address, aborting";

drivers/net/ethernet/8390/etherh.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
655655
struct ei_device *ei_local;
656656
struct net_device *dev;
657657
struct etherh_priv *eh;
658+
u8 addr[ETH_ALEN];
658659
int ret;
659660

660661
ret = ecard_request_resources(ec);
@@ -724,12 +725,13 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
724725
spin_lock_init(&ei_local->page_lock);
725726

726727
if (ec->cid.product == PROD_ANT_ETHERM) {
727-
etherm_addr(dev->dev_addr);
728+
etherm_addr(addr);
728729
ei_local->reg_offset = etherm_regoffsets;
729730
} else {
730-
etherh_addr(dev->dev_addr, ec);
731+
etherh_addr(addr, ec);
731732
ei_local->reg_offset = etherh_regoffsets;
732733
}
734+
eth_hw_addr_set(dev, addr);
733735

734736
ei_local->name = dev->name;
735737
ei_local->word16 = 1;

drivers/net/ethernet/broadcom/sb1250-mac.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,9 +2183,7 @@ static int sbmac_init(struct platform_device *pldev, long long base)
21832183
ea_reg >>= 8;
21842184
}
21852185

2186-
for (i = 0; i < 6; i++) {
2187-
dev->dev_addr[i] = eaddr[i];
2188-
}
2186+
eth_hw_addr_set(dev, eaddr);
21892187

21902188
/*
21912189
* Initialize context (get pointers to registers and stuff), then

drivers/net/ethernet/i825xx/ether1.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,7 @@ static int
986986
ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
987987
{
988988
struct net_device *dev;
989+
u8 addr[ETH_ALEN];
989990
int i, ret = 0;
990991

991992
ether1_banner();
@@ -1015,7 +1016,8 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
10151016
}
10161017

10171018
for (i = 0; i < 6; i++)
1018-
dev->dev_addr[i] = readb(IDPROM_ADDRESS + (i << 2));
1019+
addr[i] = readb(IDPROM_ADDRESS + (i << 2));
1020+
eth_hw_addr_set(dev, addr);
10191021

10201022
if (ether1_init_2(dev)) {
10211023
ret = -ENODEV;

drivers/net/ethernet/seeq/ether3.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
749749
const struct ether3_data *data = id->data;
750750
struct net_device *dev;
751751
int bus_type, ret;
752+
u8 addr[ETH_ALEN];
752753

753754
ether3_banner();
754755

@@ -776,7 +777,8 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
776777
priv(dev)->seeq = priv(dev)->base + data->base_offset;
777778
dev->irq = ec->irq;
778779

779-
ether3_addr(dev->dev_addr, ec);
780+
ether3_addr(addr, ec);
781+
eth_hw_addr_set(dev, addr);
780782

781783
priv(dev)->dev = dev;
782784
timer_setup(&priv(dev)->timer, ether3_ledoff, 0);

drivers/net/ethernet/tundra/tsi108_eth.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,20 +1091,22 @@ static int tsi108_get_mac(struct net_device *dev)
10911091
struct tsi108_prv_data *data = netdev_priv(dev);
10921092
u32 word1 = TSI_READ(TSI108_MAC_ADDR1);
10931093
u32 word2 = TSI_READ(TSI108_MAC_ADDR2);
1094+
u8 addr[ETH_ALEN];
10941095

10951096
/* Note that the octets are reversed from what the manual says,
10961097
* producing an even weirder ordering...
10971098
*/
10981099
if (word2 == 0 && word1 == 0) {
1099-
dev->dev_addr[0] = 0x00;
1100-
dev->dev_addr[1] = 0x06;
1101-
dev->dev_addr[2] = 0xd2;
1102-
dev->dev_addr[3] = 0x00;
1103-
dev->dev_addr[4] = 0x00;
1100+
addr[0] = 0x00;
1101+
addr[1] = 0x06;
1102+
addr[2] = 0xd2;
1103+
addr[3] = 0x00;
1104+
addr[4] = 0x00;
11041105
if (0x8 == data->phy)
1105-
dev->dev_addr[5] = 0x01;
1106+
addr[5] = 0x01;
11061107
else
1107-
dev->dev_addr[5] = 0x02;
1108+
addr[5] = 0x02;
1109+
eth_hw_addr_set(dev, addr);
11081110

11091111
word2 = (dev->dev_addr[0] << 16) | (dev->dev_addr[1] << 24);
11101112

@@ -1114,12 +1116,13 @@ static int tsi108_get_mac(struct net_device *dev)
11141116
TSI_WRITE(TSI108_MAC_ADDR1, word1);
11151117
TSI_WRITE(TSI108_MAC_ADDR2, word2);
11161118
} else {
1117-
dev->dev_addr[0] = (word2 >> 16) & 0xff;
1118-
dev->dev_addr[1] = (word2 >> 24) & 0xff;
1119-
dev->dev_addr[2] = (word1 >> 0) & 0xff;
1120-
dev->dev_addr[3] = (word1 >> 8) & 0xff;
1121-
dev->dev_addr[4] = (word1 >> 16) & 0xff;
1122-
dev->dev_addr[5] = (word1 >> 24) & 0xff;
1119+
addr[0] = (word2 >> 16) & 0xff;
1120+
addr[1] = (word2 >> 24) & 0xff;
1121+
addr[2] = (word1 >> 0) & 0xff;
1122+
addr[3] = (word1 >> 8) & 0xff;
1123+
addr[4] = (word1 >> 16) & 0xff;
1124+
addr[5] = (word1 >> 24) & 0xff;
1125+
eth_hw_addr_set(dev, addr);
11231126
}
11241127

11251128
if (!is_valid_ether_addr(dev->dev_addr)) {
@@ -1136,14 +1139,12 @@ static int tsi108_set_mac(struct net_device *dev, void *addr)
11361139
{
11371140
struct tsi108_prv_data *data = netdev_priv(dev);
11381141
u32 word1, word2;
1139-
int i;
11401142

11411143
if (!is_valid_ether_addr(addr))
11421144
return -EADDRNOTAVAIL;
11431145

1144-
for (i = 0; i < 6; i++)
1145-
/* +2 is for the offset of the HW addr type */
1146-
dev->dev_addr[i] = ((unsigned char *)addr)[i + 2];
1146+
/* +2 is for the offset of the HW addr type */
1147+
eth_hw_addr_set(dev, ((unsigned char *)addr) + 2);
11471148

11481149
word2 = (dev->dev_addr[0] << 16) | (dev->dev_addr[1] << 24);
11491150

0 commit comments

Comments
 (0)