mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCHv3 1/3] list: Use argument hlist_add_after names from rcu variant
@ 2014-06-07 16:40 Ken Helias
  2014-06-07 16:40 ` [PATCHv3 2/3] list: Fix order of arguments for hlist_add_after(_rcu) Ken Helias
  2014-06-07 16:40 ` [PATCHv3 3/3] klist: Use same naming scheme as hlist for klist_add_after Ken Helias
  0 siblings, 2 replies; 4+ messages in thread
From: Ken Helias @ 2014-06-07 16:40 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Ken Helias

From: Ken Helias <kenhelias@firemail.de>

The argument names of the hlist_add_after are poorly chosen because they look
the same as the ones from hlist_add_before but have to be used completely
different. This easily confuses the reader. The creator of the
hlist_add_after_rcu function has made a lot better choice.

Signed-off-by: Ken Helias <kenhelias@firemail.de>
---
v2:
Splitted into two patches

The patches to add list_add_before/behind were removed because it seems that
there is a consensus that list_add is understood by everyone automatically
as list_add_behind and list_add_tail is understood by everyone as
list_add_before.... even when the names suggest otherwise.

 include/linux/list.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/list.h b/include/linux/list.h
index ef95941..624ec7f 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -654,15 +654,15 @@ static inline void hlist_add_before(struct hlist_node *n,
 	*(n->pprev) = n;
 }
 
-static inline void hlist_add_after(struct hlist_node *n,
-					struct hlist_node *next)
+static inline void hlist_add_after(struct hlist_node *prev,
+				   struct hlist_node *n)
 {
-	next->next = n->next;
-	n->next = next;
-	next->pprev = &n->next;
+	n->next = prev->next;
+	prev->next = n;
+	n->pprev = &prev->next;
 
-	if(next->next)
-		next->next->pprev  = &next->next;
+	if (n->next)
+		n->next->pprev  = &n->next;
 }
 
 /* after that we'll appear to be on some hlist and hlist_del will work */
-- 
2.0.0


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

end of thread, other threads:[~2014-06-08  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-07 16:40 [PATCHv3 1/3] list: Use argument hlist_add_after names from rcu variant Ken Helias
2014-06-07 16:40 ` [PATCHv3 2/3] list: Fix order of arguments for hlist_add_after(_rcu) Ken Helias
2014-06-08  8:53   ` [linux-nics] " Jeff Kirsher
2014-06-07 16:40 ` [PATCHv3 3/3] klist: Use same naming scheme as hlist for klist_add_after Ken Helias

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®