]> git.pld-linux.org Git - packages/wl.git/commitdiff
- fix building with kernel 5.10 auto/th/wl-6.30.223.271-12
authorJan Rękorajski <baggins@pld-linux.org>
Thu, 24 Dec 2020 21:04:14 +0000 (22:04 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Thu, 24 Dec 2020 21:04:14 +0000 (22:04 +0100)
- fix bad call since kernel 4.14
- rel 12

kernel-4.14.patch [new file with mode: 0644]
kernel-5.10.patch [new file with mode: 0644]
linux-5.1.patch [deleted file]
linux-5.9.patch [deleted file]
wl.spec

diff --git a/kernel-4.14.patch b/kernel-4.14.patch
new file mode 100644 (file)
index 0000000..44befc1
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/src/shared/linux_osl.c
++++ b/src/shared/linux_osl.c
+@@ -1080,7 +1080,11 @@ osl_os_get_image_block(char *buf, int le
+       if (!image)
+               return 0;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
++      rdlen = kernel_read(fp, buf, len, &fp->f_pos);
++#else
+       rdlen = kernel_read(fp, fp->f_pos, buf, len);
++#endif
+       if (rdlen > 0)
+               fp->f_pos += rdlen;
diff --git a/kernel-5.10.patch b/kernel-5.10.patch
new file mode 100644 (file)
index 0000000..bb5d723
--- /dev/null
@@ -0,0 +1,202 @@
+From: Joan Bruguera <joanbrugueram@gmail.com>
+Date: Sun, 13 Sep 2020 07:33:32 +0200
+Subject: Get rid of get_fs/set_fs calls in Broadcom WL driver.
+Origin: https://gist.github.com/joanbm/5c640ac074d27fd1d82c74a5b67a1290
+
+Fixes linux-next where get_fs/set_fs is already removed for some architectures.
+
+NB: Some checks in wlc_ioctl_internal are likely superfluous,
+    but I'm not familiar enough with the driver to remove them with confidence.
+
+See also: https://lwn.net/Articles/722267/
+          https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/arch/x86/include/asm/uaccess.h?h=next-20200911&id=47058bb54b57962b3958a936ddbc59355e4c5504
+          https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/linux/uaccess.h?h=next-20200911&id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5
+
+Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
+---
+ src/wl/sys/wl_cfg80211_hybrid.c | 29 ++-----------------------
+ src/wl/sys/wl_iw.c              | 25 ++--------------------
+ src/wl/sys/wl_linux.c           | 40 ++++++++++++++++++++++++++++++-----
+ src/wl/sys/wl_linux.h           |  2 ++
+ src/wl/sys/wlc_pub.h            |  1 +
+ 5 files changed, 42 insertions(+), 55 deletions(-)
+
+diff -rup a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
+--- a/src/wl/sys/wl_cfg80211_hybrid.c  2020-11-13 08:38:56.883599679 +0100
++++ b/src/wl/sys/wl_cfg80211_hybrid.c  2020-11-13 08:42:07.944320760 +0100
+@@ -38,6 +38,7 @@
+ #include <wlioctl.h>
+ #include <proto/802.11.h>
+ #include <wl_cfg80211_hybrid.h>
++#include <wl_linux.h>
+ #define EVENT_TYPE(e) dtoh32((e)->event_type)
+ #define EVENT_FLAGS(e) dtoh16((e)->flags)
+@@ -436,30 +437,8 @@ static void key_endian_to_host(struct wl
+ static s32
+ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
+ {
+-      struct ifreq ifr;
+-      struct wl_ioctl ioc;
+-      mm_segment_t fs;
+-      s32 err = 0;
+-
+       BUG_ON(len < sizeof(int));
+-
+-      memset(&ioc, 0, sizeof(ioc));
+-      ioc.cmd = cmd;
+-      ioc.buf = arg;
+-      ioc.len = len;
+-      strcpy(ifr.ifr_name, dev->name);
+-      ifr.ifr_data = (caddr_t)&ioc;
+-
+-      fs = get_fs();
+-      set_fs(get_ds());
+-#if defined(WL_USE_NETDEV_OPS)
+-      err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#else
+-      err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#endif
+-      set_fs(fs);
+-
+-      return err;
++      return wlc_ioctl_internal(dev, cmd, arg, len);
+ }
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+diff -rup a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
+--- a/src/wl/sys/wl_iw.c       2020-11-13 08:38:56.891599715 +0100
++++ b/src/wl/sys/wl_iw.c       2020-11-13 08:40:14.803914270 +0100
+@@ -37,6 +37,7 @@ typedef const struct si_pub  si_t;
+ #include <wl_dbg.h>
+ #include <wl_iw.h>
++#include <wl_linux.h>
+ extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
+       uint32 reason, char* stringBuf, uint buflen);
+@@ -106,29 +107,7 @@ dev_wlc_ioctl(
+       int len
+ )
+ {
+-      struct ifreq ifr;
+-      wl_ioctl_t ioc;
+-      mm_segment_t fs;
+-      int ret;
+-
+-      memset(&ioc, 0, sizeof(ioc));
+-      ioc.cmd = cmd;
+-      ioc.buf = arg;
+-      ioc.len = len;
+-
+-      strcpy(ifr.ifr_name, dev->name);
+-      ifr.ifr_data = (caddr_t) &ioc;
+-
+-      fs = get_fs();
+-      set_fs(get_ds());
+-#if defined(WL_USE_NETDEV_OPS)
+-      ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#else
+-      ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
+-#endif
+-      set_fs(fs);
+-
+-      return ret;
++      return wlc_ioctl_internal(dev, cmd, arg, len);
+ }
+ static int
+diff -rup a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
+--- a/src/wl/sys/wl_linux.c    2020-11-13 08:39:05.659639371 +0100
++++ b/src/wl/sys/wl_linux.c    2020-11-13 08:40:14.803914270 +0100
+@@ -1649,10 +1649,7 @@ wl_ioctl(struct net_device *dev, struct
+               goto done2;
+       }
+-      if (segment_eq(get_fs(), KERNEL_DS))
+-              buf = ioc.buf;
+-
+-      else if (ioc.buf) {
++      if (ioc.buf) {
+               if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
+                       bcmerror = BCME_NORESOURCE;
+                       goto done2;
+@@ -1673,7 +1670,7 @@ wl_ioctl(struct net_device *dev, struct
+       WL_UNLOCK(wl);
+ done1:
+-      if (ioc.buf && (ioc.buf != buf)) {
++      if (ioc.buf) {
+               if (copy_to_user(ioc.buf, buf, ioc.len))
+                       bcmerror = BCME_BADADDR;
+               MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
+@@ -1683,6 +1680,39 @@ done2:
+       ASSERT(VALID_BCMERROR(bcmerror));
+       if (bcmerror != 0)
+               wl->pub->bcmerror = bcmerror;
++      return (OSL_ERROR(bcmerror));
++}
++
++int
++wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
++{
++      wl_info_t *wl;
++      wl_if_t *wlif;
++      int bcmerror;
++
++      if (!dev)
++              return -ENETDOWN;
++
++      wl = WL_INFO(dev);
++      wlif = WL_DEV_IF(dev);
++      if (wlif == NULL || wl == NULL || wl->dev == NULL)
++              return -ENETDOWN;
++
++      bcmerror = 0;
++
++      WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
++
++      WL_LOCK(wl);
++      if (!capable(CAP_NET_ADMIN)) {
++              bcmerror = BCME_EPERM;
++      } else {
++              bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
++      }
++      WL_UNLOCK(wl);
++
++      ASSERT(VALID_BCMERROR(bcmerror));
++      if (bcmerror != 0)
++              wl->pub->bcmerror = bcmerror;
+       return (OSL_ERROR(bcmerror));
+ }
+diff -rup a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
+--- a/src/wl/sys/wl_linux.h    2015-09-19 00:47:30.000000000 +0200
++++ b/src/wl/sys/wl_linux.h    2020-11-13 08:40:14.803914270 +0100
+@@ -22,6 +22,7 @@
+ #define _wl_linux_h_
+ #include <wlc_types.h>
++#include <wlc_pub.h>
+ typedef struct wl_timer {
+       struct timer_list       timer;
+@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void
+ extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
+ extern void wl_free(wl_info_t *wl);
+ extern int  wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
++extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
+ extern struct net_device * wl_netdev_get(wl_info_t *wl);
+ #endif 
+diff -rup a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h
+--- a/src/wl/sys/wlc_pub.h     2015-09-19 00:47:30.000000000 +0200
++++ b/src/wl/sys/wlc_pub.h     2020-11-13 08:40:14.803914270 +0100
+@@ -24,6 +24,7 @@
+ #include <wlc_types.h>
+ #include <wlc_utils.h>
++#include <siutils.h>
+ #include "proto/802.11.h"
+ #include "proto/bcmevent.h"
diff --git a/linux-5.1.patch b/linux-5.1.patch
deleted file mode 100644 (file)
index 0e5436c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- wl-6.30.223.271/src/wl/sys/wl_cfg80211_hybrid.c~   2019-05-07 19:17:44.000000000 +0200
-+++ wl-6.30.223.271/src/wl/sys/wl_cfg80211_hybrid.c    2019-05-07 19:19:00.311600063 +0200
-@@ -464,7 +464,11 @@
-       ifr.ifr_data = (caddr_t)&ioc;
-       fs = get_fs();
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
-+      set_fs(KERNEL_DS);
-+#else
-       set_fs(get_ds());
-+#endif
- #if defined(WL_USE_NETDEV_OPS)
-       err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
- #else
diff --git a/linux-5.9.patch b/linux-5.9.patch
deleted file mode 100644 (file)
index 1e50791..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- wl-6.30.223.271/wl/src/wl/sys/wl_linux.c~  2020-10-21 08:40:00.000000000 +0200
-+++ wl-6.30.223.271/wl/src/wl/sys/wl_linux.c   2020-10-21 08:41:58.566248630 +0200
-@@ -1662,7 +1662,11 @@
-               goto done2;
-       }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
-+      if (uaccess_kernel())
-+#else
-       if (segment_eq(get_fs(), KERNEL_DS))
-+#endif
-               buf = ioc.buf;
-       else if (ioc.buf) {
diff --git a/wl.spec b/wl.spec
index 204537329a41e07023bac3bb3bcf1da86424615b..33ab3dd320c4a87c0ae535c61f743f6b1578a80e 100644 (file)
--- a/wl.spec
+++ b/wl.spec
@@ -18,7 +18,7 @@ exit 1
 
 %define                _duplicate_files_terminate_build        0
 
-%define                rel     11
+%define                rel     12
 %define                pname   wl
 %define                file_ver        %(echo %{version} | tr . _)
 Summary:       Broadcom 802.11 a/b/g/n hybrid Linux networking device driver
@@ -44,9 +44,9 @@ Patch5:               17-fix-kernel-warnings.patch
 Patch6:                linux-4.11.patch
 Patch7:                linux-4.12.patch
 Patch8:                008-linux415.patch
-Patch9:                linux-5.1.patch
+Patch9:                kernel-4.14.patch
 Patch10:       linux-5.6.patch
-Patch11:       linux-5.9.patch
+Patch11:       kernel-5.10.patch
 URL:           http://www.broadcom.com/support/802.11
 BuildRequires: rpmbuild(macros) >= 1.701
 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
@@ -138,7 +138,7 @@ EOF\
 %patch8 -p1
 %patch9 -p1
 %patch10 -p2
-%patch11 -p2
+%patch11 -p1
 
 mkdir wl
 mv lib src Makefile wl/
This page took 0.11001 seconds and 4 git commands to generate.