mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
ethernet: use eth_hw_addr_set() in unmaintained drivers
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>
This commit is contained in:
parent
0e9e7598c6
commit
4abd7cffc0
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user