qcacmn: Remove 2.6.19 kernel check from qdf_defer

qdf_defer contains backwards compatibility code for Linux kernel
versions <=2.6.19. At the time of writing, this version is 12 years
old. Remove backward compatibility for kernel versions <=2.6.19 from
qdf_defer.

Change-Id: I623aa5b1ed597c76997bf397d9f2114cdf8c5ece
CRs-Fixed: 2247714
This commit is contained in:
Dustin Brown
2018-05-23 14:40:15 -07:00
committed by nshrivas
parent 5a0302c53e
commit b6c29037e6
2 changed files with 19 additions and 107 deletions

View File

@@ -24,7 +24,6 @@
#ifndef _I_QDF_DEFER_H #ifndef _I_QDF_DEFER_H
#define _I_QDF_DEFER_H #define _I_QDF_DEFER_H
#include <linux/version.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <qdf_types.h> #include <qdf_types.h>
@@ -34,11 +33,6 @@
typedef struct tasklet_struct __qdf_bh_t; typedef struct tasklet_struct __qdf_bh_t;
typedef struct workqueue_struct __qdf_workqueue_t; typedef struct workqueue_struct __qdf_workqueue_t;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19)
typedef struct work_struct __qdf_work_t;
typedef struct work_struct __qdf_delayed_work_t;
#else
/** /**
* __qdf_work_t - wrapper around the real task func * __qdf_work_t - wrapper around the real task func
* @work: Instance of work * @work: Instance of work
@@ -46,9 +40,9 @@ typedef struct work_struct __qdf_delayed_work_t;
* @arg: pointer to argument * @arg: pointer to argument
*/ */
typedef struct { typedef struct {
struct work_struct work; struct work_struct work;
qdf_defer_fn_t fn; qdf_defer_fn_t fn;
void *arg; void *arg;
} __qdf_work_t; } __qdf_work_t;
/** /**
@@ -58,18 +52,16 @@ typedef struct {
* @arg: pointer to argument * @arg: pointer to argument
*/ */
typedef struct { typedef struct {
struct delayed_work dwork; struct delayed_work dwork;
qdf_defer_fn_t fn; qdf_defer_fn_t fn;
void *arg; void *arg;
} __qdf_delayed_work_t; } __qdf_delayed_work_t;
extern void __qdf_defer_func(struct work_struct *work); extern void __qdf_defer_func(struct work_struct *work);
extern void __qdf_defer_delayed_func(struct work_struct *work); extern void __qdf_defer_delayed_func(struct work_struct *work);
#endif
typedef void (*__qdf_bh_fn_t)(unsigned long arg); typedef void (*__qdf_bh_fn_t)(unsigned long arg);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19)
/** /**
* __qdf_init_work - Initialize a work/task queue, This runs in non-interrupt * __qdf_init_work - Initialize a work/task queue, This runs in non-interrupt
* context, so can be preempted by H/W & S/W intr * context, so can be preempted by H/W & S/W intr
@@ -81,7 +73,8 @@ typedef void (*__qdf_bh_fn_t)(unsigned long arg);
static inline QDF_STATUS static inline QDF_STATUS
__qdf_init_work(__qdf_work_t *work, qdf_defer_fn_t func, void *arg) __qdf_init_work(__qdf_work_t *work, qdf_defer_fn_t func, void *arg)
{ {
/*Initialize func and argument in work struct */ work->fn = func;
work->arg = arg;
INIT_WORK(&work->work, __qdf_defer_func); INIT_WORK(&work->work, __qdf_defer_func);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -98,7 +91,10 @@ static inline uint32_t __qdf_init_delayed_work(__qdf_delayed_work_t *work,
qdf_defer_fn_t func, qdf_defer_fn_t func,
void *arg) void *arg)
{ {
INIT_WORK(work, func, arg); /*Initialize func and argument in work struct */
work->fn = func;
work->arg = arg;
INIT_DELAYED_WORK(&work->dwork, __qdf_defer_delayed_func);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -111,7 +107,7 @@ static inline uint32_t __qdf_init_delayed_work(__qdf_delayed_work_t *work,
static inline void static inline void
__qdf_queue_work(__qdf_workqueue_t *wqueue, __qdf_work_t *work) __qdf_queue_work(__qdf_workqueue_t *wqueue, __qdf_work_t *work)
{ {
queue_work(wqueue, work); queue_work(wqueue, &work->work);
} }
/** /**
@@ -125,7 +121,7 @@ static inline void __qdf_queue_delayed_work(__qdf_workqueue_t *wqueue,
__qdf_delayed_work_t *work, __qdf_delayed_work_t *work,
uint32_t delay) uint32_t delay)
{ {
queue_delayed_work(wqueue, work, msecs_to_jiffies(delay)); queue_delayed_work(wqueue, &work->dwork, msecs_to_jiffies(delay));
} }
/** /**
@@ -135,7 +131,7 @@ static inline void __qdf_queue_delayed_work(__qdf_workqueue_t *wqueue,
*/ */
static inline QDF_STATUS __qdf_sched_work(__qdf_work_t *work) static inline QDF_STATUS __qdf_sched_work(__qdf_work_t *work)
{ {
schedule_work(work); schedule_work(&work->work);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -148,7 +144,7 @@ static inline QDF_STATUS __qdf_sched_work(__qdf_work_t *work)
static inline QDF_STATUS static inline QDF_STATUS
__qdf_sched_delayed_work(__qdf_delayed_work_t *work, uint32_t delay) __qdf_sched_delayed_work(__qdf_delayed_work_t *work, uint32_t delay)
{ {
schedule_delayed_work(work, msecs_to_jiffies(delay)); schedule_delayed_work(&work->dwork, msecs_to_jiffies(delay));
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -159,7 +155,7 @@ __qdf_sched_delayed_work(__qdf_delayed_work_t *work, uint32_t delay)
*/ */
static inline bool __qdf_cancel_work(__qdf_work_t *work) static inline bool __qdf_cancel_work(__qdf_work_t *work)
{ {
return cancel_work_sync(work); return cancel_work_sync(&work->work);
} }
/** /**
@@ -169,7 +165,7 @@ static inline bool __qdf_cancel_work(__qdf_work_t *work)
*/ */
static inline bool __qdf_cancel_delayed_work(__qdf_delayed_work_t *work) static inline bool __qdf_cancel_delayed_work(__qdf_delayed_work_t *work)
{ {
return cancel_delayed_work_sync(work); return cancel_delayed_work_sync(&work->dwork);
} }
/** /**
@@ -179,7 +175,7 @@ static inline bool __qdf_cancel_delayed_work(__qdf_delayed_work_t *work)
*/ */
static inline uint32_t __qdf_flush_work(__qdf_work_t *work) static inline uint32_t __qdf_flush_work(__qdf_work_t *work)
{ {
flush_work(work); flush_work(&work->work);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -188,83 +184,12 @@ static inline uint32_t __qdf_flush_work(__qdf_work_t *work)
* @work: pointer to delayed work * @work: pointer to delayed work
* Return: none * Return: none
*/ */
static inline uint32_t __qdf_flush_delayed_work(__qdf_delayed_work_t *work)
{
flush_delayed_work(work);
return QDF_STATUS_SUCCESS;
}
#else
static inline QDF_STATUS
__qdf_init_work(__qdf_work_t *work, qdf_defer_fn_t func, void *arg)
{
work->fn = func;
work->arg = arg;
INIT_WORK(&work->work, __qdf_defer_func);
return QDF_STATUS_SUCCESS;
}
static inline uint32_t __qdf_init_delayed_work(__qdf_delayed_work_t *work,
qdf_defer_fn_t func,
void *arg)
{
/*Initialize func and argument in work struct */
work->fn = func;
work->arg = arg;
INIT_DELAYED_WORK(&work->dwork, __qdf_defer_delayed_func);
return QDF_STATUS_SUCCESS;
}
static inline void
__qdf_queue_work(__qdf_workqueue_t *wqueue, __qdf_work_t *work)
{
queue_work(wqueue, &work->work);
}
static inline void __qdf_queue_delayed_work(__qdf_workqueue_t *wqueue,
__qdf_delayed_work_t *work,
uint32_t delay)
{
queue_delayed_work(wqueue, &work->dwork, msecs_to_jiffies(delay));
}
static inline QDF_STATUS __qdf_sched_work(__qdf_work_t *work)
{
schedule_work(&work->work);
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS
__qdf_sched_delayed_work(__qdf_delayed_work_t *work, uint32_t delay)
{
schedule_delayed_work(&work->dwork, msecs_to_jiffies(delay));
return QDF_STATUS_SUCCESS;
}
static inline bool __qdf_cancel_work(__qdf_work_t *work)
{
return cancel_work_sync(&work->work);
}
static inline bool __qdf_cancel_delayed_work(__qdf_delayed_work_t *work)
{
return cancel_delayed_work_sync(&work->dwork);
}
static inline uint32_t __qdf_flush_work(__qdf_work_t *work)
{
flush_work(&work->work);
return QDF_STATUS_SUCCESS;
}
static inline uint32_t __qdf_flush_delayed_work(__qdf_delayed_work_t *work) static inline uint32_t __qdf_flush_delayed_work(__qdf_delayed_work_t *work)
{ {
flush_delayed_work(&work->dwork); flush_delayed_work(&work->dwork);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
#endif
/** /**
* __qdf_create_workqueue - create a workqueue, This runs in non-interrupt * __qdf_create_workqueue - create a workqueue, This runs in non-interrupt
* context, so can be preempted by H/W & S/W intr * context, so can be preempted by H/W & S/W intr
@@ -325,10 +250,6 @@ __qdf_init_bh(struct tasklet_struct *bh, qdf_defer_fn_t func, void *arg)
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19)
#else
#endif
/** /**
* __qdf_sched_bh - schedule a bottom half (DPC) * __qdf_sched_bh - schedule a bottom half (DPC)
* @bh: pointer to bottom * @bh: pointer to bottom

View File

@@ -22,7 +22,6 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
@@ -48,7 +47,6 @@ void __qdf_defer_func(struct work_struct *work)
} }
qdf_export_symbol(__qdf_defer_func); qdf_export_symbol(__qdf_defer_func);
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 19)
/** /**
* __qdf_defer_delayed_func() - defer work handler * __qdf_defer_delayed_func() - defer work handler
* @dwork: Pointer to defer work * @dwork: Pointer to defer work
@@ -57,12 +55,6 @@ qdf_export_symbol(__qdf_defer_func);
*/ */
void void
__qdf_defer_delayed_func(struct work_struct *dwork) __qdf_defer_delayed_func(struct work_struct *dwork)
{
return;
}
#else
void
__qdf_defer_delayed_func(struct work_struct *dwork)
{ {
__qdf_delayed_work_t *ctx = container_of(dwork, __qdf_delayed_work_t, __qdf_delayed_work_t *ctx = container_of(dwork, __qdf_delayed_work_t,
dwork.work); dwork.work);
@@ -73,5 +65,4 @@ __qdf_defer_delayed_func(struct work_struct *dwork)
} }
ctx->fn(ctx->arg); ctx->fn(ctx->arg);
} }
#endif
qdf_export_symbol(__qdf_defer_delayed_func); qdf_export_symbol(__qdf_defer_delayed_func);