From 210c040a99f05bf7cc8997cab03707506fa0dbc9 Mon Sep 17 00:00:00 2001 From: Pushkar Singh Date: Thu, 4 Apr 2024 01:06:28 +0530 Subject: [PATCH] fixing rocky linux compilation issues --- drivers/dahdi/dahdi-base.c | 12 ++++++++++++ drivers/dahdi/voicebus/vpmoct.h | 12 ++++++++++++ drivers/dahdi/wcaxx-base.c | 12 ++++++++++++ drivers/dahdi/wct4xxp/base.c | 12 ++++++++++++ drivers/dahdi/wct4xxp/vpm450m.c | 12 ++++++++++++ drivers/dahdi/wctc4xxp/base.c | 12 ++++++++++++ drivers/dahdi/wctdm24xxp/base.c | 12 ++++++++++++ drivers/dahdi/wcte13xp-base.c | 12 ++++++++++++ drivers/dahdi/wcte43x-base.c | 12 ++++++++++++ drivers/dahdi/wcxb.c | 12 ++++++++++++ drivers/dahdi/wcxb_spi.h | 4 +++- include/dahdi/kernel.h | 12 ++---------- 12 files changed, 125 insertions(+), 11 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 2b4d7188..b96f72b1 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -82,6 +82,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 b4ca6580..3d1f7ef3 100644 --- a/drivers/dahdi/voicebus/vpmoct.h +++ b/drivers/dahdi/voicebus/vpmoct.h @@ -30,6 +30,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 07176192..5d768093 100644 --- a/drivers/dahdi/wcaxx-base.c +++ b/drivers/dahdi/wcaxx-base.c @@ -34,6 +34,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 68f242e3..851108fb 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -42,6 +42,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#else +#include +#endif + #include #include "wct4xxp.h" diff --git a/drivers/dahdi/wct4xxp/vpm450m.c b/drivers/dahdi/wct4xxp/vpm450m.c index 38c68ab2..4ae016b6 100644 --- a/drivers/dahdi/wct4xxp/vpm450m.c +++ b/drivers/dahdi/wct4xxp/vpm450m.c @@ -29,6 +29,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#else +#include +#endif + #include "vpm450m.h" #include diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c index d787cb93..fc71c987 100644 --- a/drivers/dahdi/wctc4xxp/base.c +++ b/drivers/dahdi/wctc4xxp/base.c @@ -40,6 +40,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 507ab1d9..5e845e26 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -54,6 +54,18 @@ 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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 d4241446..5669ff45 100644 --- a/drivers/dahdi/wcte13xp-base.c +++ b/drivers/dahdi/wcte13xp-base.c @@ -36,6 +36,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 f2c511e9..71a1c67b 100644 --- a/drivers/dahdi/wcte43x-base.c +++ b/drivers/dahdi/wcte43x-base.c @@ -43,6 +43,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 d6318e23..d57b0997 100644 --- a/drivers/dahdi/wcxb.c +++ b/drivers/dahdi/wcxb.c @@ -36,6 +36,18 @@ #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 +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) +#include +#endif +#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 b826f0f5..655a03d0 100644 --- a/drivers/dahdi/wcxb_spi.h +++ b/drivers/dahdi/wcxb_spi.h @@ -29,9 +29,11 @@ /* 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) && \ +#elif defined RHEL_RELEASE_VERSION +#if defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && \ RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,1) #include +#endif #else #include #endif diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index e095c9fd..8f83283d 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -62,16 +62,6 @@ #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 @@ -1562,11 +1552,13 @@ static inline void *PDE_DATA(const struct inode *inode) #endif #endif +#ifdef RHEL_RELEASE_VERSION #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 +#endif #ifndef TIMER_DATA_TYPE #define TIMER_DATA_TYPE struct timer_list *