1From a5e450dcdc7bc4ce06379189c3577f8c7a36fbde Mon Sep 17 00:00:00 2001
2From: Joan Bruguera <joanbrugueram@gmail.com>
3Date: Wed, 12 Jan 2022 20:49:20 +0100
4Subject: [PATCH 12/16] linuxPackages.broadcom_sta: fix build for kernel 5.17+
5
6Tentative fix for broadcom-wl 6.30.223.271 driver for Linux 5.17-rc1
7
8Set netdev->dev_addr through dev_addr_mod + PDE_DATA fix
9
10Since Linux 5.17 netdev->dev_addr is const and must be changed through
11dev_addr_mod, otherwise a warning is logged in dmesg and bad things may happen.
12
13NB: The #if is not wrong, dev_addr_mod is defined since Linux 5.15-rc1
14
15Plus a trivial fix for PDE_DATA.
16
17Applies on top of all the patches applied to broadcom-wl-dkms 6.30.223.271-28 on Arch Linux.
18
19See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=adeef3e32146a8d2a73c399dc6f5d76a449131b1
20 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=359745d78351c6f5442435f81549f0207ece28aa
21---
22 src/wl/sys/wl_linux.c | 10 +++++++---
23 1 file changed, 7 insertions(+), 3 deletions(-)
24
25diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
26index 26ba9fa..25c4706 100644
27--- a/src/wl/sys/wl_linux.c
28+++ b/src/wl/sys/wl_linux.c
29@@ -93,6 +93,10 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev);
30
31 #include <wlc_wowl.h>
32
33+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
34+#define PDE_DATA pde_data
35+#endif
36+
37 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
38 static void wl_timer(struct timer_list *tl);
39 #else
40@@ -646,7 +650,7 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
41 WL_ERROR(("wl%d: Error setting MAC ADDRESS\n", unit));
42 }
43 #endif
44- bcopy(&wl->pub->cur_etheraddr, dev->dev_addr, ETHER_ADDR_LEN);
45+ eth_hw_addr_set(dev, wl->pub->cur_etheraddr.octet);
46
47 online_cpus = 1;
48
49@@ -1852,7 +1856,7 @@ wl_set_mac_address(struct net_device *dev, void *addr)
50
51 WL_LOCK(wl);
52
53- bcopy(sa->sa_data, dev->dev_addr, ETHER_ADDR_LEN);
54+ eth_hw_addr_set(dev, sa->sa_data);
55 err = wlc_iovar_op(wl->wlc, "cur_etheraddr", NULL, 0, sa->sa_data, ETHER_ADDR_LEN,
56 IOV_SET, (WL_DEV_IF(dev))->wlcif);
57 WL_UNLOCK(wl);
58@@ -3033,7 +3037,7 @@ _wl_add_monitor_if(wl_task_t *task)
59 else
60 dev->type = ARPHRD_IEEE80211_RADIOTAP;
61
62- bcopy(wl->dev->dev_addr, dev->dev_addr, ETHER_ADDR_LEN);
63+ eth_hw_addr_set(dev, wl->dev->dev_addr);
64
65 #if defined(WL_USE_NETDEV_OPS)
66 dev->netdev_ops = &wl_netdev_monitor_ops;
67--
682.45.1
69