1From 2e9c7bd146fbc3b4a62940140eafb47df16b6cb4 Mon Sep 17 00:00:00 2001
2From: aszlig <aszlig@redmoonstudios.org>
3Date: Tue, 18 Jul 2017 21:32:13 +0200
4Subject: [PATCH 07/16] linuxPackages.broadcom_sta: fix build for kernel 4.12+
5
6The patch is from Arch Linux at:
7
8https://aur.archlinux.org/cgit/aur.git/tree/linux412.patch?h=broadcom-wl
9
10Tested this by building against the following attributes:
11
12 * linuxPackages.broadcom_sta
13 * linuxPackages_latest.broadcom_sta
14 * pkgsI686Linux.linuxPackages.broadcom_sta
15 * pkgsI686Linux.linuxPackages_latest.broadcom_sta
16
17I have not tested whether this works at runtime, because I do not possess the hardware.
18---
19 src/wl/sys/wl_cfg80211_hybrid.c | 29 ++++++++++++++++++++++++++++-
20 1 file changed, 28 insertions(+), 1 deletion(-)
21
22diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
23index 9fd8ed1..1893a53 100644
24--- a/src/wl/sys/wl_cfg80211_hybrid.c
25+++ b/src/wl/sys/wl_cfg80211_hybrid.c
26@@ -53,7 +53,11 @@ u32 wl_dbg_level = WL_DBG_ERR;
27 #endif
28
29 static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
30+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
31+ enum nl80211_iftype type, struct vif_params *params);
32+#else
33 enum nl80211_iftype type, u32 *flags, struct vif_params *params);
34+#endif
35 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
36 static s32
37 wl_cfg80211_scan(struct wiphy *wiphy,
38@@ -466,7 +470,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
39
40 static s32
41 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
42+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
43+ enum nl80211_iftype type,
44+#else
45 enum nl80211_iftype type, u32 *flags,
46+#endif
47 struct vif_params *params)
48 {
49 struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
50@@ -2361,6 +2369,20 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
51 const wl_event_msg_t *e, void *data)
52 {
53 struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
54+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
55+ struct cfg80211_bss *bss;
56+ struct wlc_ssid *ssid;
57+ ssid = &wl->profile->ssid;
58+ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
59+ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
60+ struct cfg80211_roam_info roam_info = {
61+ .bss = bss,
62+ .req_ie = conn_info->req_ie,
63+ .req_ie_len = conn_info->req_ie_len,
64+ .resp_ie = conn_info->resp_ie,
65+ .resp_ie_len = conn_info->resp_ie_len,
66+ };
67+#endif
68 s32 err = 0;
69
70 wl_get_assoc_ies(wl);
71@@ -2368,12 +2390,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
72 memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
73 wl_update_bss_info(wl);
74 cfg80211_roamed(ndev,
75+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
76+ &roam_info,
77+#else
78 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
79 &wl->conf->channel,
80 #endif
81 (u8 *)&wl->bssid,
82 conn_info->req_ie, conn_info->req_ie_len,
83- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
84+ conn_info->resp_ie, conn_info->resp_ie_len,
85+#endif
86+ GFP_KERNEL);
87 WL_DBG(("Report roaming result\n"));
88
89 set_bit(WL_STATUS_CONNECTED, &wl->status);
90--
912.45.1
92