Drop some unnecessary wrappers and update all the references
accordingly.
Tested on Comfast CF-WU810N RTL8188EUS wireless adapter.
Vihas Makwana (6):
staging: r8188eu: drop unnecessary wrapper rtw_free_cmd_priv
staging: r8188eu: drop unnecessary wrapper rtw_init_cmd_priv
staging: r8188eu: drop unnecessary wrapper rtw_init_evt_priv
staging: r8188eu: drop unnecessary wrapper rtw_dequeue_cmd
staging: r8188eu: drop unnecessary wrapper rtw_init_mlme_priv
staging: r8188eu: drop unnecessary wrapper rtw_free_mlme_priv
drivers/staging/r8188eu/core/rtw_cmd.c | 45 ++++------------------
drivers/staging/r8188eu/core/rtw_mlme.c | 16 +-------
drivers/staging/r8188eu/include/rtw_cmd.h | 8 ++--
drivers/staging/r8188eu/include/rtw_mlme.h | 3 +-
drivers/staging/r8188eu/os_dep/os_intfs.c | 14 +++----
5 files changed, 20 insertions(+), 66 deletions(-)
--
2.30.2
Remove the unnecessary wrapper. The logic of rtw_dequeue_cmd can
be moved to _rtw_dequeue_cmd.
Signed-off-by: Vihas Makwana <[email protected]>
---
drivers/staging/r8188eu/core/rtw_cmd.c | 16 ++++------------
drivers/staging/r8188eu/include/rtw_cmd.h | 2 +-
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index ac6e710e5..9d1beca43 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -121,10 +121,11 @@ static int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
return _SUCCESS;
}
-static struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue)
+struct cmd_obj *_rtw_dequeue_cmd(struct cmd_priv *pcmdpriv)
{
struct cmd_obj *obj;
unsigned long flags;
+ struct __queue *queue = &pcmdpriv->cmd_queue;
spin_lock_irqsave(&queue->lock, flags);
if (list_empty(&queue->queue)) {
@@ -178,15 +179,6 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
return res;
}
-struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv)
-{
- struct cmd_obj *cmd_obj;
-
- cmd_obj = _rtw_dequeue_cmd(&pcmdpriv->cmd_queue);
-
- return cmd_obj;
-}
-
void rtw_free_cmd_obj(struct cmd_obj *pcmd)
{
@@ -230,7 +222,7 @@ int rtw_cmd_thread(void *context)
padapter->bSurpriseRemoved)
break;
- pcmd = rtw_dequeue_cmd(pcmdpriv);
+ pcmd = _rtw_dequeue_cmd(pcmdpriv);
if (!pcmd)
continue;
@@ -280,7 +272,7 @@ int rtw_cmd_thread(void *context)
/* free all cmd_obj resources */
do {
- pcmd = rtw_dequeue_cmd(pcmdpriv);
+ pcmd = _rtw_dequeue_cmd(pcmdpriv);
if (!pcmd)
break;
diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h
index 7edce0f88..d581deebb 100644
--- a/drivers/staging/r8188eu/include/rtw_cmd.h
+++ b/drivers/staging/r8188eu/include/rtw_cmd.h
@@ -77,7 +77,7 @@ struct c2h_evt_hdr {
#define c2h_evt_exist(c2h_evt) ((c2h_evt)->id || (c2h_evt)->plen)
u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
-struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
+struct cmd_obj *_rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
void rtw_free_cmd_obj(struct cmd_obj *pcmd);
int rtw_cmd_thread(void *context);
--
2.30.2
Remove the unnecessary wrapper. The logic of rtw_free_cmd_priv can
be moved to _rtw_free_cmd_priv.
Signed-off-by: Vihas Makwana <[email protected]>
---
drivers/staging/r8188eu/core/rtw_cmd.c | 7 +------
drivers/staging/r8188eu/include/rtw_cmd.h | 2 +-
drivers/staging/r8188eu/os_dep/os_intfs.c | 4 ++--
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index f036a980e..4d88bc847 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -87,7 +87,7 @@ void rtw_free_evt_priv(struct evt_priv *pevtpriv)
}
}
-static void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv)
+void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv)
{
if (pcmdpriv) {
kfree(pcmdpriv->cmd_allocated_buf);
@@ -157,11 +157,6 @@ u32 rtw_init_evt_priv(struct evt_priv *pevtpriv)
return res;
}
-void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv)
-{
- _rtw_free_cmd_priv(pcmdpriv);
-}
-
static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
{
u8 bAllow = false; /* set to true to allow enqueuing cmd when hw_init_completed is false */
diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h
index 6b6d560d7..d3a20dc23 100644
--- a/drivers/staging/r8188eu/include/rtw_cmd.h
+++ b/drivers/staging/r8188eu/include/rtw_cmd.h
@@ -83,7 +83,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd);
int rtw_cmd_thread(void *context);
u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
-void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);
+void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);
u32 rtw_init_evt_priv(struct evt_priv *pevtpriv);
void rtw_free_evt_priv(struct evt_priv *pevtpriv);
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 390d1cc0e..702e5b350 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -534,7 +534,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
rtw_free_evt_priv(&padapter->evtpriv);
free_cmd_priv:
- rtw_free_cmd_priv(&padapter->cmdpriv);
+ _rtw_free_cmd_priv(&padapter->cmdpriv);
return _FAIL;
}
@@ -572,7 +572,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter)
free_mlme_ext_priv(&padapter->mlmeextpriv);
- rtw_free_cmd_priv(&padapter->cmdpriv);
+ _rtw_free_cmd_priv(&padapter->cmdpriv);
rtw_free_evt_priv(&padapter->evtpriv);
--
2.30.2
Remove the unnecessary wrapper. Drop rtw_free_mlme_priv and use
_rtw_free_mlme_priv instead.
Signed-off-by: Vihas Makwana <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme.c | 5 -----
drivers/staging/r8188eu/include/rtw_mlme.h | 1 -
drivers/staging/r8188eu/os_dep/os_intfs.c | 4 ++--
3 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index f2a61c162..c09a565b4 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -288,11 +288,6 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie)
return ie + 8;
}
-void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
-{
- _rtw_free_mlme_priv(pmlmepriv);
-}
-
static struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv)
{
struct wlan_network *pnetwork;
diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h
index b5b1a0e10..4055a15e2 100644
--- a/drivers/staging/r8188eu/include/rtw_mlme.h
+++ b/drivers/staging/r8188eu/include/rtw_mlme.h
@@ -439,7 +439,6 @@ void rtw_join_timeout_handler (struct timer_list *t);
void _rtw_scan_timeout_handler (struct timer_list *t);
void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall);
int _rtw_init_mlme_priv(struct adapter *adapter);
-void rtw_free_mlme_priv (struct mlme_priv *pmlmepriv);
int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv);
int rtw_set_key(struct adapter *adapter, struct security_priv *psecuritypriv,
int keyid, u8 set_tx);
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 448ea9533..adfc1e763 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -528,7 +528,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
free_mlme_ext:
free_mlme_ext_priv(&padapter->mlmeextpriv);
- rtw_free_mlme_priv(&padapter->mlmepriv);
+ _rtw_free_mlme_priv(&padapter->mlmepriv);
free_evt_priv:
rtw_free_evt_priv(&padapter->evtpriv);
@@ -576,7 +576,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter)
rtw_free_evt_priv(&padapter->evtpriv);
- rtw_free_mlme_priv(&padapter->mlmepriv);
+ _rtw_free_mlme_priv(&padapter->mlmepriv);
_rtw_free_xmit_priv(&padapter->xmitpriv);
_rtw_free_sta_priv(&padapter->stapriv); /* will free bcmc_stainfo here */
--
2.30.2