Skip to content

Commit

Permalink
broadcom-wl: Fix compilation with kernel 5.10
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ffainelli committed Jun 20, 2022
1 parent 22168ae commit cd3de51
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
@@ -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;
Expand Down
@@ -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 {

};

Expand All @@ -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 */

Expand All @@ -31,15 +31,15 @@
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 */
}
+#endif /* linux >= 4.15.0 */

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));

Expand Down
@@ -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 */
Expand Down
@@ -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;

0 comments on commit cd3de51

Please sign in to comment.