qcacmn: Add >=4.15 kernel support to qdf_timer

The various setup_*_timer() APIs were removed from the linux kernel in
4.15, and replaced with similar timer_setup_*() APIs. Add conditional
compilation to qdf_timer to use the correct APIs depending on the
version of the kernel being compiled against.

Change-Id: Ibe0f8adc4df7bb98aceb509d438e241fac507393
CRs-Fixed: 2388570
This commit is contained in:
Dustin Brown 2019-01-15 14:06:59 -08:00 • committed by nshrivas
commit 8acb74ae9a

View file

@ -33,15 +33,50 @@
#include <linux/sched/task_stack.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
#define setup_deferrable_timer(timer, fn, data) \
__setup_timer((timer), (fn), (data), TIMER_DEFERRABLE)
#endif
struct __qdf_timer_t {
struct timer_list os_timer;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
qdf_timer_func_t callback;
void *context;
#endif
};
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static inline void __os_timer_shim(struct timer_list *os_timer)
{
struct __qdf_timer_t *timer = from_timer(timer, os_timer, os_timer);
timer->callback(timer->context);
}
static inline QDF_STATUS __qdf_timer_init(struct __qdf_timer_t *timer,
qdf_timer_func_t func, void *arg,
QDF_TIMER_TYPE type)
{
struct timer_list *os_timer = &timer->os_timer;
uint32_t flags = 0;
timer->callback = func;
timer->context = arg;
if (type == QDF_TIMER_TYPE_SW)
flags |= TIMER_DEFERRABLE;
if (object_is_on_stack(os_timer))
timer_setup_on_stack(os_timer, __os_timer_shim, flags);
else
timer_setup(os_timer, __os_timer_shim, flags);
return QDF_STATUS_SUCCESS;
}
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
#define setup_deferrable_timer(timer, fn, data) \
__setup_timer((timer), (fn), (data), TIMER_DEFERRABLE)
#endif
typedef void (*__legacy_timer_callback_t)(unsigned long arg);
static inline QDF_STATUS __qdf_timer_init(struct __qdf_timer_t *timer,
@ -68,6 +103,7 @@ static inline QDF_STATUS __qdf_timer_init(struct __qdf_timer_t *timer,
return QDF_STATUS_SUCCESS;
}
#endif /* KERNEL_VERSION(4, 15, 0)*/
static inline void __qdf_timer_start(struct __qdf_timer_t *timer, uint32_t msec)
{