提交 e2b1930e 编写于 作者: J Johannes Berg

iwlwifi: use list_first_entry

Instead of open-coding it with a temporary list_head
pointer, just use list_first_entry.
Reviewed-by: NGregory Greenman <gregory.greenman@intel.com>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 a4dece9a
...@@ -199,7 +199,6 @@ static void iwl_rx_queue_restock(struct iwl_trans *trans) ...@@ -199,7 +199,6 @@ static void iwl_rx_queue_restock(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
struct list_head *element;
struct iwl_rx_mem_buffer *rxb; struct iwl_rx_mem_buffer *rxb;
unsigned long flags; unsigned long flags;
...@@ -221,9 +220,9 @@ static void iwl_rx_queue_restock(struct iwl_trans *trans) ...@@ -221,9 +220,9 @@ static void iwl_rx_queue_restock(struct iwl_trans *trans)
BUG_ON(rxb && rxb->page); BUG_ON(rxb && rxb->page);
/* Get next free Rx buffer, remove from free list */ /* Get next free Rx buffer, remove from free list */
element = rxq->rx_free.next; rxb = list_first_entry(&rxq->rx_free, struct iwl_rx_mem_buffer,
rxb = list_entry(element, struct iwl_rx_mem_buffer, list); list);
list_del(element); list_del(&rxb->list);
/* Point to Rx buffer via next RBD in circular buffer */ /* Point to Rx buffer via next RBD in circular buffer */
rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(rxb->page_dma); rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(rxb->page_dma);
...@@ -260,7 +259,6 @@ static void iwl_rx_allocate(struct iwl_trans *trans, gfp_t priority) ...@@ -260,7 +259,6 @@ static void iwl_rx_allocate(struct iwl_trans *trans, gfp_t priority)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
struct list_head *element;
struct iwl_rx_mem_buffer *rxb; struct iwl_rx_mem_buffer *rxb;
struct page *page; struct page *page;
unsigned long flags; unsigned long flags;
...@@ -308,10 +306,9 @@ static void iwl_rx_allocate(struct iwl_trans *trans, gfp_t priority) ...@@ -308,10 +306,9 @@ static void iwl_rx_allocate(struct iwl_trans *trans, gfp_t priority)
__free_pages(page, trans_pcie->rx_page_order); __free_pages(page, trans_pcie->rx_page_order);
return; return;
} }
element = rxq->rx_used.next; rxb = list_first_entry(&rxq->rx_used, struct iwl_rx_mem_buffer,
rxb = list_entry(element, struct iwl_rx_mem_buffer, list); list);
list_del(element); list_del(&rxb->list);
spin_unlock_irqrestore(&rxq->lock, flags); spin_unlock_irqrestore(&rxq->lock, flags);
BUG_ON(rxb->page); BUG_ON(rxb->page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册