mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 09/10] staging: rtl8192e: Convert array rx_idx[] to variable rx_idx
Date: Thu, 26 Oct 2023 07:44:24 +0200	[thread overview]
Message-ID: <f9e3ee95cdc2de810687a9c71f1a9f8d8fdbeac1.1698295861.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1698295861.git.philipp.g.hortmann@gmail.com>

Convert array rx_idx[] to variable rx_idx as index is always 0. Remove
unused rx_queue_idx as well. This increases readability.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 18 +++++++-----------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  2 +-
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 8af732870ddf..d2a8a9543579 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1142,7 +1142,6 @@ static void _rtl92e_free_rx_ring(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	int i;
-	int rx_queue_idx = 0;
 
 	for (i = 0; i < priv->rxringcount; i++) {
 		struct sk_buff *skb = priv->rx_buf[i];
@@ -1352,7 +1351,6 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rx_desc *entry = NULL;
 	int i;
-	int rx_queue_idx = 0;
 
 	priv->rx_ring = dma_alloc_coherent(&priv->pdev->dev,
 					   sizeof(*priv->rx_ring) * priv->rxringcount,
@@ -1363,7 +1361,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)
 		return -ENOMEM;
 	}
 
-	priv->rx_idx[rx_queue_idx] = 0;
+	priv->rx_idx = 0;
 
 	for (i = 0; i < priv->rxringcount; i++) {
 		struct sk_buff *skb = dev_alloc_skb(priv->rxbuffersize);
@@ -1452,7 +1450,6 @@ void rtl92e_reset_desc_ring(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	int i;
-	int rx_queue_idx = 0;
 	unsigned long flags = 0;
 
 	if (priv->rx_ring) {
@@ -1462,7 +1459,7 @@ void rtl92e_reset_desc_ring(struct net_device *dev)
 			entry = &priv->rx_ring[i];
 			entry->OWN = 1;
 		}
-		priv->rx_idx[rx_queue_idx] = 0;
+		priv->rx_idx = 0;
 	}
 
 	spin_lock_irqsave(&priv->irq_th_lock, flags);
@@ -1561,7 +1558,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 	struct ieee80211_hdr *rtllib_hdr = NULL;
 	bool unicast_packet = false;
 	u32 skb_len = 0;
-	int rx_queue_idx = RX_MPDU_QUEUE;
 
 	struct rtllib_rx_stats stats = {
 		.signal = 0,
@@ -1574,9 +1570,9 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 
 	while (count--) {
 		struct rx_desc *pdesc = &priv->rx_ring
-					[priv->rx_idx[rx_queue_idx]];
+					[priv->rx_idx];
 		struct sk_buff *skb = priv->rx_buf
-				      [priv->rx_idx[rx_queue_idx]];
+				      [priv->rx_idx];
 		struct sk_buff *new_skb;
 
 		if (pdesc->OWN)
@@ -1614,7 +1610,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		skb = new_skb;
 		skb->dev = dev;
 
-		priv->rx_buf[priv->rx_idx[rx_queue_idx]] =
+		priv->rx_buf[priv->rx_idx] =
 								 skb;
 		*((dma_addr_t *)skb->cb) = dma_map_single(&priv->pdev->dev,
 							  skb_tail_pointer(skb),
@@ -1627,9 +1623,9 @@ static void _rtl92e_rx_normal(struct net_device *dev)
 		pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
 		pdesc->OWN = 1;
 		pdesc->Length = priv->rxbuffersize;
-		if (priv->rx_idx[rx_queue_idx] == priv->rxringcount - 1)
+		if (priv->rx_idx == priv->rxringcount - 1)
 			pdesc->EOR = 1;
-		priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) %
+		priv->rx_idx = (priv->rx_idx + 1) %
 					      priv->rxringcount;
 	}
 }
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index b3ebff2df62a..a6c47388d72c 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -235,7 +235,7 @@ struct r8192_priv {
 	struct rx_desc *rx_ring;
 	struct sk_buff	*rx_buf[MAX_RX_COUNT];
 	dma_addr_t	rx_ring_dma;
-	unsigned int	rx_idx[MAX_RX_QUEUE];
+	unsigned int	rx_idx;
 	int		rxringcount;
 	u16		rxbuffersize;
 
-- 
2.42.0


  parent reply	other threads:[~2023-10-26  5:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26  5:43 [PATCH 00/10] staging: rtl8192e: Convert array rx_ring[] to rx_ring Philipp Hortmann
2023-10-26  5:43 ` [PATCH 01/10] staging: rtl8192e: Remove HTIOTActIsDisableMCS14() Philipp Hortmann
2023-10-26  5:43 ` [PATCH 02/10] staging: rtl8192e: Remove HTIOTActIsDisableMCS15() Philipp Hortmann
2023-10-26  5:43 ` [PATCH 03/10] staging: rtl8192e: Remove HTIOTActIsDisableMCSTwoSpatialStream() Philipp Hortmann
2023-10-26  5:43 ` [PATCH 04/10] staging: rtl8192e: Remove HTIOTActIsDisableEDCATurbo() Philipp Hortmann
2023-10-26  5:43 ` [PATCH 05/10] staging: rtl8192e: Remove loops with constant MAX_RX_QUEUE Philipp Hortmann
2023-10-26  5:44 ` [PATCH 06/10] staging: rtl8192e: Convert array rx_ring[] to variable rx_ring Philipp Hortmann
2023-10-26  5:44 ` [PATCH 07/10] staging: rtl8192e: Convert array rx_buf[][] to array rx_buf[] Philipp Hortmann
2023-10-26  5:44 ` [PATCH 08/10] staging: rtl8192e: Convert array rx_ring_dma[] to variable rx_ring_dma Philipp Hortmann
2023-10-26  5:44 ` Philipp Hortmann [this message]
2023-10-26  7:09   ` [PATCH 09/10] staging: rtl8192e: Convert array rx_idx[] to variable rx_idx Dan Carpenter
2023-10-26  5:44 ` [PATCH 10/10] staging: rtl8192e: Remove unused constants starting with MAX_RX_QUEUE Philipp Hortmann
2023-10-26  7:09 ` [PATCH 00/10] staging: rtl8192e: Convert array rx_ring[] to rx_ring Dan Carpenter

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=f9e3ee95cdc2de810687a9c71f1a9f8d8fdbeac1.1698295861.git.philipp.g.hortmann@gmail.com \
    --to=philipp.g.hortmann@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®