Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 92 lines 3.2 kB view raw
1From 24decccfadc0d95b973e6dd8d476ddde2f0a4b21 Mon Sep 17 00:00:00 2001 2From: Herman van Hazendonk <github.com@herrie.org> 3Date: Tue, 31 Mar 2020 17:09:55 +0200 4Subject: [PATCH 10/16] linuxPackages.broadcom_sta: fix build for kernel 5.6+ 5 6Use ioremap instead of ioremap_nocache and proc_ops instead of file_operations on Linux kernel 5.6 and above. 7 8Signed-off-by: Herman van Hazendonk <github.com@herrie.org> 9 10Source: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/commit/247307926e5540ad574a17c062c8da76990d056f 11--- 12 src/shared/linux_osl.c | 6 +++++- 13 src/wl/sys/wl_linux.c | 21 ++++++++++++++++++++- 14 2 files changed, 25 insertions(+), 2 deletions(-) 15 16diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c 17index 6157d18..dcfc075 100644 18--- a/src/shared/linux_osl.c 19+++ b/src/shared/linux_osl.c 20@@ -942,7 +942,11 @@ osl_getcycles(void) 21 void * 22 osl_reg_map(uint32 pa, uint size) 23 { 24- return (ioremap_nocache((unsigned long)pa, (unsigned long)size)); 25+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) 26+ return (ioremap((unsigned long)pa, (unsigned long)size)); 27+ #else 28+ return (ioremap_nocache((unsigned long)pa, (unsigned long)size)); 29+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */ 30 } 31 32 void 33diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c 34index 83b8859..646f1d9 100644 35--- a/src/wl/sys/wl_linux.c 36+++ b/src/wl/sys/wl_linux.c 37@@ -591,10 +591,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs, 38 } 39 wl->bcm_bustype = bustype; 40 41+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) 42+ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) { 43+ WL_ERROR(("wl%d: ioremap() failed\n", unit)); 44+ goto fail; 45+ } 46+ #else 47 if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) { 48 WL_ERROR(("wl%d: ioremap() failed\n", unit)); 49 goto fail; 50 } 51+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */ 52 53 wl->bar1_addr = bar1_addr; 54 wl->bar1_size = bar1_size; 55@@ -781,8 +788,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 56 if ((val & 0x0000ff00) != 0) 57 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 58 bar1_size = pci_resource_len(pdev, 2); 59+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) 60+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2), 61+ bar1_size); 62+ #else 63 bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2), 64 bar1_size); 65+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */ 66 wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev, 67 pdev->irq, bar1_addr, bar1_size); 68 69@@ -3363,12 +3375,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t 70 } 71 72 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) 73+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) 74+static const struct proc_ops wl_fops = { 75+ .proc_read = wl_proc_read, 76+ .proc_write = wl_proc_write, 77+}; 78+#else 79 static const struct file_operations wl_fops = { 80 .owner = THIS_MODULE, 81 .read = wl_proc_read, 82 .write = wl_proc_write, 83 }; 84-#endif 85+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */ 86+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */ 87 88 static int 89 wl_reg_proc_entry(wl_info_t *wl) 90-- 912.45.1 92