From 2781746c77672abdb858b0fda3df70420b35e860 Mon Sep 17 00:00:00 2001 From: Pushkar Singh Date: Mon, 5 Feb 2024 12:58:28 +0530 Subject: [PATCH 1/2] Fix compilation issues on Rocky Linux 9.x --- drivers/dahdi/dahdi-base.c | 7 ------- drivers/dahdi/voicebus/vpmoct.h | 7 ------- drivers/dahdi/wcaxx-base.c | 7 ------- drivers/dahdi/wct4xxp/base.c | 7 ------- drivers/dahdi/wct4xxp/vpm450m.c | 7 ------- drivers/dahdi/wctc4xxp/base.c | 8 -------- drivers/dahdi/wctdm24xxp/base.c | 7 ------- drivers/dahdi/wcte13xp-base.c | 7 ------- drivers/dahdi/wcte43x-base.c | 7 ------- drivers/dahdi/wcxb.c | 7 ------- drivers/dahdi/wcxb_spi.h | 3 +++ include/dahdi/kernel.h | 16 ++++++++++++++++ 12 files changed, 19 insertions(+), 71 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 9db619a3..2b4d7188 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -82,13 +82,6 @@ #include "hpec/hpec_user.h" -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #if defined(EMPULSE) && defined(EMFLASH) #error "You cannot define both EMPULSE and EMFLASH" #endif diff --git a/drivers/dahdi/voicebus/vpmoct.h b/drivers/dahdi/voicebus/vpmoct.h index 2cf18b64..b4ca6580 100644 --- a/drivers/dahdi/voicebus/vpmoct.h +++ b/drivers/dahdi/voicebus/vpmoct.h @@ -30,13 +30,6 @@ #include #include "dahdi/kernel.h" -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #define VPMOCT_FIRM_HEADER_LEN 32 #define VPMOCT_BOOT_RAM_LEN 128 #define VPMOCT_FLASH_BUF_SECTIONS 4 diff --git a/drivers/dahdi/wcaxx-base.c b/drivers/dahdi/wcaxx-base.c index eacfdda7..07176192 100644 --- a/drivers/dahdi/wcaxx-base.c +++ b/drivers/dahdi/wcaxx-base.c @@ -34,13 +34,6 @@ #include #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) /* Define this if you would like to load the modules in parallel. While this * can speed up loads when multiple cards handled by this driver are installed, diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c index 2a2d4de1..68f242e3 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -42,13 +42,6 @@ #include #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #include #include "wct4xxp.h" diff --git a/drivers/dahdi/wct4xxp/vpm450m.c b/drivers/dahdi/wct4xxp/vpm450m.c index 9ccfd53f..38c68ab2 100644 --- a/drivers/dahdi/wct4xxp/vpm450m.c +++ b/drivers/dahdi/wct4xxp/vpm450m.c @@ -29,13 +29,6 @@ #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #include "vpm450m.h" #include diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c index 9c1bc56c..d787cb93 100644 --- a/drivers/dahdi/wctc4xxp/base.c +++ b/drivers/dahdi/wctc4xxp/base.c @@ -40,14 +40,6 @@ #include #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) #include #endif /* 4.11.0 */ diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 1c3e2e03..507ab1d9 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -54,13 +54,6 @@ Tx Gain - W/Pre-Emphasis: -23.99 to 0.00 db #include #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) /* Define this if you would like to load the modules in parallel. While this * can speed up loads when multiple cards handled by this driver are installed, diff --git a/drivers/dahdi/wcte13xp-base.c b/drivers/dahdi/wcte13xp-base.c index fbf17f0e..d4241446 100644 --- a/drivers/dahdi/wcte13xp-base.c +++ b/drivers/dahdi/wcte13xp-base.c @@ -36,13 +36,6 @@ #include #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #include "wct4xxp/wct4xxp.h" /* For certain definitions */ #include "wcxb.h" #include "wcxb_spi.h" diff --git a/drivers/dahdi/wcte43x-base.c b/drivers/dahdi/wcte43x-base.c index d30ce613..f2c511e9 100644 --- a/drivers/dahdi/wcte43x-base.c +++ b/drivers/dahdi/wcte43x-base.c @@ -43,13 +43,6 @@ #include #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) diff --git a/drivers/dahdi/wcxb.c b/drivers/dahdi/wcxb.c index 228c8cce..d6318e23 100644 --- a/drivers/dahdi/wcxb.c +++ b/drivers/dahdi/wcxb.c @@ -36,13 +36,6 @@ #include -/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) -#include -#else -#include -#endif - #include "wcxb.h" #include "wcxb_spi.h" #include "wcxb_flash.h" diff --git a/drivers/dahdi/wcxb_spi.h b/drivers/dahdi/wcxb_spi.h index 9c1e3e27..b826f0f5 100644 --- a/drivers/dahdi/wcxb_spi.h +++ b/drivers/dahdi/wcxb_spi.h @@ -29,6 +29,9 @@ /* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) #include +#elif defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include #else #include #endif diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index ab129a8f..e095c9fd 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -62,6 +62,16 @@ #define netif_napi_add netif_napi_add_weight #endif +/* Linux kernel 5.16 and greater has removed user-space headers from the kernel include path */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) +#include +#elif defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#else +#include +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) #include #include @@ -1552,6 +1562,12 @@ static inline void *PDE_DATA(const struct inode *inode) #endif #endif +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#define netif_napi_add netif_napi_add_weight +#define PDE_DATA(i) pde_data(i) +#endif + #ifndef TIMER_DATA_TYPE #define TIMER_DATA_TYPE struct timer_list * #endif From d2563faf053da31e1329e7313339669f31c989da Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 20 Mar 2024 19:48:33 +0100 Subject: [PATCH 2/2] dahdi_echocan_mg2: rename ABS define to PARA_ABS Rename ABS define to PARA_ABS to fix compilation error with mips 24kc arch. This target define in his ASM header a similar define ABS that cause conflicts and redefinition error for this driver. Rename ABS to PARA_ABS to better suite the usage as it's abs usage with value decremented by one if it's the max negative int. Signed-off-by: Christian Marangi --- drivers/dahdi/dahdi_echocan_mg2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dahdi/dahdi_echocan_mg2.c b/drivers/dahdi/dahdi_echocan_mg2.c index 4038ff27..9d455e86 100644 --- a/drivers/dahdi/dahdi_echocan_mg2.c +++ b/drivers/dahdi/dahdi_echocan_mg2.c @@ -44,7 +44,7 @@ static int debug; static int aggressive; -#define ABS(a) abs(a!=-32768?a:-32767) +#define PARA_ABS(a) abs(a!=-32768?a:-32767) #define RESTORE_COEFFS {\ int x;\ @@ -464,9 +464,9 @@ static inline short sample_update(struct ec_pvt *pvt, short iref, short isig) RESTORE_COEFFS; } - sign_error = ABS(rs) - ABS(isig); + sign_error = PARA_ABS(rs) - PARA_ABS(isig); - if (ABS(sign_error) > MAX_SIGN_ERROR) + if (PARA_ABS(sign_error) > MAX_SIGN_ERROR) { rs = 0; RESTORE_COEFFS;