1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-25 06:34:10 +00:00

Merge pull request #634 from Cody-Chen/4.3.21-fix_kernel

4.3.21: add support for >4.14 kernel
This commit is contained in:
Christian Bremvåg 2020-04-28 12:44:07 +02:00 committed by GitHub
commit fd65798f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 7 deletions

View File

@ -202,7 +202,11 @@ typedef enum _RT_SPINLOCK_TYPE{
typedef struct rtl8192cd_priv *prtl8192cd_priv; typedef struct rtl8192cd_priv *prtl8192cd_priv;
typedef struct stat_info STA_INFO_T,*PSTA_INFO_T; typedef struct stat_info STA_INFO_T,*PSTA_INFO_T;
#if defined (LINUX_VERSION_CODE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
typedef struct legacy_timer_emu RT_TIMER, *PRT_TIMER;
#else
typedef struct timer_list RT_TIMER, *PRT_TIMER; typedef struct timer_list RT_TIMER, *PRT_TIMER;
#endif
typedef void * RT_TIMER_CALL_BACK; typedef void * RT_TIMER_CALL_BACK;
#ifdef CONFIG_PCI_HCI #ifdef CONFIG_PCI_HCI
@ -278,7 +282,11 @@ typedef enum _RT_SPINLOCK_TYPE{
#define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
#endif #endif
#if defined (LINUX_VERSION_CODE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
typedef struct legacy_timer_emu RT_TIMER, *PRT_TIMER;
#else
typedef struct timer_list RT_TIMER, *PRT_TIMER; typedef struct timer_list RT_TIMER, *PRT_TIMER;
#endif
typedef void * RT_TIMER_CALL_BACK; typedef void * RT_TIMER_CALL_BACK;
#define STA_INFO_T struct sta_info #define STA_INFO_T struct sta_info
#define PSTA_INFO_T struct sta_info * #define PSTA_INFO_T struct sta_info *

View File

@ -325,7 +325,11 @@ extern void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc);
__inline static unsigned char _cancel_timer_ex(_timer *ptimer) __inline static unsigned char _cancel_timer_ex(_timer *ptimer)
{ {
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
return del_timer_sync(ptimer); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
return del_timer_sync(&ptimer->t);
#else
return del_timer_sync(ptimer);
#endif
#endif #endif
#ifdef PLATFORM_FREEBSD #ifdef PLATFORM_FREEBSD
_cancel_timer(ptimer,0); _cancel_timer(ptimer,0);

View File

@ -144,7 +144,16 @@
#else #else
typedef struct semaphore _mutex; typedef struct semaphore _mutex;
#endif #endif
typedef struct timer_list _timer;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
typedef struct legacy_timer_emu {
struct timer_list t;
void (*function)(unsigned long);
unsigned long data;
} _timer;
#else
typedef struct timer_list _timer; typedef struct timer_list _timer;
#endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
struct __queue { struct __queue {
struct list_head queue; struct list_head queue;
@ -277,23 +286,45 @@ __inline static void rtw_list_delete(_list *plist)
#define RTW_TIMER_HDL_ARGS void *FunctionContext #define RTW_TIMER_HDL_ARGS void *FunctionContext
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
static void legacy_timer_emu_func(struct timer_list *t)
{
struct legacy_timer_emu *lt = from_timer(lt, t, t);
lt->function(lt->data);
}
#endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx) __inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx)
{ {
//setup_timer(ptimer, pfunc,(u32)cntx); //setup_timer(ptimer, pfunc,(u32)cntx);
ptimer->function = pfunc; ptimer->function = pfunc;
ptimer->data = (unsigned long)cntx; ptimer->data = (unsigned long)cntx;
init_timer(ptimer);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
timer_setup(&ptimer->t, legacy_timer_emu_func, 0);
#else
init_timer(ptimer); init_timer(ptimer);
#endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
} }
__inline static void _set_timer(_timer *ptimer,u32 delay_time) __inline static void _set_timer(_timer *ptimer,u32 delay_time)
{ {
mod_timer(ptimer , (jiffies+(delay_time*HZ/1000))); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
mod_timer(&ptimer->t, (jiffies+(delay_time * HZ / 1000)));
#else
mod_timer(ptimer , (jiffies+(delay_time*HZ/1000))); mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
#endif //(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
} }
__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled) __inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
{ {
del_timer_sync(ptimer); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
*bcancelled= _TRUE;//TRUE ==1; FALSE==0 *bcancelled = del_timer_sync(&ptimer->t) == 1 ? 1 : 0;
#else
*bcancelled = del_timer_sync(ptimer) == 1 ? 1 : 0;
#endif
} }