Commit 708884e7 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Kalle Valo
Browse files

wireless: use eth_hw_addr_set()



Convert all WiFi drivers from memcpy(... ETH_ADDR)
to eth_hw_addr_set():

  @@
  expression dev, np;
  @@
  - memcpy(dev->dev_addr, np, ETH_ALEN)
  + eth_hw_addr_set(dev, np)

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211018235021.1279697-2-kuba@kernel.org
parent 8bf26aa1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3803,7 +3803,7 @@ struct wireless_dev *ath6kl_interface_add(struct ath6kl *ar, const char *name,
	vif->htcap[NL80211_BAND_2GHZ].ht_enable = true;
	vif->htcap[NL80211_BAND_5GHZ].ht_enable = true;

	memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
	eth_hw_addr_set(ndev, ar->mac_addr);
	if (fw_vif_idx != 0) {
		ndev->dev_addr[0] = (ndev->dev_addr[0] ^ (1 << fw_vif_idx)) |
				     0x2;
+1 −1
Original line number Diff line number Diff line
@@ -3730,7 +3730,7 @@ static int probe_atmel_card(struct net_device *dev)
				0x00, 0x04, 0x25, 0x00, 0x00, 0x00
			};
			printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name);
			memcpy(dev->dev_addr, default_mac, ETH_ALEN);
			eth_hw_addr_set(dev, default_mac);
		}
	}

+3 −3
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr)
	} else {
		brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
		memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
		memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
		eth_hw_addr_set(ifp->ndev, ifp->mac_addr);
	}
	return err;
}
@@ -655,7 +655,7 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool locked)
	ndev->ethtool_ops = &brcmf_ethtool_ops;

	/* set the mac address & netns */
	memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
	eth_hw_addr_set(ndev, ifp->mac_addr);
	dev_net_set(ndev, wiphy_net(cfg_to_wiphy(drvr->config)));

	INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
@@ -830,7 +830,7 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
	ndev->netdev_ops = &brcmf_netdev_ops_p2p;

	/* set the mac address */
	memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
	eth_hw_addr_set(ndev, ifp->mac_addr);

	if (register_netdev(ndev) != 0) {
		bphy_err(drvr, "couldn't register the p2p net device\n");
+2 −2
Original line number Diff line number Diff line
@@ -4685,7 +4685,7 @@ static int ipw2100_read_mac_address(struct ipw2100_priv *priv)
		return -EIO;
	}

	memcpy(priv->net_dev->dev_addr, addr, ETH_ALEN);
	eth_hw_addr_set(priv->net_dev, addr);
	IPW_DEBUG_INFO("card MAC is %pM\n", priv->net_dev->dev_addr);

	return 0;
@@ -4712,7 +4712,7 @@ static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)

	if (priv->config & CFG_CUSTOM_MAC) {
		memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN);
		memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
		eth_hw_addr_set(priv->net_dev, priv->mac_addr);
	} else
		memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr,
		       ETH_ALEN);
+2 −2
Original line number Diff line number Diff line
@@ -11185,7 +11185,7 @@ static int ipw_up(struct ipw_priv *priv)
		ipw_init_ordinals(priv);
		if (!(priv->config & CFG_CUSTOM_MAC))
			eeprom_parse_mac(priv, priv->mac_addr);
		memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
		eth_hw_addr_set(priv->net_dev, priv->mac_addr);

		ipw_set_geo(priv);

@@ -11542,7 +11542,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
	priv->prom_priv->priv = priv;

	strcpy(priv->prom_net_dev->name, "rtap%d");
	memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
	eth_hw_addr_set(priv->prom_net_dev, priv->mac_addr);

	priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
	priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
Loading