|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
|
|
|
+ * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
|
|
|
*
|
|
|
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
|
|
*
|
|
@@ -39,6 +39,11 @@
|
|
|
#include <linux/jiffies.h>
|
|
|
#include <qdf_types.h>
|
|
|
|
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
|
|
+#define setup_deferrable_timer(timer, fn, data) \
|
|
|
+ __setup_timer((timer), (fn), (data), TIMER_DEFERRABLE)
|
|
|
+#endif
|
|
|
+
|
|
|
/* timer data type */
|
|
|
typedef struct timer_list __qdf_timer_t;
|
|
|
|
|
@@ -64,12 +69,24 @@ static inline QDF_STATUS __qdf_timer_init(qdf_handle_t hdl,
|
|
|
qdf_timer_func_t func, void *arg,
|
|
|
QDF_TIMER_TYPE type)
|
|
|
{
|
|
|
- if (QDF_TIMER_TYPE_SW == type)
|
|
|
- init_timer_deferrable(timer);
|
|
|
- else
|
|
|
- init_timer(timer);
|
|
|
- timer->function = (qdf_dummy_timer_func_t) func;
|
|
|
- timer->data = (unsigned long)arg;
|
|
|
+ if (type == QDF_TIMER_TYPE_SW) {
|
|
|
+ if (object_is_on_stack(timer))
|
|
|
+ setup_deferrable_timer_on_stack(
|
|
|
+ timer, (qdf_dummy_timer_func_t)func,
|
|
|
+ (unsigned long)arg);
|
|
|
+ else
|
|
|
+ setup_deferrable_timer(timer,
|
|
|
+ (qdf_dummy_timer_func_t)func,
|
|
|
+ (unsigned long)arg);
|
|
|
+ } else {
|
|
|
+ if (object_is_on_stack(timer))
|
|
|
+ setup_timer_on_stack(timer,
|
|
|
+ (qdf_dummy_timer_func_t)func,
|
|
|
+ (unsigned long)arg);
|
|
|
+ else
|
|
|
+ setup_timer(timer, (qdf_dummy_timer_func_t)func,
|
|
|
+ (unsigned long)arg);
|
|
|
+ }
|
|
|
|
|
|
return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
@@ -124,12 +141,14 @@ static inline bool __qdf_timer_stop(struct timer_list *timer)
|
|
|
* __qdf_timer_free() - free a qdf timer
|
|
|
* @timer: Pointer to timer object
|
|
|
*
|
|
|
- * Return: true if timer was cancelled and deactived,
|
|
|
- * false if timer was cancelled but already got fired.
|
|
|
+ * Return: None
|
|
|
*/
|
|
|
static inline void __qdf_timer_free(struct timer_list *timer)
|
|
|
{
|
|
|
del_timer_sync(timer);
|
|
|
+
|
|
|
+ if (object_is_on_stack(timer))
|
|
|
+ destroy_timer_on_stack(timer);
|
|
|
}
|
|
|
|
|
|
/**
|