netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 02/11] net: use eth_hw_addr_set()
Date: Fri,  1 Oct 2021 14:32:19 -0700	[thread overview]
Message-ID: <20211001213228.1735079-3-kuba@kernel.org> (raw)
In-Reply-To: <20211001213228.1735079-1-kuba@kernel.org>

Convert sw 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: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/hyperv/netvsc_drv.c  | 2 +-
 drivers/net/ipvlan/ipvlan_main.c | 2 +-
 drivers/net/macvlan.c            | 2 +-
 net/bridge/br_stp_if.c           | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 382bebc2420d..479d2835a220 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2536,7 +2536,7 @@ static int netvsc_probe(struct hv_device *dev,
 		goto rndis_failed;
 	}
 
-	memcpy(net->dev_addr, device_info->mac_adr, ETH_ALEN);
+	eth_hw_addr_set(net, device_info->mac_adr);
 
 	/* We must get rtnl lock before scheduling nvdev->subchan_work,
 	 * otherwise netvsc_subchan_work() can get rtnl lock first and wait
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index c0b21a5580d5..cca4a00f1c51 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -579,7 +579,7 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
 	 * world but keep using the physical-dev address for the outgoing
 	 * packets.
 	 */
-	memcpy(dev->dev_addr, phy_dev->dev_addr, ETH_ALEN);
+	eth_hw_addr_set(dev, phy_dev->dev_addr);
 
 	dev->priv_flags |= IFF_NO_RX_HANDLER;
 
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 35f46ad040b0..63563edfd4a6 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -202,7 +202,7 @@ static void macvlan_hash_change_addr(struct macvlan_dev *vlan,
 	/* Now that we are unhashed it is safe to change the device
 	 * address without confusing packet delivery.
 	 */
-	memcpy(vlan->dev->dev_addr, addr, ETH_ALEN);
+	eth_hw_addr_set(vlan->dev, addr);
 	macvlan_hash_add(vlan);
 }
 
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index ba55851fe132..75204d36d7f9 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -233,7 +233,7 @@ void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *addr)
 
 	memcpy(oldaddr, br->bridge_id.addr, ETH_ALEN);
 	memcpy(br->bridge_id.addr, addr, ETH_ALEN);
-	memcpy(br->dev->dev_addr, addr, ETH_ALEN);
+	eth_hw_addr_set(br->dev, addr);
 
 	list_for_each_entry(p, &br->port_list, list) {
 		if (ether_addr_equal(p->designated_bridge.addr, oldaddr))
-- 
2.31.1


  parent reply	other threads:[~2021-10-01 21:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 21:32 [PATCH net-next 00/11] Use netdev->dev_addr write helpers (part 1) Jakub Kicinski
2021-10-01 21:32 ` [PATCH net-next 01/11] arch: use eth_hw_addr_set() Jakub Kicinski
2021-10-01 22:59   ` Max Filippov
2021-10-02  9:19   ` Geert Uytterhoeven
2021-10-01 21:32 ` Jakub Kicinski [this message]
2021-10-01 21:32 ` [PATCH net-next 03/11] ethernet: " Jakub Kicinski
2021-10-02 16:32   ` Ido Schimmel
2021-10-03  0:12     ` Jakub Kicinski
2021-10-03  4:40       ` Ido Schimmel
2021-10-01 21:32 ` [PATCH net-next 04/11] net: usb: " Jakub Kicinski
2021-10-01 21:32 ` [PATCH net-next 05/11] net: use eth_hw_addr_set() instead of ether_addr_copy() Jakub Kicinski
2021-10-01 21:32 ` [PATCH net-next 06/11] ethernet: " Jakub Kicinski
2021-10-01 21:32 ` [PATCH net-next 07/11] net: usb: " Jakub Kicinski
2021-10-01 21:32 ` [PATCH net-next 08/11] ethernet: chelsio: use eth_hw_addr_set() Jakub Kicinski
2021-10-01 21:32 ` [PATCH net-next 09/11] ethernet: s2io: " Jakub Kicinski
2021-10-01 21:32 ` [PATCH net-next 10/11] fddi: " Jakub Kicinski
2021-10-18  2:34   ` Maciej W. Rozycki
2021-10-01 21:32 ` [PATCH net-next 11/11] ethernet: use eth_hw_addr_set() - casts Jakub Kicinski
2021-10-02 15:10 ` [PATCH net-next 00/11] Use netdev->dev_addr write helpers (part 1) patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211001213228.1735079-3-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).