linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] list.h: Add list_splice_tail() and list_splice_tail_init()
@ 2008-08-04 22:48 Luis R. Rodriguez
  2008-08-05  9:03 ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Luis R. Rodriguez @ 2008-08-04 22:48 UTC (permalink / raw)
  To: linville, netdev, linux-kernel, linville, torvalds
  Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

If you are using linked lists for queues list_splice() will not do what
you would expect even if you use the elements passed reversed. We need
to handle these differently. We add list_splice_tail() and
list_splice_tail_init()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 include/linux/list.h |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/include/linux/list.h b/include/linux/list.h
index 453916b..594f67c 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -229,7 +229,7 @@ static inline void __list_splice(const struct list_head *list,
 }
 
 /**
- * list_splice - join two lists
+ * list_splice - join two lists, this is designed for stacks
  * @list: the new list to add.
  * @head: the place to add it in the first list.
  */
@@ -256,6 +256,49 @@ static inline void list_splice_init(struct list_head *list,
 	}
 }
 
+static inline void __list_splice_tail(const struct list_head *list,
+				 struct list_head *head)
+{
+	struct list_head *first = list->next;
+	struct list_head *last = list->prev;
+	struct list_head *current_tail = head->prev;
+
+	current_tail->next = first;
+	last->next = head;
+	head->prev = last;
+	first->prev = current_tail;
+}
+
+/**
+ * list_splice_tail - join two lists, each list being a queue
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice_tail(const struct list_head *list,
+				struct list_head *head)
+{
+	if (!list_empty(list))
+		__list_splice_tail(list, head);
+}
+
+/**
+ * list_splice_tail_init - join two lists, each list being a queue, and
+ * 	reinitialise the emptied list.
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_tail_init(struct list_head *list,
+				    struct list_head *head)
+{
+	if (!list_empty(list)) {
+		__list_splice_tail(list, head);
+		INIT_LIST_HEAD(list);
+	}
+}
+
+
 /**
  * list_entry - get the struct for this entry
  * @ptr:	the &struct list_head pointer.
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH 0/4] Atheros IEEE 802.11n ath9k driver
@ 2008-08-04  7:16 Luis R. Rodriguez
  2008-08-04  7:16 ` [PATCH 1/4] list.h: Add list_splice_tail() and list_splice_tail_init() Luis R. Rodriguez
  0 siblings, 1 reply; 5+ messages in thread
From: Luis R. Rodriguez @ 2008-08-04  7:16 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

This series of patches adds the ath9k driver which adds support
for all Atheors IEEE 802.11n chipsets along some new linked list
helpers.

More information about this driver is available at:

http://wireless.kernel.org/en/users/Drivers/ath9k

Our mailing list for this driver is:

https://lists.ath9k.org/mailman/listinfo/ath9k-devel

  Luis

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

end of thread, other threads:[~2008-08-06 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-04 22:48 [PATCH 1/4] list.h: Add list_splice_tail() and list_splice_tail_init() Luis R. Rodriguez
2008-08-05  9:03 ` Peter Zijlstra
2008-08-06 20:26   ` Luis R. Rodriguez
2008-08-06 22:21     ` Luis R. Rodriguez
  -- strict thread matches above, loose matches on Subject: below --
2008-08-04  7:16 [PATCH 0/4] Atheros IEEE 802.11n ath9k driver Luis R. Rodriguez
2008-08-04  7:16 ` [PATCH 1/4] list.h: Add list_splice_tail() and list_splice_tail_init() Luis R. Rodriguez

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).