From 13b5ffa0e282f3d18e57735e37b8fed3a392872b Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Tue, 12 Oct 2021 07:27:57 -0700 Subject: net: remove single-byte netdev->dev_addr writes Make the drivers which use single-byte netdev addresses (netdev->addr_len == 1) use the appropriate address setting helpers. arcnet copies from int variables and io reads a lot, so add a helper for arcnet drivers to use. Similar helper could be reused for phonet and appletalk but there isn't any good central location where we could put it, and netdevice.h is already very crowded. Acked-by: Sebastian Reichel # for HSI Link: https://lore.kernel.org/r/20211012142757.4124842-1-kuba@kernel.org Signed-off-by: Jakub Kicinski --- drivers/usb/gadget/function/f_phonet.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/usb/gadget') diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index 0b468f5d55bc..068ed8417e5a 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c @@ -267,6 +267,8 @@ static const struct net_device_ops pn_netdev_ops = { static void pn_net_setup(struct net_device *dev) { + const u8 addr = PN_MEDIA_USB; + dev->features = 0; dev->type = ARPHRD_PHONET; dev->flags = IFF_POINTOPOINT | IFF_NOARP; @@ -274,8 +276,9 @@ static void pn_net_setup(struct net_device *dev) dev->min_mtu = PHONET_MIN_MTU; dev->max_mtu = PHONET_MAX_MTU; dev->hard_header_len = 1; - dev->dev_addr[0] = PN_MEDIA_USB; dev->addr_len = 1; + dev_addr_set(dev, &addr); + dev->tx_queue_len = 1; dev->netdev_ops = &pn_netdev_ops; -- cgit v1.2.3