broadcom-wl: Fix compilation with kernel 5.10
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 22 Dec 2021 22:26:02 +0000 (14:26 -0800)
committerFlorian Fainelli <f.fainelli@gmail.com>
Mon, 20 Jun 2022 21:29:12 +0000 (14:29 -0700)
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@gmail.com>
package/kernel/broadcom-wl/patches/040-remove_last_rx_usage.patch
package/kernel/broadcom-wl/patches/915-fix-wl_timer-for-4_15.patch
package/kernel/broadcom-wl/patches/916-fix-compilation-for-5_4.patch
package/kernel/broadcom-wl/patches/917-fix-compilation-for-5_10.patch [new file with mode: 0644]

index 9f4b0b01b3ab58eed76226bd7f33b7351ca14198..5c3e72a229a80321c78b9655bf8870ab72d9bb83 100644 (file)
@@ -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;
index daf3160952eb70f30b64963bd25e7af1029103ec..66eba968cf623b38744628401c1baf40ea229fc5 100644 (file)
@@ -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));
  
index bc7b63df0831fbf49db0106ec66521fd0a870f02..e59c95722c783f8c10305a08e419ad63a2685246 100644 (file)
@@ -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 (file)
index 0000000..98c0375
--- /dev/null
@@ -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;