Article 5C9EZ Broadcom BCM43142 in 2021

Broadcom BCM43142 in 2021

by
yars
from LinuxQuestions.org on (#5C9EZ)
Hello, first, happy New Year, hope covid will go away in 2021.
Then, I have a laptop -- Lenovo G580 (yes, this is older machine), that laptop uses this combined Wi-Fi+Bluetooth module:
Code:04:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43142 802.11b/g/n [14e4:4365] (rev 01)
Subsystem: Lenovo BCM43142 802.11b/g/n [17aa:0611]I'm running Slackware64-current with latest updates (Wed Dec 30 21:56:42 UTC 2020). In this batch, we also have a new kernel -- 5.10.4, and I can't build broadcom-sta. Problem is in part of broadcom-sta code:
Code:make: Entering directory '/usr/src/linux-5.10.4'
CFG80211 API is prefered for this kernel version
/tmp/SBo/broadcom-sta-6.30.223.271/Makefile:85: Neither CFG80211 nor Wireless Extension is enabled in kernel
make: Leaving directory '/usr/src/linux-5.10.4'
make: Entering directory '/usr/src/linux-5.10.4'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
CC [M] /tmp/SBo/broadcom-sta-6.30.223.271/src/shared/linux_osl.o
/tmp/SBo/broadcom-sta-6.30.223.271/src/shared/linux_osl.c: In function 'osl_reg_map':
/tmp/SBo/broadcom-sta-6.30.223.271/src/shared/linux_osl.c:949:10: error: implicit declaration of function 'ioremap_nocache'; did you mean 'ioremap_cache'? [-Werror=implicit-function-declaration]
949 | return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
| ^~~~~~~~~~~~~~~
| ioremap_cache
/tmp/SBo/broadcom-sta-6.30.223.271/src/shared/linux_osl.c:949:10: warning: returning 'int' from a function with return type 'void *' makes pointer from integer without a cast [-Wint-conversion]
949 | return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:279: /tmp/SBo/broadcom-sta-6.30.223.271/src/shared/linux_osl.o] Error 1
make: *** [Makefile:1805: /tmp/SBo/broadcom-sta-6.30.223.271] Error 2
make: Leaving directory '/usr/src/linux-5.10.4'I bothered this, just make this pach:
Code:diff -urN a/src/shared/linux_osl.c b/src/shared/linux_osl.c
--- a/src/shared/linux_osl.c 2015-09-19 01:47:30.000000000 +0300
+++ b/src/shared/linux_osl.c 2020-12-31 17:14:38.849844398 +0300
@@ -942,7 +942,11 @@
void *
osl_reg_map(uint32 pa, uint size)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
+ return (ioremap((unsigned long)pa, (unsigned long)size));
+#endif
}

void
diff -urN a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
--- a/src/wl/sys/wl_linux.c 2015-09-19 01:47:30.000000000 +0300
+++ b/src/wl/sys/wl_linux.c 2020-12-31 18:29:00.378539789 +0300
@@ -582,9 +582,15 @@
}
wl->bcm_bustype = bustype;

+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
WL_ERROR(("wl%d: ioremap() failed\n", unit));
goto fail;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
+ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
+ WL_ERROR(("wl%d: ioremap() failed\n", unit));
+ goto fail;
+#endif
}

wl->bar1_addr = bar1_addr;
@@ -772,8 +778,14 @@
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
bar1_size = pci_resource_len(pdev, 2);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
bar1_size);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
+ bar1_size);
+#endif
+
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
pdev->irq, bar1_addr, bar1_size);But now, I get this:
Code:make: Entering directory '/usr/src/linux-5.10.4'
CFG80211 API is prefered for this kernel version
/tmp/SBo/broadcom-sta-6.30.223.271/Makefile:85: Neither CFG80211 nor Wireless Extension is enabled in kernel
make: Leaving directory '/usr/src/linux-5.10.4'
make: Entering directory '/usr/src/linux-5.10.4'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
CC [M] /tmp/SBo/broadcom-sta-6.30.223.271/src/shared/linux_osl.o
CC [M] /tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.o
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c: In function 'wl_pci_probe':
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:784:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
784 | if ((val & 0x0000ff00) != 0)
| ^~
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:786:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
786 | bar1_size = pci_resource_len(pdev, 2);
| ^~~~~~~~~
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c: In function 'wl_ioctl':
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:1664:6: error: implicit declaration of function 'segment_eq' [-Werror=implicit-function-declaration]
1664 | if (segment_eq(get_fs(), KERNEL_DS))
| ^~~~~~~~~~
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:1664:17: error: implicit declaration of function 'get_fs'; did you mean 'sget_fc'? [-Werror=implicit-function-declaration]
1664 | if (segment_eq(get_fs(), KERNEL_DS))
| ^~~~~~
| sget_fc
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:1664:27: error: 'KERNEL_DS' undeclared (first use in this function); did you mean 'KERNFS_NS'?
1664 | if (segment_eq(get_fs(), KERNEL_DS))
| ^~~~~~~~~
| KERNFS_NS
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:1664:27: note: each undeclared identifier is reported only once for each function it appears in
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c: In function 'wl_reg_proc_entry':
/tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:3383:58: error: passing argument 4 of 'proc_create_data' from incompatible pointer type [-Werror=incompatible-pointer-types]
3383 | if ((wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_fops, wl)) == NULL) {
| ^~~~~~~~
| |
| const struct file_operations *
In file included from /tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.c:38:
./include/linux/proc_fs.h:106:13: note: expected 'const struct proc_ops *' but argument is of type 'const struct file_operations *'
106 | const struct proc_ops *,
| ^~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:279: /tmp/SBo/broadcom-sta-6.30.223.271/src/wl/sys/wl_linux.o] Error 1
make: *** [Makefile:1805: /tmp/SBo/broadcom-sta-6.30.223.271] Error 2
make: Leaving directory '/usr/src/linux-5.10.4'I'm not so famliar with sofware developing processes, so I need a direction.latest?d=yIl2AUoC8zA latest?i=TtqgdgnavZY:F0jlvCiUkUs:F7zBnMy latest?i=TtqgdgnavZY:F0jlvCiUkUs:V_sGLiP latest?d=qj6IDK7rITs latest?i=TtqgdgnavZY:F0jlvCiUkUs:gIN9vFwTtqgdgnavZY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments