Commit 623acf87 authored by David S. Miller's avatar David S. Miller

Merge branch 'dev_addr-conversions-part-three'

Jakub Kicinski says:

====================
ethernet: manual netdev->dev_addr conversions (part 3)

Manual conversions of Ethernet drivers writing directly
to netdev->dev_addr (part 3 out of 3).
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4d8e5035 0b271c48
......@@ -2037,13 +2037,15 @@ static int netsec_probe(struct platform_device *pdev)
if (ret && priv->eeprom_base) {
void __iomem *macp = priv->eeprom_base +
NETSEC_EEPROM_MAC_ADDRESS;
ndev->dev_addr[0] = readb(macp + 3);
ndev->dev_addr[1] = readb(macp + 2);
ndev->dev_addr[2] = readb(macp + 1);
ndev->dev_addr[3] = readb(macp + 0);
ndev->dev_addr[4] = readb(macp + 7);
ndev->dev_addr[5] = readb(macp + 6);
u8 addr[ETH_ALEN];
addr[0] = readb(macp + 3);
addr[1] = readb(macp + 2);
addr[2] = readb(macp + 1);
addr[3] = readb(macp + 0);
addr[4] = readb(macp + 7);
addr[5] = readb(macp + 6);
eth_hw_addr_set(ndev, addr);
}
if (!is_valid_ether_addr(ndev->dev_addr)) {
......
......@@ -2818,9 +2818,13 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv)
*/
static void stmmac_check_ether_addr(struct stmmac_priv *priv)
{
u8 addr[ETH_ALEN];
if (!is_valid_ether_addr(priv->dev->dev_addr)) {
stmmac_get_umac_addr(priv, priv->hw, priv->dev->dev_addr, 0);
if (!is_valid_ether_addr(priv->dev->dev_addr))
stmmac_get_umac_addr(priv, priv->hw, addr, 0);
if (is_valid_ether_addr(addr))
eth_hw_addr_set(priv->dev, addr);
else
eth_hw_addr_random(priv->dev);
dev_info(priv->device, "device MAC address %pM\n",
priv->dev->dev_addr);
......
......@@ -840,6 +840,7 @@ static int bdx_set_mac(struct net_device *ndev, void *p)
static int bdx_read_mac(struct bdx_priv *priv)
{
u16 macAddress[3], i;
u8 addr[ETH_ALEN];
ENTER;
macAddress[2] = READ_REG(priv, regUNC_MAC0_A);
......@@ -849,9 +850,10 @@ static int bdx_read_mac(struct bdx_priv *priv)
macAddress[0] = READ_REG(priv, regUNC_MAC2_A);
macAddress[0] = READ_REG(priv, regUNC_MAC2_A);
for (i = 0; i < 3; i++) {
priv->ndev->dev_addr[i * 2 + 1] = macAddress[i];
priv->ndev->dev_addr[i * 2] = macAddress[i] >> 8;
addr[i * 2 + 1] = macAddress[i];
addr[i * 2] = macAddress[i] >> 8;
}
eth_hw_addr_set(priv->ndev, addr);
RET(0);
}
......
......@@ -817,6 +817,7 @@ static int tlan_init(struct net_device *dev)
int err;
int i;
struct tlan_priv *priv;
u8 addr[ETH_ALEN];
priv = netdev_priv(dev);
......@@ -842,7 +843,7 @@ static int tlan_init(struct net_device *dev)
for (i = 0; i < ETH_ALEN; i++)
err |= tlan_ee_read_byte(dev,
(u8) priv->adapter->addr_ofs + i,
(u8 *) &dev->dev_addr[i]);
addr + i);
if (err) {
pr_err("%s: Error reading MAC from eeprom: %d\n",
dev->name, err);
......@@ -850,11 +851,12 @@ static int tlan_init(struct net_device *dev)
/* Olicom OC-2325/OC-2326 have the address byte-swapped */
if (priv->adapter->addr_ofs == 0xf8) {
for (i = 0; i < ETH_ALEN; i += 2) {
char tmp = dev->dev_addr[i];
dev->dev_addr[i] = dev->dev_addr[i + 1];
dev->dev_addr[i + 1] = tmp;
char tmp = addr[i];
addr[i] = addr[i + 1];
addr[i + 1] = tmp;
}
}
eth_hw_addr_set(dev, addr);
netif_carrier_off(dev);
......
......@@ -899,6 +899,7 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks,
struct net_device *dev;
struct rhine_private *rp;
int i, rc, phy_id;
u8 addr[ETH_ALEN];
const char *name;
/* this should always be supported */
......@@ -933,7 +934,8 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks,
rhine_hw_init(dev, pioaddr);
for (i = 0; i < 6; i++)
dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i);
addr[i] = ioread8(ioaddr + StationAddr + i);
eth_hw_addr_set(dev, addr);
if (!is_valid_ether_addr(dev->dev_addr)) {
/* Report it and use a random ethernet address instead */
......
......@@ -2767,6 +2767,7 @@ static int velocity_probe(struct device *dev, int irq,
struct velocity_info *vptr;
struct mac_regs __iomem *regs;
int ret = -ENOMEM;
u8 addr[ETH_ALEN];
/* FIXME: this driver, like almost all other ethernet drivers,
* can support more than MAX_UNITS.
......@@ -2820,7 +2821,8 @@ static int velocity_probe(struct device *dev, int irq,
mac_wol_reset(regs);
for (i = 0; i < 6; i++)
netdev->dev_addr[i] = readb(&regs->PAR[i]);
addr[i] = readb(&regs->PAR[i]);
eth_hw_addr_set(netdev, addr);
velocity_get_options(&vptr->options, velocity_nics);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment