All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net/rxrpc: Simplify rxrpcpeerseq_next()
@ 2026-10-16  6:50 Chelsy Ratnawat
  2026-10-21 14:48 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Chelsy Ratnawat @ 2026-10-16  6:50 UTC (permalink / raw)
  To: dhowells, marc.dionne, davem
  Cc: edumazet, kuba, pabeni, netdev, Chelsy Ratnawat

Remove the redundant initialization and conditional handling of n,
as it is always set to 1. Use the constant directly when updating
*_pos and starting the hlist iteration.

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
---
Changes in v2: 
 - Remove n, as it is triggering unused variable warning.

 net/rxrpc/proc.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
index e9a27fa7b25d..5b780fc3f289 100644
--- a/net/rxrpc/proc.c
+++ b/net/rxrpc/proc.c
@@ -352,7 +352,7 @@ static void *rxrpc_peer_seq_start(struct seq_file *seq, loff_t *_pos)
 static void *rxrpc_peer_seq_next(struct seq_file *seq, void *v, loff_t *_pos)
 {
 	struct rxrpc_net *rxnet = rxrpc_net(seq_file_net(seq));
-	unsigned int bucket, n;
+	unsigned int bucket;
 	unsigned int shift = 32 - HASH_BITS(rxnet->peer_hash);
 	void *p;
 
@@ -367,19 +367,14 @@ static void *rxrpc_peer_seq_next(struct seq_file *seq, void *v, loff_t *_pos)
 
 	for (;;) {
 		bucket++;
-		n = 1;
-		*_pos = (bucket << shift) | n;
+		*_pos = (bucket << shift) | 1;
 
 		if (bucket >= HASH_SIZE(rxnet->peer_hash)) {
 			*_pos = UINT_MAX;
 			return NULL;
 		}
-		if (n == 0) {
-			*_pos += 1;
-			n++;
-		}
 
-		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], n - 1);
+		p = seq_hlist_start_rcu(&rxnet->peer_hash[bucket], 0);
 		if (p)
 			return p;
 	}
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-21 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16  6:50 [PATCH v2] net/rxrpc: Simplify rxrpcpeerseq_next() Chelsy Ratnawat
2026-10-21 14:48 ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.