File rtl8812AU_8821AU-20180131-4.15.patch of Package rtl8812AU_8821AU

--- hal/OUTSRC/phydm_types.h.orig	2017-06-28 21:44:27.801692102 +0200
+++ hal/OUTSRC/phydm_types.h	2018-02-04 17:27:34.118822283 +0100
@@ -262,7 +262,11 @@
 #define	ODM_ENDIAN_TYPE			ODM_ENDIAN_BIG
 #endif
 
+#if defined (LINUX_VERSION_CODE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+typedef struct legacy_timer_emu		RT_TIMER, *PRT_TIMER;
+#else
 typedef struct timer_list		RT_TIMER, *PRT_TIMER;
+#endif
 typedef  void *				RT_TIMER_CALL_BACK;
 #define	STA_INFO_T			struct sta_info
 #define	PSTA_INFO_T		struct sta_info *
--- include/osdep_service.h.orig	2017-06-28 21:44:27.833692101 +0200
+++ include/osdep_service.h	2018-02-04 16:18:18.293493197 +0100
@@ -319,8 +319,12 @@
 __inline static unsigned char _cancel_timer_ex(_timer *ptimer)
 {
 #ifdef PLATFORM_LINUX
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+	return del_timer_sync(&ptimer->t);
+#else
 	return del_timer_sync(ptimer);
 #endif
+#endif
 #ifdef PLATFORM_FREEBSD
 	_cancel_timer(ptimer,0);
 	return 0;
--- include/osdep_service_linux.h.orig	2017-06-28 21:44:27.833692101 +0200
+++ include/osdep_service_linux.h	2018-02-04 16:20:48.713488752 +0100
@@ -134,7 +134,15 @@
 #else
 typedef struct semaphore	_mutex;
 #endif
-typedef struct timer_list _timer;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+	typedef struct legacy_timer_emu {
+		struct timer_list t;
+		void (*function)(unsigned long);
+		unsigned long data;
+	} _timer;
+#else
+	typedef struct timer_list _timer;
+#endif
 
 struct	__queue {
 	struct	list_head	queue;
@@ -267,22 +275,42 @@
 
 #define RTW_TIMER_HDL_ARGS void *FunctionContext
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 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
+
 __inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx)
 {
 	//setup_timer(ptimer, pfunc,(u32)cntx);
 	ptimer->function = pfunc;
 	ptimer->data = (unsigned long)cntx;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+	timer_setup(&ptimer->t, legacy_timer_emu_func, 0);
+#else
 	init_timer(ptimer);
+#endif
 }
 
 __inline static void _set_timer(_timer *ptimer,u32 delay_time)
 {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+	mod_timer(&ptimer->t, (jiffies+(delay_time*HZ/1000)));
+#else
 	mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
+#endif
 }
 
 __inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
 {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+	del_timer_sync(&ptimer->t);
+#else
 	del_timer_sync(ptimer);
+#endif
 	*bcancelled=  _TRUE;//TRUE ==1; FALSE==0
 }
 
openSUSE Build Service is sponsored by