2014-06-25 02:53:12

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 1/8] staging: rtl8712: remove wrapper function _init_listhead

_init_listhead is just an inline wrapper around INIT_LIST_HEAD. This
patch removes the wrapper and directly uses INIT_LIST_HEAD instead.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 7 +------
drivers/staging/rtl8712/rtl8712_recv.c | 4 ++--
drivers/staging/rtl8712/rtl871x_cmd.c | 8 ++++----
drivers/staging/rtl8712/rtl871x_cmd.h | 2 +-
drivers/staging/rtl8712/rtl871x_io.c | 8 ++++----
drivers/staging/rtl8712/rtl871x_mlme.c | 6 +++---
drivers/staging/rtl8712/rtl871x_mp.c | 2 +-
drivers/staging/rtl8712/rtl871x_recv.c | 2 +-
drivers/staging/rtl8712/rtl871x_sta_mgt.c | 14 +++++++-------
drivers/staging/rtl8712/rtl871x_xmit.c | 12 ++++++------
10 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 09e1561..17c28c8 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -54,7 +54,7 @@ struct __queue {

#define _init_queue(pqueue) \
do { \
- _init_listhead(&((pqueue)->queue)); \
+ INIT_LIST_HEAD(&((pqueue)->queue)); \
spin_lock_init(&((pqueue)->lock)); \
} while (0)

@@ -137,11 +137,6 @@ static inline u32 _down_sema(struct semaphore *sema)
return _SUCCESS;
}

-static inline void _init_listhead(struct list_head *list)
-{
- INIT_LIST_HEAD(list);
-}
-
static inline u32 _queue_empty(struct __queue *pqueue)
{
return is_list_empty(&(pqueue->queue));
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 1f70017..f87a8fd 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -66,7 +66,7 @@ int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter)
((addr_t) (precvpriv->pallocated_recv_buf) & 3);
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
- _init_listhead(&precvbuf->list);
+ INIT_LIST_HEAD(&precvbuf->list);
spin_lock_init(&precvbuf->recvbuf_lock);
res = r8712_os_recvbuf_resource_alloc(padapter, precvbuf);
if (res == _FAIL)
@@ -1061,7 +1061,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
precvframe = r8712_alloc_recvframe(pfree_recv_queue);
if (precvframe == NULL)
goto _exit_recvbuf2recvframe;
- _init_listhead(&precvframe->u.hdr.list);
+ INIT_LIST_HEAD(&precvframe->u.hdr.list);
precvframe->u.hdr.precvbuf = NULL; /*can't access the precvbuf*/
precvframe->u.hdr.len = 0;
tmp_len = pkt_len + drvinfo_sz + RXDESC_SIZE;
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index 1775462..646c5cd 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -413,7 +413,7 @@ u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval)
kfree((u8 *) ph2c);
return _FAIL;
}
- _init_listhead(&ph2c->list);
+ INIT_LIST_HEAD(&ph2c->list);
ph2c->cmdcode = GEN_CMD_CODE(_GetRFReg);
ph2c->parmbuf = (unsigned char *)prdrfparm;
ph2c->cmdsz = sizeof(struct readRF_parm);
@@ -452,7 +452,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
if (pcmd == NULL)
return _FAIL;
- _init_listhead(&pcmd->list);
+ INIT_LIST_HEAD(&pcmd->list);
pcmd->cmdcode = _CreateBss_CMD_;
pcmd->parmbuf = (unsigned char *)pdev_network;
pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz((
@@ -606,7 +606,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork)
psecnetwork->InfrastructureMode);
psecnetwork->IELength = cpu_to_le32(psecnetwork->IELength);
#endif
- _init_listhead(&pcmd->list);
+ INIT_LIST_HEAD(&pcmd->list);
pcmd->cmdcode = _JoinBss_CMD_;
pcmd->parmbuf = (unsigned char *)psecnetwork;
pcmd->rsp = NULL;
@@ -758,7 +758,7 @@ u8 r8712_gettssi_cmd(struct _adapter *padapter, u8 offset, u8 *pval)
kfree((unsigned char *) ph2c);
return _FAIL;
}
- _init_listhead(&ph2c->list);
+ INIT_LIST_HEAD(&ph2c->list);
ph2c->cmdcode = GEN_CMD_CODE(_ReadTSSI);
ph2c->parmbuf = (unsigned char *)prdtssiparm;
ph2c->cmdsz = sizeof(struct readTSSI_parm);
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h
index 0ce79b1..cb8225b 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.h
+++ b/drivers/staging/rtl8712/rtl871x_cmd.h
@@ -83,7 +83,7 @@ struct evt_priv {

#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
do {\
- _init_listhead(&pcmd->list);\
+ INIT_LIST_HEAD(&pcmd->list);\
pcmd->cmdcode = code;\
pcmd->parmbuf = (u8 *)(pparm);\
pcmd->cmdsz = sizeof(*pparm);\
diff --git a/drivers/staging/rtl8712/rtl871x_io.c b/drivers/staging/rtl8712/rtl871x_io.c
index e881b0d..c42a578 100644
--- a/drivers/staging/rtl8712/rtl871x_io.c
+++ b/drivers/staging/rtl8712/rtl871x_io.c
@@ -115,9 +115,9 @@ uint r8712_alloc_io_queue(struct _adapter *adapter)
pio_queue = kmalloc(sizeof(*pio_queue), GFP_ATOMIC);
if (pio_queue == NULL)
goto alloc_io_queue_fail;
- _init_listhead(&pio_queue->free_ioreqs);
- _init_listhead(&pio_queue->processing);
- _init_listhead(&pio_queue->pending);
+ INIT_LIST_HEAD(&pio_queue->free_ioreqs);
+ INIT_LIST_HEAD(&pio_queue->processing);
+ INIT_LIST_HEAD(&pio_queue->pending);
spin_lock_init(&pio_queue->lock);
pio_queue->pallocated_free_ioreqs_buf = kmalloc(NUM_IOREQ *
(sizeof(struct io_req)) + 4,
@@ -131,7 +131,7 @@ uint r8712_alloc_io_queue(struct _adapter *adapter)
& 3);
pio_req = (struct io_req *)(pio_queue->free_ioreqs_buf);
for (i = 0; i < NUM_IOREQ; i++) {
- _init_listhead(&pio_req->list);
+ INIT_LIST_HEAD(&pio_req->list);
list_insert_tail(&pio_req->list, &pio_queue->free_ioreqs);
pio_req++;
}
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 26b8f37..3000b2a 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -69,7 +69,7 @@ static sint _init_mlme_priv(struct _adapter *padapter)
pmlmepriv->free_bss_buf = pbuf;
pnetwork = (struct wlan_network *)pbuf;
for (i = 0; i < MAX_BSS_CNT; i++) {
- _init_listhead(&(pnetwork->list));
+ INIT_LIST_HEAD(&(pnetwork->list));
list_insert_tail(&(pnetwork->list),
&(pmlmepriv->free_bss_pool.queue));
pnetwork++;
@@ -1227,7 +1227,7 @@ sint r8712_set_auth(struct _adapter *adapter,
pcmd->cmdsz = sizeof(struct setauth_parm);
pcmd->rsp = NULL;
pcmd->rspsz = 0;
- _init_listhead(&pcmd->list);
+ INIT_LIST_HEAD(&pcmd->list);
r8712_enqueue_cmd(pcmdpriv, pcmd);
return _SUCCESS;
}
@@ -1299,7 +1299,7 @@ sint r8712_set_key(struct _adapter *adapter,
pcmd->cmdsz = (sizeof(struct setkey_parm));
pcmd->rsp = NULL;
pcmd->rspsz = 0;
- _init_listhead(&pcmd->list);
+ INIT_LIST_HEAD(&pcmd->list);
r8712_enqueue_cmd(pcmdpriv, pcmd);
return ret;

diff --git a/drivers/staging/rtl8712/rtl871x_mp.c b/drivers/staging/rtl8712/rtl871x_mp.c
index e48486c..594d023 100644
--- a/drivers/staging/rtl8712/rtl871x_mp.c
+++ b/drivers/staging/rtl8712/rtl871x_mp.c
@@ -65,7 +65,7 @@ static int init_mp_priv(struct mp_priv *pmp_priv)
((addr_t)(pmp_priv->pallocated_mp_xmitframe_buf) & 3);
pmp_xmitframe = (struct mp_xmit_frame *)pmp_priv->pmp_xmtframe_buf;
for (i = 0; i < NR_MP_XMITFRAME; i++) {
- _init_listhead(&(pmp_xmitframe->list));
+ INIT_LIST_HEAD(&(pmp_xmitframe->list));
list_insert_tail(&(pmp_xmitframe->list),
&(pmp_priv->free_mp_xmitqueue.queue));
pmp_xmitframe->pkt = NULL;
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
index eb77587..269c872 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -86,7 +86,7 @@ sint _r8712_init_recv_priv(struct recv_priv *precvpriv,
(RXFRAME_ALIGN_SZ-1));
precvframe = (union recv_frame *)precvpriv->precv_frame_buf;
for (i = 0; i < NR_RECVFRAME; i++) {
- _init_listhead(&(precvframe->u.list));
+ INIT_LIST_HEAD(&(precvframe->u.list));
list_insert_tail(&(precvframe->u.list),
&(precvpriv->free_recv_queue.queue));
r8712_os_recv_resource_alloc(padapter, precvframe);
diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
index 6c64984..8dd5e35 100644
--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
+++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
@@ -38,12 +38,12 @@ static void _init_stainfo(struct sta_info *psta)
{
memset((u8 *)psta, 0, sizeof(struct sta_info));
spin_lock_init(&psta->lock);
- _init_listhead(&psta->list);
- _init_listhead(&psta->hash_list);
+ INIT_LIST_HEAD(&psta->list);
+ INIT_LIST_HEAD(&psta->hash_list);
_r8712_init_sta_xmit_priv(&psta->sta_xmitpriv);
_r8712_init_sta_recv_priv(&psta->sta_recvpriv);
- _init_listhead(&psta->asoc_list);
- _init_listhead(&psta->auth_list);
+ INIT_LIST_HEAD(&psta->asoc_list);
+ INIT_LIST_HEAD(&psta->auth_list);
}

u32 _r8712_init_sta_priv(struct sta_priv *pstapriv)
@@ -65,13 +65,13 @@ u32 _r8712_init_sta_priv(struct sta_priv *pstapriv)
psta = (struct sta_info *)(pstapriv->pstainfo_buf);
for (i = 0; i < NUM_STA; i++) {
_init_stainfo(psta);
- _init_listhead(&(pstapriv->sta_hash[i]));
+ INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
list_insert_tail(&psta->list,
get_list_head(&pstapriv->free_sta_queue));
psta++;
}
- _init_listhead(&pstapriv->asoc_list);
- _init_listhead(&pstapriv->auth_list);
+ INIT_LIST_HEAD(&pstapriv->asoc_list);
+ INIT_LIST_HEAD(&pstapriv->auth_list);
return _SUCCESS;
}

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 230681a..68bfab0 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -43,7 +43,7 @@ static void free_hwxmits(struct _adapter *padapter);

static void _init_txservq(struct tx_servq *ptxservq)
{
- _init_listhead(&ptxservq->tx_pending);
+ INIT_LIST_HEAD(&ptxservq->tx_pending);
_init_queue(&ptxservq->sta_pending);
ptxservq->qcnt = 0;
}
@@ -57,8 +57,8 @@ void _r8712_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv)
_init_txservq(&psta_xmitpriv->bk_q);
_init_txservq(&psta_xmitpriv->vi_q);
_init_txservq(&psta_xmitpriv->vo_q);
- _init_listhead(&psta_xmitpriv->legacy_dz);
- _init_listhead(&psta_xmitpriv->apsd);
+ INIT_LIST_HEAD(&psta_xmitpriv->legacy_dz);
+ INIT_LIST_HEAD(&psta_xmitpriv->apsd);
}

sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
@@ -97,7 +97,7 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
((addr_t) (pxmitpriv->pallocated_frame_buf) & 3);
pxframe = (struct xmit_frame *) pxmitpriv->pxmit_frame_buf;
for (i = 0; i < NR_XMITFRAME; i++) {
- _init_listhead(&(pxframe->list));
+ INIT_LIST_HEAD(&(pxframe->list));
pxframe->padapter = padapter;
pxframe->frame_tag = DATA_FRAMETAG;
pxframe->pkt = NULL;
@@ -134,7 +134,7 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
((addr_t)(pxmitpriv->pallocated_xmitbuf) & 3);
pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
for (i = 0; i < NR_XMITBUFF; i++) {
- _init_listhead(&pxmitbuf->list);
+ INIT_LIST_HEAD(&pxmitbuf->list);
pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ,
GFP_ATOMIC);
if (pxmitbuf->pallocated_buf == NULL)
@@ -1005,7 +1005,7 @@ static void init_hwxmits(struct hw_xmit *phwxmit, sint entry)

for (i = 0; i < entry; i++, phwxmit++) {
spin_lock_init(&phwxmit->xmit_lock);
- _init_listhead(&phwxmit->pending);
+ INIT_LIST_HEAD(&phwxmit->pending);
phwxmit->txcmdcnt = 0;
phwxmit->accnt = 0;
}
--
1.7.9.5


2014-06-25 02:53:38

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 6/8] staging: rtl8712: remove function get_list_head

get_list_head is an inline that returns &list->head. This patch removes this
inline and directly applies &list->head where applicable.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 5 -----
drivers/staging/rtl8712/rtl8712_recv.c | 15 +++++++--------
drivers/staging/rtl8712/rtl8712_xmit.c | 4 ++--
drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 8 ++++----
drivers/staging/rtl8712/rtl871x_ioctl_set.c | 2 +-
drivers/staging/rtl8712/rtl871x_mlme.c | 12 ++++++------
drivers/staging/rtl8712/rtl871x_recv.c | 4 ++--
drivers/staging/rtl8712/rtl871x_sta_mgt.c | 7 +++----
drivers/staging/rtl8712/rtl871x_xmit.c | 16 +++++++---------
9 files changed, 32 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 4f30c4c..cb279b9 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -58,11 +58,6 @@ struct __queue {
spin_lock_init(&((pqueue)->lock)); \
} while (0)

-static inline struct list_head *get_list_head(struct __queue *queue)
-{
- return &(queue->queue);
-}
-
#define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index a5f41f4..b759c9b 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -146,8 +146,7 @@ int r8712_free_recvframe(union recv_frame *precvframe,
}
spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
list_del_init(&(precvframe->u.hdr.list));
- list_add_tail(&(precvframe->u.hdr.list),
- get_list_head(pfree_recv_queue));
+ list_add_tail(&(precvframe->u.hdr.list), &pfree_recv_queue->queue);
if (padapter != NULL) {
if (pfree_recv_queue == &precvpriv->free_recv_queue)
precvpriv->free_recvframe_cnt++;
@@ -208,7 +207,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
struct __queue *pfree_recv_queue;

pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
- phead = get_list_head(defrag_q);
+ phead = &defrag_q->queue;
plist = phead->next;
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
list_del_init(&prframe->u.list);
@@ -222,7 +221,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
return NULL;
}
curfragnum++;
- plist = get_list_head(defrag_q);
+ plist = &defrag_q->queue;
plist = plist->next;
data = get_recvframe_data(prframe);
while (end_of_queue_search(phead, plist) == false) {
@@ -296,7 +295,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
}
}
/* Then enqueue the 0~(n-1) fragment to the defrag_q */
- phead = get_list_head(pdefrag_q);
+ phead = &pdefrag_q->queue;
list_add_tail(&pfhdr->list, phead);
prtnframe = NULL;
} else {
@@ -311,7 +310,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
/* the last fragment frame
* enqueue the last fragment */
if (pdefrag_q != NULL) {
- phead = get_list_head(pdefrag_q);
+ phead = &pdefrag_q->queue;
list_add_tail(&pfhdr->list, phead);
/*call recvframe_defrag to defrag*/
precv_frame = recvframe_defrag(padapter, pdefrag_q);
@@ -499,7 +498,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
&preorder_ctrl->pending_recvframe_queue;
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;

- phead = get_list_head(ppending_recvframe_queue);
+ phead = &ppending_recvframe_queue->queue;
plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
@@ -528,7 +527,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
struct __queue *ppending_recvframe_queue =
&preorder_ctrl->pending_recvframe_queue;

- phead = get_list_head(ppending_recvframe_queue);
+ phead = &ppending_recvframe_queue->queue;
plist = phead->next;
/* Handling some condition for forced indicate case.*/
if (bforced == true) {
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c
index c4078fa..f3d2998 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -166,7 +166,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv,
struct list_head *xmitframe_plist, *xmitframe_phead;
struct xmit_frame *pxmitframe = NULL;

- xmitframe_phead = get_list_head(pframe_queue);
+ xmitframe_phead = &pframe_queue->queue;
xmitframe_plist = xmitframe_phead->next;
if ((end_of_queue_search(xmitframe_phead, xmitframe_plist)) == false) {
pxmitframe = LIST_CONTAINOR(xmitframe_plist,
@@ -210,7 +210,7 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv,
spin_lock_irqsave(&pxmitpriv->lock, irqL0);
for (i = 0; i < entry; i++) {
phwxmit = phwxmit_i + inx[i];
- sta_phead = get_list_head(phwxmit->sta_queue);
+ sta_phead = &phwxmit->sta_queue->queue;
sta_plist = sta_phead->next;
while ((end_of_queue_search(sta_phead, sta_plist)) == false) {
ptxservq = LIST_CONTAINOR(sta_plist, struct tx_servq,
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index cd7d370..e1e95cf 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1078,7 +1078,7 @@ static int r8711_wx_set_wap(struct net_device *dev,
return -EINVAL;
authmode = padapter->securitypriv.ndisauthtype;
spin_lock_irqsave(&queue->lock, irqL);
- phead = get_list_head(queue);
+ phead = &queue->queue;
pmlmepriv->pscanned = phead->next;
while (1) {
if (end_of_queue_search(phead, pmlmepriv->pscanned) == true)
@@ -1227,7 +1227,7 @@ static int r8711_wx_get_scan(struct net_device *dev,
break;
}
spin_lock_irqsave(&queue->lock, irqL);
- phead = get_list_head(queue);
+ phead = &queue->queue;
plist = phead->next;
while (1) {
if (end_of_queue_search(phead, plist) == true)
@@ -1286,7 +1286,7 @@ static int r8711_wx_set_essid(struct net_device *dev,
ndis_ssid.SsidLength = len;
memcpy(ndis_ssid.Ssid, extra, len);
src_ssid = ndis_ssid.Ssid;
- phead = get_list_head(queue);
+ phead = &queue->queue;
pmlmepriv->pscanned = phead->next;
while (1) {
if (end_of_queue_search(phead, pmlmepriv->pscanned))
@@ -2002,7 +2002,7 @@ static int r871x_get_ap_info(struct net_device *dev,
} else
return -EINVAL;
spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
- phead = get_list_head(queue);
+ phead = &queue->queue;
plist = phead->next;
while (1) {
if (end_of_queue_search(phead, plist) == true)
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
index 87dce03..226f247 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -62,7 +62,7 @@ static u8 do_join(struct _adapter *padapter)
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct __queue *queue = &(pmlmepriv->scanned_queue);

- phead = get_list_head(queue);
+ phead = &queue->queue;
plist = phead->next;
pmlmepriv->cur_network.join_res = -2;
pmlmepriv->fw_state |= _FW_UNDER_LINKING;
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 7ca13b9..d37ba7b 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -133,7 +133,7 @@ static void _free_network_nolock(struct mlme_priv *pmlmepriv,
if (pnetwork->fixed == true)
return;
list_del_init(&pnetwork->list);
- list_add_tail(&pnetwork->list, get_list_head(free_queue));
+ list_add_tail(&pnetwork->list, &free_queue->queue);
pmlmepriv->num_of_scanned--;
}

@@ -153,7 +153,7 @@ static struct wlan_network *_r8712_find_network(struct __queue *scanned_queue,
if (is_zero_ether_addr(addr))
return NULL;
spin_lock_irqsave(&scanned_queue->lock, irqL);
- phead = get_list_head(scanned_queue);
+ phead = &scanned_queue->queue;
plist = phead->next;
while (plist != phead) {
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
@@ -174,7 +174,7 @@ static void _free_network_queue(struct _adapter *padapter)
struct __queue *scanned_queue = &pmlmepriv->scanned_queue;

spin_lock_irqsave(&scanned_queue->lock, irqL);
- phead = get_list_head(scanned_queue);
+ phead = &scanned_queue->queue;
plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
@@ -315,7 +315,7 @@ struct wlan_network *r8712_get_oldest_wlan_network(
struct wlan_network *pwlan = NULL;
struct wlan_network *oldest = NULL;

- phead = get_list_head(scanned_queue);
+ phead = &scanned_queue->queue;
plist = phead->next;
while (1) {
if (end_of_queue_search(phead, plist) == true)
@@ -398,7 +398,7 @@ static void update_scanned_network(struct _adapter *adapter,
struct wlan_network *pnetwork = NULL;
struct wlan_network *oldest = NULL;

- phead = get_list_head(queue);
+ phead = &queue->queue;
plist = phead->next;

while (1) {
@@ -1138,7 +1138,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)

adapter = (struct _adapter *)pmlmepriv->nic_hdl;
queue = &pmlmepriv->scanned_queue;
- phead = get_list_head(queue);
+ phead = &queue->queue;
pmlmepriv->pscanned = phead->next;
while (1) {
if (end_of_queue_search(phead, pmlmepriv->pscanned) == true) {
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
index 114e9f3..cc2ca11 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -115,7 +115,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)
if (_queue_empty(pfree_recv_queue) == true)
precvframe = NULL;
else {
- phead = get_list_head(pfree_recv_queue);
+ phead = &pfree_recv_queue->queue;
plist = phead->next;
precvframe = LIST_CONTAINOR(plist, union recv_frame, u);
list_del_init(&precvframe->u.hdr.list);
@@ -145,7 +145,7 @@ void r8712_free_recvframe_queue(struct __queue *pframequeue,
struct list_head *plist, *phead;

spin_lock(&pframequeue->lock);
- phead = get_list_head(pframequeue);
+ phead = &pframequeue->queue;
plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
precvframe = LIST_CONTAINOR(plist, union recv_frame, u);
diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
index 7db8921..73ca66e 100644
--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
+++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
@@ -66,8 +66,7 @@ u32 _r8712_init_sta_priv(struct sta_priv *pstapriv)
for (i = 0; i < NUM_STA; i++) {
_init_stainfo(psta);
INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
- list_add_tail(&psta->list,
- get_list_head(&pstapriv->free_sta_queue));
+ list_add_tail(&psta->list, &pstapriv->free_sta_queue.queue);
psta++;
}
INIT_LIST_HEAD(&pstapriv->asoc_list);
@@ -83,7 +82,7 @@ static void mfree_all_stainfo(struct sta_priv *pstapriv)
struct sta_info *psta = NULL;

spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
- phead = get_list_head(&pstapriv->free_sta_queue);
+ phead = &pstapriv->free_sta_queue.queue;
plist = phead->next;
while ((end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist, struct sta_info, list);
@@ -208,7 +207,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta)
}
spin_lock(&(pfree_sta_queue->lock));
/* insert into free_sta_queue; 20061114 */
- list_add_tail(&psta->list, get_list_head(pfree_sta_queue));
+ list_add_tail(&psta->list, &pfree_sta_queue->queue);
spin_unlock(&(pfree_sta_queue->lock));
}

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 29a9f50..4b3fa40 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -747,7 +747,7 @@ struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv)
if (_queue_empty(pfree_xmitbuf_queue) == true)
pxmitbuf = NULL;
else {
- phead = get_list_head(pfree_xmitbuf_queue);
+ phead = &pfree_xmitbuf_queue->queue;
plist = phead->next;
pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list);
list_del_init(&(pxmitbuf->list));
@@ -767,7 +767,7 @@ int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
return _FAIL;
spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
list_del_init(&pxmitbuf->list);
- list_add_tail(&(pxmitbuf->list), get_list_head(pfree_xmitbuf_queue));
+ list_add_tail(&(pxmitbuf->list), &pfree_xmitbuf_queue->queue);
pxmitpriv->free_xmitbuf_cnt++;
spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, irqL);
return _SUCCESS;
@@ -801,7 +801,7 @@ struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv)
if (_queue_empty(pfree_xmit_queue) == true)
pxframe = NULL;
else {
- phead = get_list_head(pfree_xmit_queue);
+ phead = &pfree_xmit_queue->queue;
plist = phead->next;
pxframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
list_del_init(&(pxframe->list));
@@ -833,7 +833,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
pndis_pkt = pxmitframe->pkt;
pxmitframe->pkt = NULL;
}
- list_add_tail(&pxmitframe->list, get_list_head(pfree_xmit_queue));
+ list_add_tail(&pxmitframe->list, &pfree_xmit_queue->queue);
pxmitpriv->free_xmitframe_cnt++;
spin_unlock_irqrestore(&pfree_xmit_queue->lock, irqL);
if (netif_queue_stopped(padapter->pnetdev))
@@ -857,7 +857,7 @@ void r8712_free_xmitframe_queue(struct xmit_priv *pxmitpriv,
struct xmit_frame *pxmitframe;

spin_lock_irqsave(&(pframequeue->lock), irqL);
- phead = get_list_head(pframequeue);
+ phead = &pframequeue->queue;
plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
@@ -940,10 +940,8 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
psta, pattrib->priority);
spin_lock_irqsave(&pstapending->lock, irqL0);
if (list_empty(&ptxservq->tx_pending))
- list_add_tail(&ptxservq->tx_pending,
- get_list_head(pstapending));
- list_add_tail(&pxmitframe->list,
- get_list_head(&ptxservq->sta_pending));
+ list_add_tail(&ptxservq->tx_pending, &pstapending->queue);
+ list_add_tail(&pxmitframe->list, &ptxservq->sta_pending.queue);
ptxservq->qcnt++;
spin_unlock_irqrestore(&pstapending->lock, irqL0);
return _SUCCESS;
--
1.7.9.5

2014-06-25 02:53:25

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 2/8] staging: rtl8712: remove wrapper function is_list_empty

is_list_empty is just an inline wrapper around list_empty. This patch
removes the wrapper and directly uses list_empty instead.

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

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 17c28c8..58f2090 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -115,14 +115,6 @@ For the following list_xxx operations,
caller must guarantee the atomic context.
Otherwise, there will be racing condition.
*/
-static inline u32 is_list_empty(struct list_head *phead)
-{
- if (list_empty(phead))
- return true;
- else
- return false;
-}
-
static inline void list_insert_tail(struct list_head *plist,
struct list_head *phead)
{
@@ -139,7 +131,7 @@ static inline u32 _down_sema(struct semaphore *sema)

static inline u32 _queue_empty(struct __queue *pqueue)
{
- return is_list_empty(&(pqueue->queue));
+ return list_empty(&(pqueue->queue));
}

static inline u32 end_of_queue_search(struct list_head *head,
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index f87a8fd..22840a1 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -532,7 +532,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
plist = get_next(phead);
/* Handling some condition for forced indicate case.*/
if (bforced == true) {
- if (is_list_empty(phead))
+ if (list_empty(phead))
return true;
else {
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
@@ -542,7 +542,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
}
/* Prepare indication list and indication.
* Check if there is any packet need indicate. */
- while (!is_list_empty(phead)) {
+ while (!list_empty(phead)) {
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
pattrib = &prframe->u.hdr.attrib;
if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) {
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index 646c5cd..689364d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -137,7 +137,7 @@ static struct cmd_obj *_dequeue_cmd(struct __queue *queue)
struct cmd_obj *obj;

spin_lock_irqsave(&(queue->lock), irqL);
- if (is_list_empty(&(queue->queue)))
+ if (list_empty(&(queue->queue)))
obj = NULL;
else {
obj = LIST_CONTAINOR(get_next(&(queue->queue)),
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 68bfab0..989fb67 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -939,7 +939,7 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
ptxservq = get_sta_pending(padapter, &pstapending,
psta, pattrib->priority);
spin_lock_irqsave(&pstapending->lock, irqL0);
- if (is_list_empty(&ptxservq->tx_pending))
+ if (list_empty(&ptxservq->tx_pending))
list_insert_tail(&ptxservq->tx_pending,
get_list_head(pstapending));
list_insert_tail(&pxmitframe->list,
--
1.7.9.5

2014-06-25 02:53:33

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 4/8] staging: rtl8712: remove wrapper function list_delete

list_delete is just an inline wrapper around list_del_init. This patch
removes the wrapper and directly uses list_del_init.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 5 -----
drivers/staging/rtl8712/rtl8712_recv.c | 8 ++++----
drivers/staging/rtl8712/rtl8712_xmit.c | 4 ++--
drivers/staging/rtl8712/rtl871x_cmd.c | 2 +-
drivers/staging/rtl8712/rtl871x_mlme.c | 6 +++---
drivers/staging/rtl8712/rtl871x_recv.c | 2 +-
drivers/staging/rtl8712/rtl871x_sta_mgt.c | 12 ++++++------
drivers/staging/rtl8712/rtl871x_xmit.c | 8 ++++----
8 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index bc5e922..1a137ce 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -71,11 +71,6 @@ static inline struct list_head *get_list_head(struct __queue *queue)
#define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))

-static inline void list_delete(struct list_head *plist)
-{
- list_del_init(plist);
-}
-
static inline void _init_timer(struct timer_list *ptimer,
struct net_device *padapter,
void *pfunc, void *cntx)
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index b510312..3c9d2e0 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -145,7 +145,7 @@ int r8712_free_recvframe(union recv_frame *precvframe,
precvframe->u.hdr.pkt = NULL;
}
spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
- list_delete(&(precvframe->u.hdr.list));
+ list_del_init(&(precvframe->u.hdr.list));
list_add_tail(&(precvframe->u.hdr.list),
get_list_head(pfree_recv_queue));
if (padapter != NULL) {
@@ -211,7 +211,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
phead = get_list_head(defrag_q);
plist = get_next(phead);
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
- list_delete(&prframe->u.list);
+ list_del_init(&prframe->u.list);
pfhdr = &prframe->u.hdr;
curfragnum = 0;
if (curfragnum != pfhdr->attrib.frag_num) {
@@ -511,7 +511,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
else
break;
}
- list_delete(&(prframe->u.hdr.list));
+ list_del_init(&(prframe->u.hdr.list));
list_add_tail(&(prframe->u.hdr.list), plist);
return true;
}
@@ -547,7 +547,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
pattrib = &prframe->u.hdr.attrib;
if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) {
plist = get_next(plist);
- list_delete(&(prframe->u.hdr.list));
+ list_del_init(&(prframe->u.hdr.list));
if (SN_EQUAL(preorder_ctrl->indicate_seq,
pattrib->seq_num))
preorder_ctrl->indicate_seq =
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c
index 4e3f094..56aa209 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -171,7 +171,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv,
if ((end_of_queue_search(xmitframe_phead, xmitframe_plist)) == false) {
pxmitframe = LIST_CONTAINOR(xmitframe_plist,
struct xmit_frame, list);
- list_delete(&pxmitframe->list);
+ list_del_init(&pxmitframe->list);
ptxservq->qcnt--;
phwxmit->txcmdcnt++;
}
@@ -226,7 +226,7 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv,
/*Remove sta node when there are no pending packets.*/
if (_queue_empty(pframe_queue)) {
/*must be done after get_next and before break*/
- list_delete(&ptxservq->tx_pending);
+ list_del_init(&ptxservq->tx_pending);
}
}
}
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index cae8ee6..338bb14 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -142,7 +142,7 @@ static struct cmd_obj *_dequeue_cmd(struct __queue *queue)
else {
obj = LIST_CONTAINOR(get_next(&(queue->queue)),
struct cmd_obj, list);
- list_delete(&obj->list);
+ list_del_init(&obj->list);
}
spin_unlock_irqrestore(&(queue->lock), irqL);
return obj;
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 05ff7dd..943d25a 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -94,7 +94,7 @@ struct wlan_network *_r8712_alloc_network(struct mlme_priv *pmlmepriv)
spin_lock_irqsave(&free_queue->lock, irqL);
plist = get_next(&(free_queue->queue));
pnetwork = LIST_CONTAINOR(plist , struct wlan_network, list);
- list_delete(&pnetwork->list);
+ list_del_init(&pnetwork->list);
pnetwork->last_scanned = jiffies;
pmlmepriv->num_of_scanned++;
spin_unlock_irqrestore(&free_queue->lock, irqL);
@@ -117,7 +117,7 @@ static void _free_network(struct mlme_priv *pmlmepriv,
if (delta_time < SCANQUEUE_LIFETIME)
return;
spin_lock_irqsave(&free_queue->lock, irqL);
- list_delete(&pnetwork->list);
+ list_del_init(&pnetwork->list);
list_add_tail(&pnetwork->list, &free_queue->queue);
pmlmepriv->num_of_scanned--;
spin_unlock_irqrestore(&free_queue->lock, irqL);
@@ -132,7 +132,7 @@ static void _free_network_nolock(struct mlme_priv *pmlmepriv,
return;
if (pnetwork->fixed == true)
return;
- list_delete(&pnetwork->list);
+ list_del_init(&pnetwork->list);
list_add_tail(&pnetwork->list, get_list_head(free_queue));
pmlmepriv->num_of_scanned--;
}
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
index cd31982..246b8ce 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -118,7 +118,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)
phead = get_list_head(pfree_recv_queue);
plist = get_next(phead);
precvframe = LIST_CONTAINOR(plist, union recv_frame, u);
- list_delete(&precvframe->u.hdr.list);
+ list_del_init(&precvframe->u.hdr.list);
padapter = precvframe->u.hdr.adapter;
if (padapter != NULL) {
precvpriv = &padapter->recvpriv;
diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
index e7f3cdb..92d5327 100644
--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
+++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
@@ -127,7 +127,7 @@ struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
else {
psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue),
struct sta_info, list);
- list_delete(&(psta->list));
+ list_del_init(&(psta->list));
tmp_aid = psta->aid;
_init_stainfo(psta);
memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
@@ -181,21 +181,21 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta)
pstaxmitpriv = &psta->sta_xmitpriv;
spin_lock_irqsave(&(pxmitpriv->vo_pending.lock), irqL0);
r8712_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
- list_delete(&(pstaxmitpriv->vo_q.tx_pending));
+ list_del_init(&(pstaxmitpriv->vo_q.tx_pending));
spin_unlock_irqrestore(&(pxmitpriv->vo_pending.lock), irqL0);
spin_lock_irqsave(&(pxmitpriv->vi_pending.lock), irqL0);
r8712_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
- list_delete(&(pstaxmitpriv->vi_q.tx_pending));
+ list_del_init(&(pstaxmitpriv->vi_q.tx_pending));
spin_unlock_irqrestore(&(pxmitpriv->vi_pending.lock), irqL0);
spin_lock_irqsave(&(pxmitpriv->bk_pending.lock), irqL0);
r8712_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
- list_delete(&(pstaxmitpriv->bk_q.tx_pending));
+ list_del_init(&(pstaxmitpriv->bk_q.tx_pending));
spin_unlock_irqrestore(&(pxmitpriv->bk_pending.lock), irqL0);
spin_lock_irqsave(&(pxmitpriv->be_pending.lock), irqL0);
r8712_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
- list_delete(&(pstaxmitpriv->be_q.tx_pending));
+ list_del_init(&(pstaxmitpriv->be_q.tx_pending));
spin_unlock_irqrestore(&(pxmitpriv->be_pending.lock), irqL0);
- list_delete(&psta->hash_list);
+ list_del_init(&psta->hash_list);
pstapriv->asoc_sta_count--;
/* re-init sta_info; 20061114 */
_r8712_init_sta_xmit_priv(&psta->sta_xmitpriv);
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 71d0d0d..2e79e4e 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -750,7 +750,7 @@ struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv)
phead = get_list_head(pfree_xmitbuf_queue);
plist = get_next(phead);
pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list);
- list_delete(&(pxmitbuf->list));
+ list_del_init(&(pxmitbuf->list));
}
if (pxmitbuf != NULL)
pxmitpriv->free_xmitbuf_cnt--;
@@ -766,7 +766,7 @@ int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
if (pxmitbuf == NULL)
return _FAIL;
spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
- list_delete(&pxmitbuf->list);
+ list_del_init(&pxmitbuf->list);
list_add_tail(&(pxmitbuf->list), get_list_head(pfree_xmitbuf_queue));
pxmitpriv->free_xmitbuf_cnt++;
spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, irqL);
@@ -804,7 +804,7 @@ struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv)
phead = get_list_head(pfree_xmit_queue);
plist = get_next(phead);
pxframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
- list_delete(&(pxframe->list));
+ list_del_init(&(pxframe->list));
}
if (pxframe != NULL) {
pxmitpriv->free_xmitframe_cnt--;
@@ -828,7 +828,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
if (pxmitframe == NULL)
return;
spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
- list_delete(&pxmitframe->list);
+ list_del_init(&pxmitframe->list);
if (pxmitframe->pkt) {
pndis_pkt = pxmitframe->pkt;
pxmitframe->pkt = NULL;
--
1.7.9.5

2014-06-25 02:53:44

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 8/8] staging: rtl8712: remove inapplicable comment

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 77b1443..3dfc473 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -95,11 +95,6 @@ static inline void _set_workitem(_workitem *pwork)
#define BIT(x) (1 << (x))
#endif

-/*
-For the following list_xxx operations,
-caller must guarantee the atomic context.
-Otherwise, there will be racing condition.
-*/
static inline u32 _down_sema(struct semaphore *sema)
{
if (down_interruptible(sema))
--
1.7.9.5

2014-06-25 02:54:03

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 7/8] staging: rtl8712: remove wrapper function _queue_empty

_queue_empty is an inline wrapper around list_empty. This patch removes this
wrapper function and instead calls list_empty directly.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 5 -----
drivers/staging/rtl8712/rtl8712_cmd.c | 2 +-
drivers/staging/rtl8712/rtl8712_recv.c | 2 +-
drivers/staging/rtl8712/rtl8712_xmit.c | 2 +-
drivers/staging/rtl8712/rtl871x_ioctl_set.c | 2 +-
drivers/staging/rtl8712/rtl871x_mlme.c | 4 ++--
drivers/staging/rtl8712/rtl871x_recv.c | 2 +-
drivers/staging/rtl8712/rtl871x_sta_mgt.c | 2 +-
drivers/staging/rtl8712/rtl871x_xmit.c | 4 ++--
9 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index cb279b9..77b1443 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -108,11 +108,6 @@ static inline u32 _down_sema(struct semaphore *sema)
return _SUCCESS;
}

-static inline u32 _queue_empty(struct __queue *pqueue)
-{
- return list_empty(&(pqueue->queue));
-}
-
static inline u32 end_of_queue_search(struct list_head *head,
struct list_head *plist)
{
diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c
index 8ca7d7e..1d81d2c 100644
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
@@ -410,7 +410,7 @@ _next:
}
}
r8712_free_cmd_obj(pcmd);
- if (_queue_empty(&(pcmdpriv->cmd_queue))) {
+ if (list_empty(&pcmdpriv->cmd_queue.queue)) {
r8712_unregister_cmd_alive(padapter);
continue;
} else
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index b759c9b..f0ec89c 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -288,7 +288,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
if (pdefrag_q != NULL) {
if (fragnum == 0) {
/*the first fragment*/
- if (_queue_empty(pdefrag_q) == false) {
+ if (!list_empty(&pdefrag_q->queue)) {
/*free current defrag_q */
r8712_free_recvframe_queue(pdefrag_q,
pfree_recv_queue);
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c
index f3d2998..4ebedb4 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -224,7 +224,7 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv,
}
sta_plist = sta_plist->next;
/*Remove sta node when there are no pending packets.*/
- if (_queue_empty(pframe_queue)) {
+ if (list_empty(&pframe_queue->queue)) {
/* must be done after sta_plist->next
* and before break
*/
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
index 226f247..9d47eb4 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -71,7 +71,7 @@ static u8 do_join(struct _adapter *padapter)

/* adhoc mode will start with an empty queue, but skip checking */
if (!check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) &&
- _queue_empty(queue)) {
+ list_empty(&queue->queue)) {
if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
pmlmepriv->fw_state ^= _FW_UNDER_LINKING;
/* when set_ssid/set_bssid for do_join(), but scanning queue
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index d37ba7b..7b7fdec 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -89,7 +89,7 @@ struct wlan_network *_r8712_alloc_network(struct mlme_priv *pmlmepriv)
struct __queue *free_queue = &pmlmepriv->free_bss_pool;
struct list_head *plist = NULL;

- if (_queue_empty(free_queue) == true)
+ if (list_empty(&free_queue->queue))
return NULL;
spin_lock_irqsave(&free_queue->lock, irqL);
plist = free_queue->queue.next;
@@ -420,7 +420,7 @@ static void update_scanned_network(struct _adapter *adapter,
/* If we didn't find a match, then get a new network slot to initialize
* with this beacon's information */
if (end_of_queue_search(phead, plist) == true) {
- if (_queue_empty(&pmlmepriv->free_bss_pool) == true) {
+ if (list_empty(&pmlmepriv->free_bss_pool.queue)) {
/* If there are no more slots, expire the oldest */
pnetwork = oldest;
target->Rssi = (pnetwork->network.Rssi +
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
index cc2ca11..a3889d1 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -112,7 +112,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)
struct recv_priv *precvpriv;

spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
- if (_queue_empty(pfree_recv_queue) == true)
+ if (list_empty(&pfree_recv_queue->queue))
precvframe = NULL;
else {
phead = &pfree_recv_queue->queue;
diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
index 73ca66e..e769bb5 100644
--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
+++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
@@ -121,7 +121,7 @@ struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)

pfree_sta_queue = &pstapriv->free_sta_queue;
spin_lock_irqsave(&(pfree_sta_queue->lock), flags);
- if (_queue_empty(pfree_sta_queue) == true)
+ if (list_empty(&pfree_sta_queue->queue))
psta = NULL;
else {
psta = LIST_CONTAINOR(pfree_sta_queue->queue.next,
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 4b3fa40..a104b77 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -744,7 +744,7 @@ struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv)
struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue;

spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
- if (_queue_empty(pfree_xmitbuf_queue) == true)
+ if (list_empty(&pfree_xmitbuf_queue->queue))
pxmitbuf = NULL;
else {
phead = &pfree_xmitbuf_queue->queue;
@@ -798,7 +798,7 @@ struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv)
struct __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;

spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
- if (_queue_empty(pfree_xmit_queue) == true)
+ if (list_empty(&pfree_xmit_queue->queue))
pxframe = NULL;
else {
phead = &pfree_xmit_queue->queue;
--
1.7.9.5

2014-06-25 02:54:25

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 5/8] staging: rtl8712: remove wrapper function get_next

get_next is just an inline wrapper around return list->next. This
patch removes the wrapper and directly uses list->next where
applicable.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 5 -----
drivers/staging/rtl8712/rtl8712_recv.c | 14 +++++++-------
drivers/staging/rtl8712/rtl8712_xmit.c | 10 ++++++----
drivers/staging/rtl8712/rtl871x_cmd.c | 2 +-
drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 16 ++++++++--------
drivers/staging/rtl8712/rtl871x_ioctl_set.c | 2 +-
drivers/staging/rtl8712/rtl871x_mlme.c | 22 +++++++++++-----------
drivers/staging/rtl8712/rtl871x_recv.c | 6 +++---
drivers/staging/rtl8712/rtl871x_sta_mgt.c | 14 +++++++-------
drivers/staging/rtl8712/rtl871x_xmit.c | 8 ++++----
10 files changed, 48 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 1a137ce..4f30c4c 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -58,11 +58,6 @@ struct __queue {
spin_lock_init(&((pqueue)->lock)); \
} while (0)

-static inline struct list_head *get_next(struct list_head *list)
-{
- return list->next;
-}
-
static inline struct list_head *get_list_head(struct __queue *queue)
{
return &(queue->queue);
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 3c9d2e0..a5f41f4 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -209,7 +209,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,

pfree_recv_queue = &adapter->recvpriv.free_recv_queue;
phead = get_list_head(defrag_q);
- plist = get_next(phead);
+ plist = phead->next;
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
list_del_init(&prframe->u.list);
pfhdr = &prframe->u.hdr;
@@ -223,7 +223,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
}
curfragnum++;
plist = get_list_head(defrag_q);
- plist = get_next(plist);
+ plist = plist->next;
data = get_recvframe_data(prframe);
while (end_of_queue_search(phead, plist) == false) {
pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
@@ -247,7 +247,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
memcpy(pfhdr->rx_tail, pnfhdr->rx_data, pnfhdr->len);
recvframe_put(prframe, pnfhdr->len);
pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
- plist = get_next(plist);
+ plist = plist->next;
}
/* free the defrag_q queue and return the prframe */
r8712_free_recvframe_queue(defrag_q, pfree_recv_queue);
@@ -500,12 +500,12 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;

phead = get_list_head(ppending_recvframe_queue);
- plist = get_next(phead);
+ plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
pnextattrib = &pnextrframe->u.hdr.attrib;
if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num))
- plist = get_next(plist);
+ plist = plist->next;
else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num))
return false;
else
@@ -529,7 +529,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
&preorder_ctrl->pending_recvframe_queue;

phead = get_list_head(ppending_recvframe_queue);
- plist = get_next(phead);
+ plist = phead->next;
/* Handling some condition for forced indicate case.*/
if (bforced == true) {
if (list_empty(phead))
@@ -546,7 +546,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
prframe = LIST_CONTAINOR(plist, union recv_frame, u);
pattrib = &prframe->u.hdr.attrib;
if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) {
- plist = get_next(plist);
+ plist = plist->next;
list_del_init(&(prframe->u.hdr.list));
if (SN_EQUAL(preorder_ctrl->indicate_seq,
pattrib->seq_num))
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c
index 56aa209..c4078fa 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -167,7 +167,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv,
struct xmit_frame *pxmitframe = NULL;

xmitframe_phead = get_list_head(pframe_queue);
- xmitframe_plist = get_next(xmitframe_phead);
+ xmitframe_plist = xmitframe_phead->next;
if ((end_of_queue_search(xmitframe_phead, xmitframe_plist)) == false) {
pxmitframe = LIST_CONTAINOR(xmitframe_plist,
struct xmit_frame, list);
@@ -211,7 +211,7 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv,
for (i = 0; i < entry; i++) {
phwxmit = phwxmit_i + inx[i];
sta_phead = get_list_head(phwxmit->sta_queue);
- sta_plist = get_next(sta_phead);
+ sta_plist = sta_phead->next;
while ((end_of_queue_search(sta_phead, sta_plist)) == false) {
ptxservq = LIST_CONTAINOR(sta_plist, struct tx_servq,
tx_pending);
@@ -222,10 +222,12 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv,
phwxmit->accnt--;
goto exit_dequeue_xframe_ex;
}
- sta_plist = get_next(sta_plist);
+ sta_plist = sta_plist->next;
/*Remove sta node when there are no pending packets.*/
if (_queue_empty(pframe_queue)) {
- /*must be done after get_next and before break*/
+ /* must be done after sta_plist->next
+ * and before break
+ */
list_del_init(&ptxservq->tx_pending);
}
}
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index 338bb14..d9c1561 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -140,7 +140,7 @@ static struct cmd_obj *_dequeue_cmd(struct __queue *queue)
if (list_empty(&(queue->queue)))
obj = NULL;
else {
- obj = LIST_CONTAINOR(get_next(&(queue->queue)),
+ obj = LIST_CONTAINOR(queue->queue.next,
struct cmd_obj, list);
list_del_init(&obj->list);
}
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 6d6f15d..cd7d370 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1079,13 +1079,13 @@ static int r8711_wx_set_wap(struct net_device *dev,
authmode = padapter->securitypriv.ndisauthtype;
spin_lock_irqsave(&queue->lock, irqL);
phead = get_list_head(queue);
- pmlmepriv->pscanned = get_next(phead);
+ pmlmepriv->pscanned = phead->next;
while (1) {
if (end_of_queue_search(phead, pmlmepriv->pscanned) == true)
break;
pnetwork = LIST_CONTAINOR(pmlmepriv->pscanned,
struct wlan_network, list);
- pmlmepriv->pscanned = get_next(pmlmepriv->pscanned);
+ pmlmepriv->pscanned = pmlmepriv->pscanned->next;
dst_bssid = pnetwork->network.MacAddress;
if (!memcmp(dst_bssid, temp->sa_data, ETH_ALEN)) {
r8712_set_802_11_infrastructure_mode(padapter,
@@ -1228,7 +1228,7 @@ static int r8711_wx_get_scan(struct net_device *dev,
}
spin_lock_irqsave(&queue->lock, irqL);
phead = get_list_head(queue);
- plist = get_next(phead);
+ plist = phead->next;
while (1) {
if (end_of_queue_search(phead, plist) == true)
break;
@@ -1238,7 +1238,7 @@ static int r8711_wx_get_scan(struct net_device *dev,
}
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
ev = translate_scan(padapter, a, pnetwork, ev, stop);
- plist = get_next(plist);
+ plist = plist->next;
}
spin_unlock_irqrestore(&queue->lock, irqL);
wrqu->data.length = ev - extra;
@@ -1287,13 +1287,13 @@ static int r8711_wx_set_essid(struct net_device *dev,
memcpy(ndis_ssid.Ssid, extra, len);
src_ssid = ndis_ssid.Ssid;
phead = get_list_head(queue);
- pmlmepriv->pscanned = get_next(phead);
+ pmlmepriv->pscanned = phead->next;
while (1) {
if (end_of_queue_search(phead, pmlmepriv->pscanned))
break;
pnetwork = LIST_CONTAINOR(pmlmepriv->pscanned,
struct wlan_network, list);
- pmlmepriv->pscanned = get_next(pmlmepriv->pscanned);
+ pmlmepriv->pscanned = pmlmepriv->pscanned->next;
dst_ssid = pnetwork->network.Ssid.Ssid;
if ((!memcmp(dst_ssid, src_ssid, ndis_ssid.SsidLength))
&& (pnetwork->network.Ssid.SsidLength ==
@@ -2003,7 +2003,7 @@ static int r871x_get_ap_info(struct net_device *dev,
return -EINVAL;
spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
phead = get_list_head(queue);
- plist = get_next(phead);
+ plist = phead->next;
while (1) {
if (end_of_queue_search(phead, plist) == true)
break;
@@ -2031,7 +2031,7 @@ static int r871x_get_ap_info(struct net_device *dev,
break;
}
}
- plist = get_next(plist);
+ plist = plist->next;
}
spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock), irqL);
if (pdata->length >= 34) {
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
index 53a7c8c..87dce03 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -63,7 +63,7 @@ static u8 do_join(struct _adapter *padapter)
struct __queue *queue = &(pmlmepriv->scanned_queue);

phead = get_list_head(queue);
- plist = get_next(phead);
+ plist = phead->next;
pmlmepriv->cur_network.join_res = -2;
pmlmepriv->fw_state |= _FW_UNDER_LINKING;
pmlmepriv->pscanned = plist;
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 943d25a..7ca13b9 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -92,7 +92,7 @@ struct wlan_network *_r8712_alloc_network(struct mlme_priv *pmlmepriv)
if (_queue_empty(free_queue) == true)
return NULL;
spin_lock_irqsave(&free_queue->lock, irqL);
- plist = get_next(&(free_queue->queue));
+ plist = free_queue->queue.next;
pnetwork = LIST_CONTAINOR(plist , struct wlan_network, list);
list_del_init(&pnetwork->list);
pnetwork->last_scanned = jiffies;
@@ -154,10 +154,10 @@ static struct wlan_network *_r8712_find_network(struct __queue *scanned_queue,
return NULL;
spin_lock_irqsave(&scanned_queue->lock, irqL);
phead = get_list_head(scanned_queue);
- plist = get_next(phead);
+ plist = phead->next;
while (plist != phead) {
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
- plist = get_next(plist);
+ plist = plist->next;
if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN))
break;
}
@@ -175,10 +175,10 @@ static void _free_network_queue(struct _adapter *padapter)

spin_lock_irqsave(&scanned_queue->lock, irqL);
phead = get_list_head(scanned_queue);
- plist = get_next(phead);
+ plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
- plist = get_next(plist);
+ plist = plist->next;
_free_network(pmlmepriv, pnetwork);
}
spin_unlock_irqrestore(&scanned_queue->lock, irqL);
@@ -316,7 +316,7 @@ struct wlan_network *r8712_get_oldest_wlan_network(
struct wlan_network *oldest = NULL;

phead = get_list_head(scanned_queue);
- plist = get_next(phead);
+ plist = phead->next;
while (1) {
if (end_of_queue_search(phead, plist) == true)
break;
@@ -327,7 +327,7 @@ struct wlan_network *r8712_get_oldest_wlan_network(
(unsigned long)pwlan->last_scanned))
oldest = pwlan;
}
- plist = get_next(plist);
+ plist = plist->next;
}
return oldest;
}
@@ -399,7 +399,7 @@ static void update_scanned_network(struct _adapter *adapter,
struct wlan_network *oldest = NULL;

phead = get_list_head(queue);
- plist = get_next(phead);
+ plist = phead->next;

while (1) {
if (end_of_queue_search(phead, plist) == true)
@@ -413,7 +413,7 @@ static void update_scanned_network(struct _adapter *adapter,
(unsigned long)pnetwork->last_scanned))
oldest = pnetwork;

- plist = get_next(plist);
+ plist = plist->next;
}


@@ -1139,7 +1139,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
adapter = (struct _adapter *)pmlmepriv->nic_hdl;
queue = &pmlmepriv->scanned_queue;
phead = get_list_head(queue);
- pmlmepriv->pscanned = get_next(phead);
+ pmlmepriv->pscanned = phead->next;
while (1) {
if (end_of_queue_search(phead, pmlmepriv->pscanned) == true) {
if ((pmlmepriv->assoc_by_rssi == true) &&
@@ -1153,7 +1153,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
struct wlan_network, list);
if (pnetwork == NULL)
return _FAIL;
- pmlmepriv->pscanned = get_next(pmlmepriv->pscanned);
+ pmlmepriv->pscanned = pmlmepriv->pscanned->next;
if (pmlmepriv->assoc_by_bssid == true) {
dst_ssid = pnetwork->network.MacAddress;
src_ssid = pmlmepriv->assoc_bssid;
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
index 246b8ce..114e9f3 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -116,7 +116,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)
precvframe = NULL;
else {
phead = get_list_head(pfree_recv_queue);
- plist = get_next(phead);
+ plist = phead->next;
precvframe = LIST_CONTAINOR(plist, union recv_frame, u);
list_del_init(&precvframe->u.hdr.list);
padapter = precvframe->u.hdr.adapter;
@@ -146,10 +146,10 @@ void r8712_free_recvframe_queue(struct __queue *pframequeue,

spin_lock(&pframequeue->lock);
phead = get_list_head(pframequeue);
- plist = get_next(phead);
+ plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
precvframe = LIST_CONTAINOR(plist, union recv_frame, u);
- plist = get_next(plist);
+ plist = plist->next;
r8712_free_recvframe(precvframe, pfree_recv_queue);
}
spin_unlock(&pframequeue->lock);
diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
index 92d5327..7db8921 100644
--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
+++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
@@ -84,10 +84,10 @@ static void mfree_all_stainfo(struct sta_priv *pstapriv)

spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
phead = get_list_head(&pstapriv->free_sta_queue);
- plist = get_next(phead);
+ plist = phead->next;
while ((end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist, struct sta_info, list);
- plist = get_next(plist);
+ plist = plist->next;
}

spin_unlock_irqrestore(&pstapriv->sta_hash_lock, irqL);
@@ -125,7 +125,7 @@ struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
if (_queue_empty(pfree_sta_queue) == true)
psta = NULL;
else {
- psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue),
+ psta = LIST_CONTAINOR(pfree_sta_queue->queue.next,
struct sta_info, list);
list_del_init(&(psta->list));
tmp_aid = psta->aid;
@@ -227,11 +227,11 @@ void r8712_free_all_stainfo(struct _adapter *padapter)
spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
for (index = 0; index < NUM_STA; index++) {
phead = &(pstapriv->sta_hash[index]);
- plist = get_next(phead);
+ plist = phead->next;
while ((end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist,
struct sta_info, hash_list);
- plist = get_next(plist);
+ plist = plist->next;
if (pbcmc_stainfo != psta)
r8712_free_stainfo(padapter , psta);
}
@@ -252,7 +252,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
index = wifi_mac_hash(hwaddr);
spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
phead = &(pstapriv->sta_hash[index]);
- plist = get_next(phead);
+ plist = phead->next;
while ((end_of_queue_search(phead, plist)) == false) {
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
if ((!memcmp(psta->hwaddr, hwaddr, ETH_ALEN))) {
@@ -260,7 +260,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
break;
}
psta = NULL;
- plist = get_next(plist);
+ plist = plist->next;
}
spin_unlock_irqrestore(&pstapriv->sta_hash_lock, irqL);
return psta;
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 2e79e4e..29a9f50 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -748,7 +748,7 @@ struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv)
pxmitbuf = NULL;
else {
phead = get_list_head(pfree_xmitbuf_queue);
- plist = get_next(phead);
+ plist = phead->next;
pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list);
list_del_init(&(pxmitbuf->list));
}
@@ -802,7 +802,7 @@ struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv)
pxframe = NULL;
else {
phead = get_list_head(pfree_xmit_queue);
- plist = get_next(phead);
+ plist = phead->next;
pxframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
list_del_init(&(pxframe->list));
}
@@ -858,10 +858,10 @@ void r8712_free_xmitframe_queue(struct xmit_priv *pxmitpriv,

spin_lock_irqsave(&(pframequeue->lock), irqL);
phead = get_list_head(pframequeue);
- plist = get_next(phead);
+ plist = phead->next;
while (end_of_queue_search(phead, plist) == false) {
pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
- plist = get_next(plist);
+ plist = plist->next;
r8712_free_xmitframe(pxmitpriv, pxmitframe);
}
spin_unlock_irqrestore(&(pframequeue->lock), irqL);
--
1.7.9.5

2014-06-25 02:54:49

by James A Shackleford

[permalink] [raw]
Subject: [PATCH 3/8] staging: rtl8712: remove wrapper function list_insert_tail

list_insert_tail is just an inline wrapper around list_add_tail. This
patch removes the wrapper and directly uses list_add_tail.

Signed-off-by: James A Shackleford <[email protected]>
---
drivers/staging/rtl8712/osdep_service.h | 6 ------
drivers/staging/rtl8712/rtl8712_recv.c | 10 +++++-----
drivers/staging/rtl8712/rtl871x_cmd.c | 6 +++---
drivers/staging/rtl8712/rtl871x_io.c | 2 +-
drivers/staging/rtl8712/rtl871x_mlme.c | 8 ++++----
drivers/staging/rtl8712/rtl871x_mp.c | 2 +-
drivers/staging/rtl8712/rtl871x_recv.c | 2 +-
drivers/staging/rtl8712/rtl871x_sta_mgt.c | 6 +++---
drivers/staging/rtl8712/rtl871x_xmit.c | 12 ++++++------
9 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 58f2090..bc5e922 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -115,12 +115,6 @@ For the following list_xxx operations,
caller must guarantee the atomic context.
Otherwise, there will be racing condition.
*/
-static inline void list_insert_tail(struct list_head *plist,
- struct list_head *phead)
-{
- list_add_tail(plist, phead);
-}
-
static inline u32 _down_sema(struct semaphore *sema)
{
if (down_interruptible(sema))
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 22840a1..b510312 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -73,7 +73,7 @@ int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter)
break;
precvbuf->ref_cnt = 0;
precvbuf->adapter = padapter;
- list_insert_tail(&precvbuf->list,
+ list_add_tail(&precvbuf->list,
&(precvpriv->free_recv_buf_queue.queue));
precvbuf++;
}
@@ -146,7 +146,7 @@ int r8712_free_recvframe(union recv_frame *precvframe,
}
spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
list_delete(&(precvframe->u.hdr.list));
- list_insert_tail(&(precvframe->u.hdr.list),
+ list_add_tail(&(precvframe->u.hdr.list),
get_list_head(pfree_recv_queue));
if (padapter != NULL) {
if (pfree_recv_queue == &precvpriv->free_recv_queue)
@@ -297,7 +297,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
}
/* Then enqueue the 0~(n-1) fragment to the defrag_q */
phead = get_list_head(pdefrag_q);
- list_insert_tail(&pfhdr->list, phead);
+ list_add_tail(&pfhdr->list, phead);
prtnframe = NULL;
} else {
/* can't find this ta's defrag_queue, so free this
@@ -312,7 +312,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
* enqueue the last fragment */
if (pdefrag_q != NULL) {
phead = get_list_head(pdefrag_q);
- list_insert_tail(&pfhdr->list, phead);
+ list_add_tail(&pfhdr->list, phead);
/*call recvframe_defrag to defrag*/
precv_frame = recvframe_defrag(padapter, pdefrag_q);
prtnframe = precv_frame;
@@ -512,7 +512,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
break;
}
list_delete(&(prframe->u.hdr.list));
- list_insert_tail(&(prframe->u.hdr.list), plist);
+ list_add_tail(&(prframe->u.hdr.list), plist);
return true;
}

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index 689364d..cae8ee6 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -126,7 +126,7 @@ static sint _enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
if (obj == NULL)
return _SUCCESS;
spin_lock_irqsave(&queue->lock, irqL);
- list_insert_tail(&obj->list, &queue->queue);
+ list_add_tail(&obj->list, &queue->queue);
spin_unlock_irqrestore(&queue->lock, irqL);
return _SUCCESS;
}
@@ -190,7 +190,7 @@ u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj)
return _FAIL;
queue = &pcmdpriv->cmd_queue;
spin_lock_irqsave(&queue->lock, irqL);
- list_insert_tail(&obj->list, &queue->queue);
+ list_add_tail(&obj->list, &queue->queue);
spin_unlock_irqrestore(&queue->lock, irqL);
up(&pcmdpriv->cmd_queue_sema);
return _SUCCESS;
@@ -956,7 +956,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,
goto createbss_cmd_fail;
pwlan->last_scanned = jiffies;
} else
- list_insert_tail(&(pwlan->list),
+ list_add_tail(&(pwlan->list),
&pmlmepriv->scanned_queue.queue);
pnetwork->Length = r8712_get_ndis_wlan_bssid_ex_sz(pnetwork);
memcpy(&(pwlan->network), pnetwork, pnetwork->Length);
diff --git a/drivers/staging/rtl8712/rtl871x_io.c b/drivers/staging/rtl8712/rtl871x_io.c
index c42a578..8858687 100644
--- a/drivers/staging/rtl8712/rtl871x_io.c
+++ b/drivers/staging/rtl8712/rtl871x_io.c
@@ -132,7 +132,7 @@ uint r8712_alloc_io_queue(struct _adapter *adapter)
pio_req = (struct io_req *)(pio_queue->free_ioreqs_buf);
for (i = 0; i < NUM_IOREQ; i++) {
INIT_LIST_HEAD(&pio_req->list);
- list_insert_tail(&pio_req->list, &pio_queue->free_ioreqs);
+ list_add_tail(&pio_req->list, &pio_queue->free_ioreqs);
pio_req++;
}
if ((register_intf_hdl((u8 *)adapter, &(pio_queue->intf))) == _FAIL)
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 3000b2a..05ff7dd 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -70,7 +70,7 @@ static sint _init_mlme_priv(struct _adapter *padapter)
pnetwork = (struct wlan_network *)pbuf;
for (i = 0; i < MAX_BSS_CNT; i++) {
INIT_LIST_HEAD(&(pnetwork->list));
- list_insert_tail(&(pnetwork->list),
+ list_add_tail(&(pnetwork->list),
&(pmlmepriv->free_bss_pool.queue));
pnetwork++;
}
@@ -118,7 +118,7 @@ static void _free_network(struct mlme_priv *pmlmepriv,
return;
spin_lock_irqsave(&free_queue->lock, irqL);
list_delete(&pnetwork->list);
- list_insert_tail(&pnetwork->list, &free_queue->queue);
+ list_add_tail(&pnetwork->list, &free_queue->queue);
pmlmepriv->num_of_scanned--;
spin_unlock_irqrestore(&free_queue->lock, irqL);
}
@@ -133,7 +133,7 @@ static void _free_network_nolock(struct mlme_priv *pmlmepriv,
if (pnetwork->fixed == true)
return;
list_delete(&pnetwork->list);
- list_insert_tail(&pnetwork->list, get_list_head(free_queue));
+ list_add_tail(&pnetwork->list, get_list_head(free_queue));
pmlmepriv->num_of_scanned--;
}

@@ -437,7 +437,7 @@ static void update_scanned_network(struct _adapter *adapter,
bssid_ex_sz = r8712_get_ndis_wlan_bssid_ex_sz(target);
target->Length = bssid_ex_sz;
memcpy(&pnetwork->network, target, bssid_ex_sz);
- list_insert_tail(&pnetwork->list, &queue->queue);
+ list_add_tail(&pnetwork->list, &queue->queue);
}
} else {
/* we have an entry and we are going to update it. But
diff --git a/drivers/staging/rtl8712/rtl871x_mp.c b/drivers/staging/rtl8712/rtl871x_mp.c
index 594d023..aae77f0 100644
--- a/drivers/staging/rtl8712/rtl871x_mp.c
+++ b/drivers/staging/rtl8712/rtl871x_mp.c
@@ -66,7 +66,7 @@ static int init_mp_priv(struct mp_priv *pmp_priv)
pmp_xmitframe = (struct mp_xmit_frame *)pmp_priv->pmp_xmtframe_buf;
for (i = 0; i < NR_MP_XMITFRAME; i++) {
INIT_LIST_HEAD(&(pmp_xmitframe->list));
- list_insert_tail(&(pmp_xmitframe->list),
+ list_add_tail(&(pmp_xmitframe->list),
&(pmp_priv->free_mp_xmitqueue.queue));
pmp_xmitframe->pkt = NULL;
pmp_xmitframe->frame_tag = MP_FRAMETAG;
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
index 269c872..cd31982 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -87,7 +87,7 @@ sint _r8712_init_recv_priv(struct recv_priv *precvpriv,
precvframe = (union recv_frame *)precvpriv->precv_frame_buf;
for (i = 0; i < NR_RECVFRAME; i++) {
INIT_LIST_HEAD(&(precvframe->u.list));
- list_insert_tail(&(precvframe->u.list),
+ list_add_tail(&(precvframe->u.list),
&(precvpriv->free_recv_queue.queue));
r8712_os_recv_resource_alloc(padapter, precvframe);
precvframe->u.hdr.adapter = padapter;
diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
index 8dd5e35..e7f3cdb 100644
--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
+++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
@@ -66,7 +66,7 @@ u32 _r8712_init_sta_priv(struct sta_priv *pstapriv)
for (i = 0; i < NUM_STA; i++) {
_init_stainfo(psta);
INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
- list_insert_tail(&psta->list,
+ list_add_tail(&psta->list,
get_list_head(&pstapriv->free_sta_queue));
psta++;
}
@@ -137,7 +137,7 @@ struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
goto exit;
}
phash_list = &(pstapriv->sta_hash[index]);
- list_insert_tail(&psta->hash_list, phash_list);
+ list_add_tail(&psta->hash_list, phash_list);
pstapriv->asoc_sta_count++;

/* For the SMC router, the sequence number of first packet of WPS handshake
@@ -208,7 +208,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta)
}
spin_lock(&(pfree_sta_queue->lock));
/* insert into free_sta_queue; 20061114 */
- list_insert_tail(&psta->list, get_list_head(pfree_sta_queue));
+ list_add_tail(&psta->list, get_list_head(pfree_sta_queue));
spin_unlock(&(pfree_sta_queue->lock));
}

diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c
index 989fb67..71d0d0d 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.c
+++ b/drivers/staging/rtl8712/rtl871x_xmit.c
@@ -103,7 +103,7 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
pxframe->pkt = NULL;
pxframe->buf_addr = NULL;
pxframe->pxmitbuf = NULL;
- list_insert_tail(&(pxframe->list),
+ list_add_tail(&(pxframe->list),
&(pxmitpriv->free_xmit_queue.queue));
pxframe++;
}
@@ -143,7 +143,7 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
((addr_t) (pxmitbuf->pallocated_buf) &
(XMITBUF_ALIGN_SZ - 1));
r8712_xmit_resource_alloc(padapter, pxmitbuf);
- list_insert_tail(&pxmitbuf->list,
+ list_add_tail(&pxmitbuf->list,
&(pxmitpriv->free_xmitbuf_queue.queue));
pxmitbuf++;
}
@@ -767,7 +767,7 @@ int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
return _FAIL;
spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
list_delete(&pxmitbuf->list);
- list_insert_tail(&(pxmitbuf->list), get_list_head(pfree_xmitbuf_queue));
+ list_add_tail(&(pxmitbuf->list), get_list_head(pfree_xmitbuf_queue));
pxmitpriv->free_xmitbuf_cnt++;
spin_unlock_irqrestore(&pfree_xmitbuf_queue->lock, irqL);
return _SUCCESS;
@@ -833,7 +833,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
pndis_pkt = pxmitframe->pkt;
pxmitframe->pkt = NULL;
}
- list_insert_tail(&pxmitframe->list, get_list_head(pfree_xmit_queue));
+ list_add_tail(&pxmitframe->list, get_list_head(pfree_xmit_queue));
pxmitpriv->free_xmitframe_cnt++;
spin_unlock_irqrestore(&pfree_xmit_queue->lock, irqL);
if (netif_queue_stopped(padapter->pnetdev))
@@ -940,9 +940,9 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
psta, pattrib->priority);
spin_lock_irqsave(&pstapending->lock, irqL0);
if (list_empty(&ptxservq->tx_pending))
- list_insert_tail(&ptxservq->tx_pending,
+ list_add_tail(&ptxservq->tx_pending,
get_list_head(pstapending));
- list_insert_tail(&pxmitframe->list,
+ list_add_tail(&pxmitframe->list,
get_list_head(&ptxservq->sta_pending));
ptxservq->qcnt++;
spin_unlock_irqrestore(&pstapending->lock, irqL0);
--
1.7.9.5

2014-07-08 10:17:09

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 8/8] staging: rtl8712: remove inapplicable comment

On Tue, Jun 24, 2014 at 10:52:41PM -0400, James A Shackleford wrote:
> Signed-off-by: James A Shackleford <[email protected]>
> ---
> drivers/staging/rtl8712/osdep_service.h | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
> index 77b1443..3dfc473 100644
> --- a/drivers/staging/rtl8712/osdep_service.h
> +++ b/drivers/staging/rtl8712/osdep_service.h
> @@ -95,11 +95,6 @@ static inline void _set_workitem(_workitem *pwork)
> #define BIT(x) (1 << (x))
> #endif
>
> -/*
> -For the following list_xxx operations,
> -caller must guarantee the atomic context.
> -Otherwise, there will be racing condition.
> -*/
> static inline u32 _down_sema(struct semaphore *sema)
> {
> if (down_interruptible(sema))

This function sucks obviously just like the wrappers you deleted earlier.

Only one of the callers checks the return value.

TODO-list: 2014-07-08: rtl8712: delete _down_sema().

regards,
dan carpenter

2014-07-09 17:01:26

by James A Shackleford

[permalink] [raw]
Subject: Re: [PATCH 8/8] staging: rtl8712: remove inapplicable comment

On Tue, Jul 08, 2014 at 01:16:53PM +0300, Dan Carpenter wrote:
> On Tue, Jun 24, 2014 at 10:52:41PM -0400, James A Shackleford wrote:
> > Signed-off-by: James A Shackleford <[email protected]>
> > ---
> > drivers/staging/rtl8712/osdep_service.h | 5 -----
> > 1 file changed, 5 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
> > index 77b1443..3dfc473 100644
> > --- a/drivers/staging/rtl8712/osdep_service.h
> > +++ b/drivers/staging/rtl8712/osdep_service.h
> > @@ -95,11 +95,6 @@ static inline void _set_workitem(_workitem *pwork)
> > #define BIT(x) (1 << (x))
> > #endif
> >
> > -/*
> > -For the following list_xxx operations,
> > -caller must guarantee the atomic context.
> > -Otherwise, there will be racing condition.
> > -*/
> > static inline u32 _down_sema(struct semaphore *sema)
> > {
> > if (down_interruptible(sema))
>
> This function sucks obviously just like the wrappers you deleted earlier.
>
> Only one of the callers checks the return value.
>
> TODO-list: 2014-07-08: rtl8712: delete _down_sema().
>
> regards,
> dan carpenter
>

I completely agree -- most of the stuff in this header is pretty ugly. More
clean-up patches are in the pipe.

Regards,
James Shackleford