[wl-kmod] Add patch to replace IEEE80211_BAND_x macros with NL80211_BAND_x ones for kernel >= 4.7 thanks to Ti

Nicolas Viéville nvieville at rpmfusion.org
Mon Aug 29 22:56:05 CEST 2016


commit c0f022cc709dca2e535590265f4b1a781133b916
Author: Nicolas Viéville <nicolas.vieville at univ-valenciennes.fr>
Date:   Mon Aug 29 22:54:18 2016 +0200

    Add patch to replace IEEE80211_BAND_x macros with NL80211_BAND_x ones for kernel >= 4.7
    thanks to Tim Thomas
    - Add patch to fix GCC6 indentation warnings

 ...kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch | 142 +++++++++++++++++++++
 wl-kmod-006_gcc_6_fix_indentation_warnings.patch   |  16 +++
 wl-kmod.spec                                       |  14 +-
 3 files changed, 170 insertions(+), 2 deletions(-)
---
diff --git a/wl-kmod-005_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch b/wl-kmod-005_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch
new file mode 100644
index 0000000..85e61c4
--- /dev/null
+++ b/wl-kmod-005_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch
@@ -0,0 +1,142 @@
+diff -Naur hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/wl/sys/wl_cfg80211_hybrid.c hybrid-v35_64-nodebug-pcoem-6_30_223_271/src/wl/sys/wl_cfg80211_hybrid.c
+--- hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/wl/sys/wl_cfg80211_hybrid.c	2015-09-19 00:47:30.000000000 +0200
++++ hybrid-v35_64-nodebug-pcoem-6_30_223_271/src/wl/sys/wl_cfg80211_hybrid.c	2016-08-15 01:58:51.610278898 +0200
+@@ -235,6 +235,25 @@
+ };
+ #endif				
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++#define CHAN2G(_channel, _freq, _flags) {			\
++	.band			= NL80211_BAND_2GHZ,		\
++	.center_freq		= (_freq),			\
++	.hw_value		= (_channel),			\
++	.flags			= (_flags),			\
++	.max_antenna_gain	= 0,				\
++	.max_power		= 30,				\
++}
++
++#define CHAN5G(_channel, _flags) {				\
++	.band			= NL80211_BAND_5GHZ,		\
++	.center_freq		= 5000 + (5 * (_channel)),	\
++	.hw_value		= (_channel),			\
++	.flags			= (_flags),			\
++	.max_antenna_gain	= 0,				\
++	.max_power		= 30,				\
++}
++#else
+ #define CHAN2G(_channel, _freq, _flags) {			\
+ 	.band			= IEEE80211_BAND_2GHZ,		\
+ 	.center_freq		= (_freq),			\
+@@ -252,6 +271,7 @@
+ 	.max_antenna_gain	= 0,				\
+ 	.max_power		= 30,				\
+ }
++#endif
+ 
+ #define RATE_TO_BASE100KBPS(rate)   (((rate) * 10) / 2)
+ #define RATETAB_ENT(_rateid, _flags) \
+@@ -379,7 +399,11 @@
+ };
+ 
+ static struct ieee80211_supported_band __wl_band_2ghz = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++	.band = NL80211_BAND_2GHZ,
++#else
+ 	.band = IEEE80211_BAND_2GHZ,
++#endif
+ 	.channels = __wl_2ghz_channels,
+ 	.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
+ 	.bitrates = wl_g_rates,
+@@ -387,7 +411,11 @@
+ };
+ 
+ static struct ieee80211_supported_band __wl_band_5ghz_a = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++	.band = NL80211_BAND_5GHZ,
++#else
+ 	.band = IEEE80211_BAND_5GHZ,
++#endif
+ 	.channels = __wl_5ghz_a_channels,
+ 	.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
+ 	.bitrates = wl_a_rates,
+@@ -395,7 +423,11 @@
+ };
+ 
+ static struct ieee80211_supported_band __wl_band_5ghz_n = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++	.band = NL80211_BAND_5GHZ,
++#else
+ 	.band = IEEE80211_BAND_5GHZ,
++#endif
+ 	.channels = __wl_5ghz_n_channels,
+ 	.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
+ 	.bitrates = wl_a_rates,
+@@ -1876,8 +1908,13 @@
+ 	wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
+ #endif
+ 	wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++	wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
++	wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a; 
++#else
+ 	wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
+ 	wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a; 
++#endif
+ 	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 +2037,11 @@
+ #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) ?
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++		NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
++#else
+ 		IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
++#endif
+ #else
+ 	freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
+ #endif
+@@ -2116,7 +2157,11 @@
+ 				return err;
+ 			}
+ 			chan = wf_chspec_ctlchan(chanspec);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++			band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
++#else
+ 			band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
++#endif
+ 			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 +2295,18 @@
+ 		join_params->params.chanspec_list[0] =
+ 		    ieee80211_frequency_to_channel(chan->center_freq);
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++		if (chan->band == NL80211_BAND_2GHZ) {
++#else
+ 		if (chan->band == IEEE80211_BAND_2GHZ) {
++#endif
+ 			chanspec |= WL_CHANSPEC_BAND_2G;
+ 		}
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++		else if (chan->band == NL80211_BAND_5GHZ) {
++#else
+ 		else if (chan->band == IEEE80211_BAND_5GHZ) {
++#endif
+ 			chanspec |= WL_CHANSPEC_BAND_5G;
+ 		}
+ 		else {
+@@ -2885,7 +2938,11 @@
+ 
+ 	if (phy == 'n' || phy == 'a' || phy == 'v') {
+ 		wiphy = wl_to_wiphy(wl);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
++		wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
++#else
+ 		wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
++#endif
+ 	}
+ 
+ 	return err;
diff --git a/wl-kmod-006_gcc_6_fix_indentation_warnings.patch b/wl-kmod-006_gcc_6_fix_indentation_warnings.patch
new file mode 100644
index 0000000..82be172
--- /dev/null
+++ b/wl-kmod-006_gcc_6_fix_indentation_warnings.patch
@@ -0,0 +1,16 @@
+diff -Naur hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/wl/sys/wl_linux.c hybrid-v35_64-nodebug-pcoem-6_30_223_271/src/wl/sys/wl_linux.c
+--- hybrid-v35_64-nodebug-pcoem-6_30_223_271.orig/src/wl/sys/wl_linux.c	2015-10-18 13:28:13.013818000 +0200
++++ hybrid-v35_64-nodebug-pcoem-6_30_223_271/src/wl/sys/wl_linux.c	2016-08-26 08:24:32.558643780 +0200
+@@ -775,9 +775,9 @@
+ 	pci_read_config_dword(pdev, 0x40, &val);
+ 	if ((val & 0x0000ff00) != 0)
+ 		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
+-		bar1_size = pci_resource_len(pdev, 2);
+-		bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
+-			bar1_size);
++	bar1_size = pci_resource_len(pdev, 2);
++	bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
++		bar1_size);
+ 	wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
+ 		pdev->irq, bar1_addr, bar1_size);
+ 
diff --git a/wl-kmod.spec b/wl-kmod.spec
index 6ddfec4..a1389a7 100644
--- a/wl-kmod.spec
+++ b/wl-kmod.spec
@@ -3,11 +3,12 @@
 # "buildforkernels newest" macro for just that build; immediately after
 # queuing that build enable the macro again for subsequent builds; that way
 # a new akmod package will only get build when a new one is actually needed
-%global buildforkernels current
+%global buildforkernels akmod
+%global debug_package %{nil}
 
 Name:       wl-kmod
 Version:    6.30.223.271
-Release:    4%{?dist}
+Release:    5%{?dist}
 Summary:    Kernel module for Broadcom wireless devices
 Group:      System Environment/Kernel
 License:    Redistributable, no modification permitted
@@ -19,6 +20,8 @@ Patch0:     wl-kmod-001_wext_workaround.patch
 Patch1:     wl-kmod-002_kernel_3.18_null_pointer.patch
 Patch2:     wl-kmod-003_gcc_4.9_remove_TIME_DATE_macros.patch
 Patch3:     wl-kmod-004_kernel_4.3_rdtscl_to_rdtsc.patch
+Patch4:     wl-kmod-005_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch
+Patch5:     wl-kmod-006_gcc_6_fix_indentation_warnings.patch
 
 BuildRequires:  %{_bindir}/kmodtool
 
@@ -61,6 +64,8 @@ pushd %{name}-%{version}-src
 %patch1  -p1 -b .kernel_3.18_null_pointer.patch
 %patch2  -p1 -b .gcc_4.9_remove_TIME_DATE_macros
 %patch3  -p1 -b .kernel_4.3_rdtscl_to_rdtsc.patch
+%patch4  -p1 -b .kernel_4.7_IEEE80211_BAND_to_NL80211_BAND
+%patch5  -p1 -b .gcc_6_fix_indentation_warnings
 popd
 
 for kernel_version in %{?kernel_versions} ; do
@@ -90,6 +95,11 @@ chmod 0755 $RPM_BUILD_ROOT%{kmodinstdir_prefix}*%{kmodinstdir_postfix}/* || :
 rm -rf $RPM_BUILD_ROOT
 
 %changelog
+* Mon Aug 29 2016 Nicolas Viéville <nicolas.vieville at univ-valenciennes.fr> - 6.30.223.271-5
+- Add patch to replace IEEE80211_BAND_x macros with NL80211_BAND_x ones for kernel >= 4.7
+  thanks to Tim Thomas
+- Add patch to fix GCC6 indentation warnings
+
 * Mon Dec 21 2015 Nicolas Viéville <nicolas.vieville at univ-valenciennes.fr> - 6.30.223.271-4
 - Add patch to replace call to rdtscl with call to rdtsc for kernel >= 4.3
   thanks to Tim Thomas


More information about the rpmfusion-commits mailing list