2014-07-09 19:11:09

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 1/3] staging: rtl8712: remove wrapper function _init_workitem()

The inline function _init_workitem() is just a wrapper around INIT_WORK().
Oddly, this wrapper accepts 3 parameters while INIT_WORK() only accepts 2.
The third parameter is unused.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 5 -----
drivers/staging/rtl8712/rtl8712_led.c | 2 +-
drivers/staging/rtl8712/rtl871x_pwrctrl.c | 6 ++----
drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
4 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 67c53d5..2cf9a02 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -81,11 +81,6 @@ static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled)
*bcancelled = true; /*true ==1; false==0*/
}

-static inline void _init_workitem(_workitem *pwork, void *pfunc, void *cntx)
-{
- INIT_WORK(pwork, pfunc);
-}
-
static inline void _set_workitem(_workitem *pwork)
{
schedule_work(pwork);
diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c
index 6cb1a0af5..a84ae2f 100644
--- a/drivers/staging/rtl8712/rtl8712_led.c
+++ b/drivers/staging/rtl8712/rtl8712_led.c
@@ -98,7 +98,7 @@ static void InitLed871x(struct _adapter *padapter, struct LED_871x *pLed,
pLed->BlinkTimes = 0;
pLed->BlinkingLedState = LED_UNKNOWN;
_init_timer(&(pLed->BlinkTimer), nic, BlinkTimerCallback, pLed);
- _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed);
+ INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback);
}

/*
diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
index 9fd2ec7..6cf051f 100644
--- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c
+++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
@@ -184,10 +184,8 @@ void r8712_init_pwrctrl_priv(struct _adapter *padapter)
pwrctrlpriv->tog = 0x80;
/* clear RPWM to ensure driver and fw back to initial state. */
r8712_write8(padapter, 0x1025FE58, 0);
- _init_workitem(&(pwrctrlpriv->SetPSModeWorkItem),
- SetPSModeWorkItemCallback, padapter);
- _init_workitem(&(pwrctrlpriv->rpwm_workitem),
- rpwm_workitem_callback, padapter);
+ INIT_WORK(&pwrctrlpriv->SetPSModeWorkItem, SetPSModeWorkItemCallback);
+ INIT_WORK(&pwrctrlpriv->rpwm_workitem, rpwm_workitem_callback);
_init_timer(&(pwrctrlpriv->rpwm_check_timer),
padapter->pnetdev, rpwm_check_handler, (u8 *)padapter);
}
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index a104b77..b985edc 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -148,7 +148,7 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
pxmitbuf++;
}
pxmitpriv->free_xmitbuf_cnt = NR_XMITBUFF;
- _init_workitem(&padapter->wkFilterRxFF0, r8712_SetFilter, padapter);
+ INIT_WORK(&padapter->wkFilterRxFF0, r8712_SetFilter);
alloc_hwxmits(padapter);
init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
tasklet_init(&pxmitpriv->xmit_tasklet,
--
1.9.1


2014-07-09 19:11:18

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 2/3] staging: rtl8712: remove wrapper function _set_workitem()

The inline function _set_workitem() simply wraps schedule_work(). Removed.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 5 -----
drivers/staging/rtl8712/rtl8712_led.c | 2 +-
drivers/staging/rtl8712/rtl871x_pwrctrl.c | 4 ++--
3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 2cf9a02..43795e7 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -81,11 +81,6 @@ static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled)
*bcancelled = true; /*true ==1; false==0*/
}

-static inline void _set_workitem(_workitem *pwork)
-{
- schedule_work(pwork);
-}
-
#ifndef BIT
#define BIT(x) (1 << (x))
#endif
diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c
index a84ae2f..56e8add 100644
--- a/drivers/staging/rtl8712/rtl8712_led.c
+++ b/drivers/staging/rtl8712/rtl8712_led.c
@@ -827,7 +827,7 @@ static void BlinkTimerCallback(unsigned long data)
if ((pLed->padapter->bSurpriseRemoved == true) ||
(pLed->padapter->bDriverStopped == true))
return;
- _set_workitem(&(pLed->BlinkWorkItem));
+ schedule_work(&pLed->BlinkWorkItem);
}

/* Description:
diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
index 6cf051f..89ce527 100644
--- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c
+++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c
@@ -83,7 +83,7 @@ void r8712_set_ps_mode(struct _adapter *padapter, uint ps_mode, uint smart_ps)
pwrpriv->bSleep = false;
pwrpriv->pwr_mode = ps_mode;
pwrpriv->smart_ps = smart_ps;
- _set_workitem(&(pwrpriv->SetPSModeWorkItem));
+ schedule_work(&pwrpriv->SetPSModeWorkItem);
}
}

@@ -133,7 +133,7 @@ static void _rpwm_check_handler (struct _adapter *padapter)
padapter->bSurpriseRemoved == true)
return;
if (pwrpriv->cpwm != pwrpriv->rpwm)
- _set_workitem(&(pwrpriv->rpwm_workitem));
+ schedule_work(&pwrpriv->rpwm_workitem);
}

static void SetPSModeWorkItemCallback(struct work_struct *work)
--
1.9.1

2014-07-09 19:11:28

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 3/3] staging: rtl8712: remove #define _workitem struct work_struct

_workitem is just a #define for work_struct. Remove the #define and
use struct work_struct directly instead.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/drv_types.h | 2 +-
drivers/staging/rtl8712/osdep_service.h | 1 -
drivers/staging/rtl8712/rtl871x_led.h | 2 +-
drivers/staging/rtl8712/rtl871x_pwrctrl.h | 4 ++--
drivers/staging/rtl8712/rtl871x_xmit.h | 6 +++---
5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/drv_types.h b/drivers/staging/rtl8712/drv_types.h
index 0168745..3d0a98b 100644
--- a/drivers/staging/rtl8712/drv_types.h
+++ b/drivers/staging/rtl8712/drv_types.h
@@ -173,7 +173,7 @@ struct _adapter {
struct net_device_stats stats;
struct iw_statistics iwstats;
int pid; /*process id from UI*/
- _workitem wkFilterRxFF0;
+ struct work_struct wkFilterRxFF0;
u8 blnEnableRxFF0Filter;
spinlock_t lockRxFF0Filter;
const struct firmware *fw;
diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 43795e7..c80f006 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -50,7 +50,6 @@ struct __queue {
#define _pkt struct sk_buff
#define _buffer unsigned char
#define thread_exit() complete_and_exit(NULL, 0)
-#define _workitem struct work_struct

#define _init_queue(pqueue) \
do { \
diff --git a/drivers/staging/rtl8712/rtl871x_led.h b/drivers/staging/rtl8712/rtl871x_led.h
index 1a90c7f..eb61205 100644
--- a/drivers/staging/rtl8712/rtl871x_led.h
+++ b/drivers/staging/rtl8712/rtl871x_led.h
@@ -99,7 +99,7 @@ struct LED_871x {
* either LED_ON or OFF.*/

struct timer_list BlinkTimer; /* Timer object for led blinking.*/
- _workitem BlinkWorkItem; /* Workitem used by BlinkTimer */
+ struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer */
};

struct led_priv {
diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.h b/drivers/staging/rtl8712/rtl871x_pwrctrl.h
index 70ff924f..0526ba0 100644
--- a/drivers/staging/rtl8712/rtl871x_pwrctrl.h
+++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.h
@@ -107,8 +107,8 @@ struct pwrctrl_priv {
uint ImrContent; /* used to store original imr. */
uint bSleep; /* sleep -> active is different from active -> sleep. */

- _workitem SetPSModeWorkItem;
- _workitem rpwm_workitem;
+ struct work_struct SetPSModeWorkItem;
+ struct work_struct rpwm_workitem;
struct timer_list rpwm_check_timer;
u8 rpwm_retry;
uint bSetPSModeWorkItemInProgress;
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.h b/drivers/staging/rtl8712/rtl871x_xmit.h
index ee90698..a9633c3 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.h
+++ b/drivers/staging/rtl8712/rtl871x_xmit.h
@@ -233,9 +233,9 @@ struct xmit_priv {
u8 hwxmit_entry;
u8 txirp_cnt;
struct tasklet_struct xmit_tasklet;
- _workitem xmit_pipe4_reset_wi;
- _workitem xmit_pipe6_reset_wi;
- _workitem xmit_piped_reset_wi;
+ struct work_struct xmit_pipe4_reset_wi;
+ struct work_struct xmit_pipe6_reset_wi;
+ struct work_struct xmit_piped_reset_wi;
/*per AC pending irp*/
int beq_cnt;
int bkq_cnt;
--
1.9.1