Control: retitle -1 broadcom-sta-dkms: module build fails for Linux 6.X-rcY 
(only two version components)

On 02/03/2024 22.06, Eduard Bloch wrote:
Thanks, and sorry, I overlooked the last message. I guess we should take
it as is.

I should have updated the misleading bug title after finding the real
cause ...  this time it was not a change in the kernel causing the
failure but a the logic flaw leading to usage of the wrong code path.

Attached are updated versions of two more patches that restore
compatibility with older Linux releases. Let's just use the old or new
names depending on the kernel version ...

(With these three applied, broadcom-sta successfully survives my dkms
torture chroot which contains some header packages for most kernels we
had in sid/stable/security/backports since 2.6.32 ;-)

Andreas
From: Diego Escalante Urrelo <die...@gnome.org>
Date: Sun, 2 Aug 2020 19:54:56 -0500
Subject: wl: Use the right enums for cfg80211_get_bss

---
 amd64/src/wl/sys/wl_cfg80211_hybrid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/amd64/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/amd64/src/wl/sys/wl_cfg80211_hybrid.c
@@ -2309,7 +2309,13 @@ static s32 wl_update_bss_info(struct wl_
 
 	ssid = &wl->profile->ssid;
 	bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
-	      ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
+			       ssid->SSID, ssid->SSID_len,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
+			       WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS
+#else
+			       IEEE80211_BSS_TYPE_ESS, IEEE80211_PRIVACY_ANY
+#endif
+			       );
 
 	rtnl_lock();
 	if (!bss) {
From: Felix Yan <felixonm...@archlinux.org>
Date: Mon, 20 Jun 2016 11:18:00 +0800
Subject: linux47

Origin: https://github.com/archlinuxcn/repo/tree/f4d6cff1cacf8dad13006fade5f96bc2cf020a9b/broadcom-wl-dkms

Since Linux 4.7, the enum ieee80211_band is no longer used

This shall cause no problem's since both enums ieee80211_band
and nl80211_band were added in the same commit:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c

This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*

Reference:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3

This patch is based on
https://github.com/archlinuxcn/repo/tree/f4d6cff1cacf8dad13006fade5f96bc2cf020a9b/broadcom-wl-dkms .
---
 amd64/src/wl/sys/wl_cfg80211_hybrid.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

--- a/amd64/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/amd64/src/wl/sys/wl_cfg80211_hybrid.c
@@ -235,8 +235,13 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX]
 };
 #endif				
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+#define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
+#define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
+#endif
+
 #define CHAN2G(_channel, _freq, _flags) {			\
-	.band			= IEEE80211_BAND_2GHZ,		\
+	.band			= NL80211_BAND_2GHZ,		\
 	.center_freq		= (_freq),			\
 	.hw_value		= (_channel),			\
 	.flags			= (_flags),			\
@@ -245,7 +250,7 @@ static s8 wl_dbg_estr[][WL_DBG_ESTR_MAX]
 }
 
 #define CHAN5G(_channel, _flags) {				\
-	.band			= IEEE80211_BAND_5GHZ,		\
+	.band			= NL80211_BAND_5GHZ,		\
 	.center_freq		= 5000 + (5 * (_channel)),	\
 	.hw_value		= (_channel),			\
 	.flags			= (_flags),			\
@@ -379,7 +384,7 @@ static struct ieee80211_channel __wl_5gh
 };
 
 static struct ieee80211_supported_band __wl_band_2ghz = {
-	.band = IEEE80211_BAND_2GHZ,
+	.band = NL80211_BAND_2GHZ,
 	.channels = __wl_2ghz_channels,
 	.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
 	.bitrates = wl_g_rates,
@@ -387,7 +392,7 @@ static struct ieee80211_supported_band _
 };
 
 static struct ieee80211_supported_band __wl_band_5ghz_a = {
-	.band = IEEE80211_BAND_5GHZ,
+	.band = NL80211_BAND_5GHZ,
 	.channels = __wl_5ghz_a_channels,
 	.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
 	.bitrates = wl_a_rates,
@@ -395,7 +400,7 @@ static struct ieee80211_supported_band _
 };
 
 static struct ieee80211_supported_band __wl_band_5ghz_n = {
-	.band = IEEE80211_BAND_5GHZ,
+	.band = NL80211_BAND_5GHZ,
 	.channels = __wl_5ghz_n_channels,
 	.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
 	.bitrates = wl_a_rates,
@@ -1876,8 +1881,8 @@ static s32 wl_alloc_wdev(struct device *
 	wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
 #endif
 	wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
-	wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
-	wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a; 
+	wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
+	wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a; 
 	wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
 	wdev->wiphy->cipher_suites = __wl_cipher_suites;
 	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
@@ -2000,7 +2005,7 @@ static s32 wl_inform_single_bss(struct w
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
 	freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
 		(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
-		IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
+		NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
 #else
 	freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
 #endif
@@ -2116,7 +2121,7 @@ wl_notify_connect_status(struct wl_cfg80
 				return err;
 			}
 			chan = wf_chspec_ctlchan(chanspec);
-			band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+			band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
 			freq = ieee80211_channel_to_frequency(chan, band);
 			channel = ieee80211_get_channel(wiphy, freq);
 			cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
@@ -2250,10 +2255,10 @@ static void wl_ch_to_chanspec(struct iee
 		join_params->params.chanspec_list[0] =
 		    ieee80211_frequency_to_channel(chan->center_freq);
 
-		if (chan->band == IEEE80211_BAND_2GHZ) {
+		if ( (int) chan->band == (int) NL80211_BAND_2GHZ) {
 			chanspec |= WL_CHANSPEC_BAND_2G;
 		}
-		else if (chan->band == IEEE80211_BAND_5GHZ) {
+		else if ( (int) chan->band == (int) NL80211_BAND_5GHZ) {
 			chanspec |= WL_CHANSPEC_BAND_5G;
 		}
 		else {
@@ -2885,7 +2890,7 @@ static s32 wl_update_wiphybands(struct w
 
 	if (phy == 'n' || phy == 'a' || phy == 'v') {
 		wiphy = wl_to_wiphy(wl);
-		wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
+		wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
 	}
 
 	return err;

Reply via email to