mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 02:23:16 +00:00
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 <davem@davemloft.net>
This commit is contained in:
commit
8199d0c6ad
@ -2278,6 +2278,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
struct net_device *dev;
|
||||
struct typhoon *tp;
|
||||
int card_id = (int) ent->driver_data;
|
||||
u8 addr[ETH_ALEN] __aligned(4);
|
||||
void __iomem *ioaddr;
|
||||
void *shared;
|
||||
dma_addr_t shared_dma;
|
||||
@ -2409,8 +2410,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
goto error_out_reset;
|
||||
}
|
||||
|
||||
*(__be16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1));
|
||||
*(__be32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2));
|
||||
*(__be16 *)&addr[0] = htons(le16_to_cpu(xp_resp[0].parm1));
|
||||
*(__be32 *)&addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2));
|
||||
eth_hw_addr_set(dev, addr);
|
||||
|
||||
if (!is_valid_ether_addr(dev->dev_addr)) {
|
||||
err_msg = "Could not obtain valid ethernet address, aborting";
|
||||
|
@ -655,6 +655,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
struct ei_device *ei_local;
|
||||
struct net_device *dev;
|
||||
struct etherh_priv *eh;
|
||||
u8 addr[ETH_ALEN];
|
||||
int ret;
|
||||
|
||||
ret = ecard_request_resources(ec);
|
||||
@ -724,12 +725,13 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
spin_lock_init(&ei_local->page_lock);
|
||||
|
||||
if (ec->cid.product == PROD_ANT_ETHERM) {
|
||||
etherm_addr(dev->dev_addr);
|
||||
etherm_addr(addr);
|
||||
ei_local->reg_offset = etherm_regoffsets;
|
||||
} else {
|
||||
etherh_addr(dev->dev_addr, ec);
|
||||
etherh_addr(addr, ec);
|
||||
ei_local->reg_offset = etherh_regoffsets;
|
||||
}
|
||||
eth_hw_addr_set(dev, addr);
|
||||
|
||||
ei_local->name = dev->name;
|
||||
ei_local->word16 = 1;
|
||||
|
@ -2183,9 +2183,7 @@ static int sbmac_init(struct platform_device *pldev, long long base)
|
||||
ea_reg >>= 8;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
dev->dev_addr[i] = eaddr[i];
|
||||
}
|
||||
eth_hw_addr_set(dev, eaddr);
|
||||
|
||||
/*
|
||||
* Initialize context (get pointers to registers and stuff), then
|
||||
|
@ -986,6 +986,7 @@ static int
|
||||
ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
{
|
||||
struct net_device *dev;
|
||||
u8 addr[ETH_ALEN];
|
||||
int i, ret = 0;
|
||||
|
||||
ether1_banner();
|
||||
@ -1015,7 +1016,8 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
dev->dev_addr[i] = readb(IDPROM_ADDRESS + (i << 2));
|
||||
addr[i] = readb(IDPROM_ADDRESS + (i << 2));
|
||||
eth_hw_addr_set(dev, addr);
|
||||
|
||||
if (ether1_init_2(dev)) {
|
||||
ret = -ENODEV;
|
||||
|
@ -749,6 +749,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
const struct ether3_data *data = id->data;
|
||||
struct net_device *dev;
|
||||
int bus_type, ret;
|
||||
u8 addr[ETH_ALEN];
|
||||
|
||||
ether3_banner();
|
||||
|
||||
@ -776,7 +777,8 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
priv(dev)->seeq = priv(dev)->base + data->base_offset;
|
||||
dev->irq = ec->irq;
|
||||
|
||||
ether3_addr(dev->dev_addr, ec);
|
||||
ether3_addr(addr, ec);
|
||||
eth_hw_addr_set(dev, addr);
|
||||
|
||||
priv(dev)->dev = dev;
|
||||
timer_setup(&priv(dev)->timer, ether3_ledoff, 0);
|
||||
|
@ -1091,20 +1091,22 @@ static int tsi108_get_mac(struct net_device *dev)
|
||||
struct tsi108_prv_data *data = netdev_priv(dev);
|
||||
u32 word1 = TSI_READ(TSI108_MAC_ADDR1);
|
||||
u32 word2 = TSI_READ(TSI108_MAC_ADDR2);
|
||||
u8 addr[ETH_ALEN];
|
||||
|
||||
/* Note that the octets are reversed from what the manual says,
|
||||
* producing an even weirder ordering...
|
||||
*/
|
||||
if (word2 == 0 && word1 == 0) {
|
||||
dev->dev_addr[0] = 0x00;
|
||||
dev->dev_addr[1] = 0x06;
|
||||
dev->dev_addr[2] = 0xd2;
|
||||
dev->dev_addr[3] = 0x00;
|
||||
dev->dev_addr[4] = 0x00;
|
||||
addr[0] = 0x00;
|
||||
addr[1] = 0x06;
|
||||
addr[2] = 0xd2;
|
||||
addr[3] = 0x00;
|
||||
addr[4] = 0x00;
|
||||
if (0x8 == data->phy)
|
||||
dev->dev_addr[5] = 0x01;
|
||||
addr[5] = 0x01;
|
||||
else
|
||||
dev->dev_addr[5] = 0x02;
|
||||
addr[5] = 0x02;
|
||||
eth_hw_addr_set(dev, addr);
|
||||
|
||||
word2 = (dev->dev_addr[0] << 16) | (dev->dev_addr[1] << 24);
|
||||
|
||||
@ -1114,12 +1116,13 @@ static int tsi108_get_mac(struct net_device *dev)
|
||||
TSI_WRITE(TSI108_MAC_ADDR1, word1);
|
||||
TSI_WRITE(TSI108_MAC_ADDR2, word2);
|
||||
} else {
|
||||
dev->dev_addr[0] = (word2 >> 16) & 0xff;
|
||||
dev->dev_addr[1] = (word2 >> 24) & 0xff;
|
||||
dev->dev_addr[2] = (word1 >> 0) & 0xff;
|
||||
dev->dev_addr[3] = (word1 >> 8) & 0xff;
|
||||
dev->dev_addr[4] = (word1 >> 16) & 0xff;
|
||||
dev->dev_addr[5] = (word1 >> 24) & 0xff;
|
||||
addr[0] = (word2 >> 16) & 0xff;
|
||||
addr[1] = (word2 >> 24) & 0xff;
|
||||
addr[2] = (word1 >> 0) & 0xff;
|
||||
addr[3] = (word1 >> 8) & 0xff;
|
||||
addr[4] = (word1 >> 16) & 0xff;
|
||||
addr[5] = (word1 >> 24) & 0xff;
|
||||
eth_hw_addr_set(dev, addr);
|
||||
}
|
||||
|
||||
if (!is_valid_ether_addr(dev->dev_addr)) {
|
||||
@ -1136,14 +1139,12 @@ static int tsi108_set_mac(struct net_device *dev, void *addr)
|
||||
{
|
||||
struct tsi108_prv_data *data = netdev_priv(dev);
|
||||
u32 word1, word2;
|
||||
int i;
|
||||
|
||||
if (!is_valid_ether_addr(addr))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
/* +2 is for the offset of the HW addr type */
|
||||
dev->dev_addr[i] = ((unsigned char *)addr)[i + 2];
|
||||
/* +2 is for the offset of the HW addr type */
|
||||
eth_hw_addr_set(dev, ((unsigned char *)addr) + 2);
|
||||
|
||||
word2 = (dev->dev_addr[0] << 16) | (dev->dev_addr[1] << 24);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user