qcacmn: Fix qdf_timer_init/free implementation

With DEBUG_OBJECTS_TIMERS enabled, cds_mc_thread prints warning
"ODEBUG: object is on stack, but not annotated". Since the wd_timer
is on the stack, we should rightly use set_timer API's.

Change-Id: I38061ff6c1b706484cd5d4532954cfa24c7ac0d6
CRs-Fixed: 2052484
This commit is contained in:
Mahesh Kumar Kalikot Veetil 2017-05-25 10:41:50 -07:00 • committed by snandini
commit 6eaefc4bf9

View file

@ -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);
}
/**