From c4db8416ff2c9ace3c79a71ccfa3d942daadd093 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Sun, 30 Oct 2022 13:55:54 +0100 Subject: [PATCH] package/dahdi-linux: fix build with kernel >= 5.18 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following build failure with kernel >= 5.18 raised since bump to version 3.2.0 in commit 6cbfed0dbf43c5e04e3cc543b642e3c996bfed97: /home/autobuild/autobuild/instance-0/output-1/build/dahdi-linux-3.2.0/drivers/dahdi/wct4xxp/base.c: In function ‘t4_allocate_buffers’: /home/autobuild/autobuild/instance-0/output-1/build/dahdi-linux-3.2.0/drivers/dahdi/wct4xxp/base.c:3864:17: error: implicit declaration of function ‘pci_alloc_consistent’ [-Werror=implicit-function-declaration] 3864 | alloc = pci_alloc_consistent(wc->dev, numbufs * T4_BASE_SIZE(wc) * 2, | ^~~~~~~~~~~~~~~~~~~~ Fixes: - http://autobuild.buildroot.org/results/ddacd807dddeb1649e957264ac57bba27d9bb463 Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni --- ...lation-issues-on-linux-kernel-5-18-0.patch | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 package/dahdi-linux/0003-Fixed-compilation-issues-on-linux-kernel-5-18-0.patch diff --git a/package/dahdi-linux/0003-Fixed-compilation-issues-on-linux-kernel-5-18-0.patch b/package/dahdi-linux/0003-Fixed-compilation-issues-on-linux-kernel-5-18-0.patch new file mode 100644 index 0000000000..a896def375 --- /dev/null +++ b/package/dahdi-linux/0003-Fixed-compilation-issues-on-linux-kernel-5-18-0.patch @@ -0,0 +1,58 @@ +From dbb43101c2a9205b67223b006bf75c29ebadced9 Mon Sep 17 00:00:00 2001 +From: Pushkar Singh +Date: Tue, 2 Aug 2022 19:40:00 +0530 +Subject: [PATCH] Fixed compilation issues on linux kernel >= 5.18.0 + +With kernel 5.18 and higher +PCI: Remove the deprecated "pci-dma-compat.h" API + +The commit will make sure to impplement pci dma related api's +[Retrieved from: +https://github.com/asterisk/dahdi-linux/commit/dbb43101c2a9205b67223b006bf75c29ebadced9] +Signed-off-by: Fabrice Fontaine +--- + include/dahdi/kernel.h | 31 +++++++++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h +index ed81e9e3..35e93bc4 100644 +--- a/include/dahdi/kernel.h ++++ b/include/dahdi/kernel.h +@@ -58,6 +58,37 @@ + + #include + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) ++#include ++#include ++ ++static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle) ++{ ++ return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); ++} ++ ++static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle) ++{ ++ dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle); ++} ++ ++static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) ++{ ++ return dma_map_single(&hwdev->dev, ptr, size, (enum dma_data_direction)direction); ++} ++ ++static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction) ++{ ++ dma_unmap_single(&hwdev->dev, dma_addr, size, (enum dma_data_direction)direction); ++} ++ ++static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) ++{ ++ return dma_set_mask(&dev->dev, mask); ++} ++ ++#endif ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) + #define HAVE_NET_DEVICE_OPS + #endif