linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Mike McCormack <mikem@ring3k.org>
Cc: chaoming_li@realsil.com.cn, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/8] rtlwifi: Store loop index in local variable
Date: Mon, 23 May 2011 14:47:20 -0500	[thread overview]
Message-ID: <4DDAB9C8.1090407@lwfinger.net> (raw)
In-Reply-To: <4DDA66FB.4030402@ring3k.org>

On 05/23/2011 08:54 AM, Mike McCormack wrote:
> _rtl_pci_rx_interrupt uses rtlpci->rx_ring[rx_queue_idx].idx a
> few times, so store it in a separate variable.
>
> Signed-off-by: Mike McCormack<mikem@ring3k.org>
> ---
>   drivers/net/wireless/rtlwifi/pci.c |   20 ++++++++------------
>   1 files changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
> index a409528..5eedb91 100644
> --- a/drivers/net/wireless/rtlwifi/pci.c
> +++ b/drivers/net/wireless/rtlwifi/pci.c
> @@ -644,22 +644,23 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
>   		.noise = -98,
>   		.rate = 0,
>   	};
> +	int index = rtlpci->rx_ring[rx_queue_idx].idx;
>
>   	/*RX NORMAL PKT */
>   	while (count--) {
>   		/*rx descriptor */
>   		struct rtl_rx_desc *pdesc =&rtlpci->rx_ring[rx_queue_idx].desc[
> -				rtlpci->rx_ring[rx_queue_idx].idx];
> +				index];
>   		/*rx pkt */
>   		struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[
> -				rtlpci->rx_ring[rx_queue_idx].idx];
> +				index];
>
>   		own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc,
>   						       false, HW_DESC_OWN);
>
>   		if (own) {
>   			/*wait data to be filled by hardware */
> -			return;
> +			break;
>   		} else {
>   			struct ieee80211_hdr *hdr;
>   			__le16 fc;
> @@ -768,10 +769,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
>   			skb = new_skb;
>   			/*skb->dev = dev; */
>
> -			rtlpci->rx_ring[rx_queue_idx].rx_buf[rtlpci->
> -							     rx_ring
> -							     [rx_queue_idx].
> -							     idx] = skb;
> +			rtlpci->rx_ring[rx_queue_idx].rx_buf[index] = skb;
>   			*((dma_addr_t *) skb->cb) =
>   			    pci_map_single(rtlpci->pdev, skb_tail_pointer(skb),
>   					   rtlpci->rxbuffersize,
> @@ -790,17 +788,15 @@ done:
>   					    HW_DESC_RXPKT_LEN,
>   					    (u8 *)&rtlpci->rxbuffersize);
>
> -		if (rtlpci->rx_ring[rx_queue_idx].idx ==
> -		    rtlpci->rxringcount - 1)
> +		if (index == rtlpci->rxringcount - 1)
>   			rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false,
>   						    HW_DESC_RXERO,
>   						    (u8 *)&tmp_one);
>
> -		rtlpci->rx_ring[rx_queue_idx].idx =
> -		    (rtlpci->rx_ring[rx_queue_idx].idx + 1) %
> -		    rtlpci->rxringcount;
> +		index = (index + 1) % rtlpci->rxringcount;
>   	}
>
> +	rtlpci->rx_ring[rx_queue_idx].idx = index;
>   }
>
>   static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---


  reply	other threads:[~2011-05-23 19:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 13:54 [PATCH 3/8] rtlwifi: Store loop index in local variable Mike McCormack
2011-05-23 19:47 ` Larry Finger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-25  0:39 Mike McCormack
2011-05-30 23:49 Mike McCormack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDAB9C8.1090407@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=chaoming_li@realsil.com.cn \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mikem@ring3k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).