[openwrt/openwrt] broadcom-wl: Fix compilation with kernel 5.10

LEDE Commits lede-commits at lists.infradead.org
Mon Jun 20 15:16:51 PDT 2022


florian pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/cd3de51bb4a18f922a961fdeb42c1c8f1f80b425

commit cd3de51bb4a18f922a961fdeb42c1c8f1f80b425
Author: Florian Fainelli <f.fainelli at gmail.com>
AuthorDate: Wed Dec 22 14:26:02 2021 -0800

    broadcom-wl: Fix compilation with kernel 5.10
    
    This adds a few fixes for compiling against Linux 5.10:
    
    1. segment_eq() has been removed with upstream commit
       428e2976a5bf7e7f5554286d7a5a33b8147b106a ("uaccess: remove
       segment_eq") and can use uaccess_kernel() instead
    2. ioremap_nocache() is removed and is now an alias for ioremap() with
       upstream commit 4bdc0d676a643140bdf17dbf7eafedee3d496a3c ("remove
       ioremap_nocache and devm_ioremap_nocache")
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 .../patches/040-remove_last_rx_usage.patch         |  6 ++--
 .../patches/915-fix-wl_timer-for-4_15.patch        |  8 ++---
 .../patches/916-fix-compilation-for-5_4.patch      |  2 +-
 .../patches/917-fix-compilation-for-5_10.patch     | 42 ++++++++++++++++++++++
 4 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/package/kernel/broadcom-wl/patches/040-remove_last_rx_usage.patch b/package/kernel/broadcom-wl/patches/040-remove_last_rx_usage.patch
index 9f4b0b01b3..5c3e72a229 100644
--- a/package/kernel/broadcom-wl/patches/040-remove_last_rx_usage.patch
+++ b/package/kernel/broadcom-wl/patches/040-remove_last_rx_usage.patch
@@ -1,6 +1,6 @@
---- broadcom-wl-5.10.56.27.3/driver/wl_linux.c.orig	2018-01-13 18:25:14.944667645 +0100
-+++ broadcom-wl-5.10.56.27.3/driver/wl_linux.c	2018-01-13 18:25:25.836667888 +0100
-@@ -2762,7 +2762,6 @@
+--- a/driver/wl_linux.c
++++ b/driver/wl_linux.c
+@@ -2762,7 +2762,6 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rx
  	bcopy(oskb->data + D11_PHY_HDR_LEN, pdata, oskb->len - D11_PHY_HDR_LEN);
  
  	skb->dev = wl->monitor;
diff --git a/package/kernel/broadcom-wl/patches/915-fix-wl_timer-for-4_15.patch b/package/kernel/broadcom-wl/patches/915-fix-wl_timer-for-4_15.patch
index daf3160952..66eba968cf 100644
--- a/package/kernel/broadcom-wl/patches/915-fix-wl_timer-for-4_15.patch
+++ b/package/kernel/broadcom-wl/patches/915-fix-wl_timer-for-4_15.patch
@@ -1,6 +1,6 @@
 --- a/driver/wl_linux.c
 +++ b/driver/wl_linux.c
-@@ -235,7 +235,11 @@
+@@ -235,7 +235,11 @@ struct wl_info {
  
  };
  
@@ -12,7 +12,7 @@
  static void _wl_timer(wl_timer_t *t);
  
  #ifdef WLC_HIGH_ONLY
-@@ -2512,6 +2517,18 @@
+@@ -2512,6 +2516,18 @@ wl_timer_task(wl_task_t *task)
  }
  #endif /* WLC_HIGH_ONLY */
  
@@ -31,7 +31,7 @@
  static void
  wl_timer(ulong data)
  {
-@@ -2522,6 +2539,7 @@
+@@ -2522,6 +2538,7 @@ wl_timer(ulong data)
  	wl_schedule_task(t->wl, wl_timer_task, t);
  #endif /* WLC_HIGH_ONLY */
  }
@@ -39,7 +39,7 @@
  
  static void
  _wl_timer(wl_timer_t *t)
-@@ -2573,9 +2591,13 @@
+@@ -2573,9 +2590,13 @@ wl_init_timer(wl_info_t *wl, void (*fn)(
  
  	bzero(t, sizeof(wl_timer_t));
  
diff --git a/package/kernel/broadcom-wl/patches/916-fix-compilation-for-5_4.patch b/package/kernel/broadcom-wl/patches/916-fix-compilation-for-5_4.patch
index bc7b63df08..e59c95722c 100644
--- a/package/kernel/broadcom-wl/patches/916-fix-compilation-for-5_4.patch
+++ b/package/kernel/broadcom-wl/patches/916-fix-compilation-for-5_4.patch
@@ -1,6 +1,6 @@
 --- a/driver/wl_iw.c
 +++ b/driver/wl_iw.c
-@@ -112,10 +112,14 @@
+@@ -112,10 +112,14 @@ dev_wlc_ioctl(
  	ifr.ifr_data = (caddr_t) &ioc;
  
  	/* Must be up for virtually all useful ioctls */
diff --git a/package/kernel/broadcom-wl/patches/917-fix-compilation-for-5_10.patch b/package/kernel/broadcom-wl/patches/917-fix-compilation-for-5_10.patch
new file mode 100644
index 0000000000..98c0375be3
--- /dev/null
+++ b/package/kernel/broadcom-wl/patches/917-fix-compilation-for-5_10.patch
@@ -0,0 +1,42 @@
+Index: broadcom-wl-5.10.56.27.3/driver/wl_linux.c
+===================================================================
+--- broadcom-wl-5.10.56.27.3.orig/driver/wl_linux.c
++++ broadcom-wl-5.10.56.27.3/driver/wl_linux.c
+@@ -74,6 +74,10 @@
+ #error "No support for Kernel Rev <= 2.4.5, As the older kernel revs doesn't support Tasklets"
+ #endif
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++#define ioremap_nocache	ioremap
++#endif
++
+ typedef void wlc_info_t;
+ typedef void wlc_hw_info_t;
+ #include <wlc_pub.h>
+@@ -1915,7 +1919,11 @@ wl_ioctl(struct net_device *dev, struct
+ 	}
+ 
+ 	/* optimization for direct ioctl calls from kernel */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
+ 	if (segment_eq(get_fs(), KERNEL_DS))
++#else
++	if (uaccess_kernel())
++#endif
+ 		buf = ioc.buf;
+ 
+ 	else if (ioc.buf) {
+Index: broadcom-wl-5.10.56.27.3/driver/linux_osl.c
+===================================================================
+--- broadcom-wl-5.10.56.27.3.orig/driver/linux_osl.c
++++ broadcom-wl-5.10.56.27.3/driver/linux_osl.c
+@@ -34,6 +34,10 @@
+ #define OS_HANDLE_MAGIC		0x1234abcd	/* Magic # to recognise osh */
+ #define BCM_MEM_FILENAME_LEN 	24		/* Mem. filename length */
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
++#define ioremap_nocache	ioremap
++#endif
++
+ typedef struct bcm_mem_link {
+ 	struct bcm_mem_link *prev;
+ 	struct bcm_mem_link *next;




More information about the lede-commits mailing list