Commit ea52a0b5 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net: use dev_addr_set()

Use dev_addr_set() instead of writing directly to netdev->dev_addr
in various misc and old drivers.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 794a69b3
...@@ -4414,7 +4414,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) ...@@ -4414,7 +4414,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
} }
/* success */ /* success */
memcpy(bond_dev->dev_addr, ss->__data, bond_dev->addr_len); dev_addr_set(bond_dev, ss->__data);
return 0; return 0;
unwind: unwind:
......
...@@ -791,7 +791,7 @@ static int baycom_set_mac_address(struct net_device *dev, void *addr) ...@@ -791,7 +791,7 @@ static int baycom_set_mac_address(struct net_device *dev, void *addr)
struct sockaddr *sa = (struct sockaddr *)addr; struct sockaddr *sa = (struct sockaddr *)addr;
/* addr is an AX.25 shifted ASCII mac address */ /* addr is an AX.25 shifted ASCII mac address */
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
...@@ -302,7 +302,7 @@ static int bpq_set_mac_address(struct net_device *dev, void *addr) ...@@ -302,7 +302,7 @@ static int bpq_set_mac_address(struct net_device *dev, void *addr)
{ {
struct sockaddr *sa = (struct sockaddr *)addr; struct sockaddr *sa = (struct sockaddr *)addr;
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
...@@ -956,8 +956,7 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -956,8 +956,7 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev)
static int scc_set_mac_address(struct net_device *dev, void *sa) static int scc_set_mac_address(struct net_device *dev, void *sa)
{ {
memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data, dev_addr_set(dev, ((struct sockaddr *)sa)->sa_data);
dev->addr_len);
return 0; return 0;
} }
......
...@@ -415,7 +415,7 @@ static int hdlcdrv_set_mac_address(struct net_device *dev, void *addr) ...@@ -415,7 +415,7 @@ static int hdlcdrv_set_mac_address(struct net_device *dev, void *addr)
struct sockaddr *sa = (struct sockaddr *)addr; struct sockaddr *sa = (struct sockaddr *)addr;
/* addr is an AX.25 shifted ASCII mac address */ /* addr is an AX.25 shifted ASCII mac address */
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
...@@ -1951,7 +1951,7 @@ static int scc_net_siocdevprivate(struct net_device *dev, ...@@ -1951,7 +1951,7 @@ static int scc_net_siocdevprivate(struct net_device *dev,
static int scc_net_set_mac_address(struct net_device *dev, void *addr) static int scc_net_set_mac_address(struct net_device *dev, void *addr)
{ {
struct sockaddr *sa = (struct sockaddr *) addr; struct sockaddr *sa = (struct sockaddr *) addr;
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
...@@ -1063,7 +1063,7 @@ static int yam_set_mac_address(struct net_device *dev, void *addr) ...@@ -1063,7 +1063,7 @@ static int yam_set_mac_address(struct net_device *dev, void *addr)
struct sockaddr *sa = (struct sockaddr *) addr; struct sockaddr *sa = (struct sockaddr *) addr;
/* addr is an AX.25 shifted ASCII mac address */ /* addr is an AX.25 shifted ASCII mac address */
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
...@@ -748,8 +748,7 @@ struct failover *net_failover_create(struct net_device *standby_dev) ...@@ -748,8 +748,7 @@ struct failover *net_failover_create(struct net_device *standby_dev)
failover_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; failover_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
failover_dev->features |= failover_dev->hw_features; failover_dev->features |= failover_dev->hw_features;
memcpy(failover_dev->dev_addr, standby_dev->dev_addr, dev_addr_set(failover_dev, standby_dev->dev_addr);
failover_dev->addr_len);
failover_dev->min_mtu = standby_dev->min_mtu; failover_dev->min_mtu = standby_dev->min_mtu;
failover_dev->max_mtu = standby_dev->max_mtu; failover_dev->max_mtu = standby_dev->max_mtu;
......
...@@ -428,7 +428,7 @@ static int ntb_netdev_probe(struct device *client_dev) ...@@ -428,7 +428,7 @@ static int ntb_netdev_probe(struct device *client_dev)
ndev->watchdog_timeo = msecs_to_jiffies(NTB_TX_TIMEOUT_MS); ndev->watchdog_timeo = msecs_to_jiffies(NTB_TX_TIMEOUT_MS);
eth_random_addr(ndev->perm_addr); eth_random_addr(ndev->perm_addr);
memcpy(ndev->dev_addr, ndev->perm_addr, ndev->addr_len); dev_addr_set(ndev, ndev->perm_addr);
ndev->netdev_ops = &ntb_netdev_ops; ndev->netdev_ops = &ntb_netdev_ops;
ndev->ethtool_ops = &ntb_ethtool_ops; ndev->ethtool_ops = &ntb_ethtool_ops;
......
...@@ -1790,7 +1790,7 @@ static int team_set_mac_address(struct net_device *dev, void *p) ...@@ -1790,7 +1790,7 @@ static int team_set_mac_address(struct net_device *dev, void *p)
if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data)) if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); dev_addr_set(dev, addr->sa_data);
mutex_lock(&team->lock); mutex_lock(&team->lock);
list_for_each_entry(port, &team->port_list, list) list_for_each_entry(port, &team->port_list, list)
if (team->ops.port_change_dev_addr) if (team->ops.port_change_dev_addr)
......
...@@ -2824,7 +2824,7 @@ vmxnet3_set_mac_addr(struct net_device *netdev, void *p) ...@@ -2824,7 +2824,7 @@ vmxnet3_set_mac_addr(struct net_device *netdev, void *p)
struct sockaddr *addr = p; struct sockaddr *addr = p;
struct vmxnet3_adapter *adapter = netdev_priv(netdev); struct vmxnet3_adapter *adapter = netdev_priv(netdev);
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); dev_addr_set(netdev, addr->sa_data);
vmxnet3_write_mac_addr(adapter, addr->sa_data); vmxnet3_write_mac_addr(adapter, addr->sa_data);
return 0; return 0;
...@@ -3638,7 +3638,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, ...@@ -3638,7 +3638,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
#endif #endif
vmxnet3_read_mac_addr(adapter, mac); vmxnet3_read_mac_addr(adapter, mac);
memcpy(netdev->dev_addr, mac, netdev->addr_len); dev_addr_set(netdev, mac);
netdev->netdev_ops = &vmxnet3_netdev_ops; netdev->netdev_ops = &vmxnet3_netdev_ops;
vmxnet3_set_ethtool_ops(netdev); vmxnet3_set_ethtool_ops(netdev);
......
...@@ -301,7 +301,7 @@ static int lapbeth_set_mac_address(struct net_device *dev, void *addr) ...@@ -301,7 +301,7 @@ static int lapbeth_set_mac_address(struct net_device *dev, void *addr)
{ {
struct sockaddr *sa = addr; struct sockaddr *sa = addr;
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
...@@ -121,7 +121,7 @@ int hippi_mac_addr(struct net_device *dev, void *p) ...@@ -121,7 +121,7 @@ int hippi_mac_addr(struct net_device *dev, void *p)
struct sockaddr *addr = p; struct sockaddr *addr = p;
if (netif_running(dev)) if (netif_running(dev))
return -EBUSY; return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); dev_addr_set(dev, addr->sa_data);
return 0; return 0;
} }
EXPORT_SYMBOL(hippi_mac_addr); EXPORT_SYMBOL(hippi_mac_addr);
......
...@@ -578,7 +578,7 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) ...@@ -578,7 +578,7 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
if (list_empty(&brdev->brvccs) && !brdev->mac_was_set) { if (list_empty(&brdev->brvccs) && !brdev->mac_was_set) {
unsigned char *esi = atmvcc->dev->esi; unsigned char *esi = atmvcc->dev->esi;
if (esi[0] | esi[1] | esi[2] | esi[3] | esi[4] | esi[5]) if (esi[0] | esi[1] | esi[2] | esi[3] | esi[4] | esi[5])
memcpy(net_dev->dev_addr, esi, net_dev->addr_len); dev_addr_set(net_dev, esi);
else else
net_dev->dev_addr[2] = 1; net_dev->dev_addr[2] = 1;
} }
......
...@@ -111,7 +111,7 @@ static int __must_check nr_set_mac_address(struct net_device *dev, void *addr) ...@@ -111,7 +111,7 @@ static int __must_check nr_set_mac_address(struct net_device *dev, void *addr)
ax25_listen_release((ax25_address *)dev->dev_addr, NULL); ax25_listen_release((ax25_address *)dev->dev_addr, NULL);
} }
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
...@@ -69,7 +69,7 @@ static int rose_set_mac_address(struct net_device *dev, void *addr) ...@@ -69,7 +69,7 @@ static int rose_set_mac_address(struct net_device *dev, void *addr)
rose_del_loopback_node((rose_address *)dev->dev_addr); rose_del_loopback_node((rose_address *)dev->dev_addr);
} }
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); dev_addr_set(dev, sa->sa_data);
return 0; return 0;
} }
......
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