From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: Linus Torvalds <torvalds@linux-foundation.org>, linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org
Subject: [PATCH] [PATCH 4/4] list.h: add list_cut_position()
Date: Sat, 19 Jul 2008 22:48:02 -0400 [thread overview]
Message-ID: <20080720024802.GU17936@ruslug.rutgers.edu> (raw)
In-Reply-To: <20080720024709.GT17936@ruslug.rutgers.edu>
This adds list_cut_position() which lets you cut a list into
two lists given a pivot in in the list.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
drivers/net/wireless/ath9k/core.h | 35 -----------------------------------
include/linux/list.h | 32 ++++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 807dcdf..65f8c50 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -49,41 +49,6 @@ struct ath_node;
/* Utility macros */
/******************/
-/* An attempt will be made to merge these link list helpers upstream
- * instead */
-
-static inline void __list_cut_position(struct list_head *list,
- struct list_head *head, struct list_head *entry)
-{
- struct list_head *new_first =
- (entry->next != head) ? entry->next : head;
- list->next = head->next;
- list->next->prev = list;
- list->prev = entry;
- entry->next = list;
- head->next = new_first;
- new_first->prev = head;
-}
-
-/**
- * list_cut_position - cut a list into two
- * @list: a new list to add all removed entries
- * @head: a list with entries
- * @entry: an entry within head, could be the head itself
- * and if so we won't won't cut the list
- */
-static inline void list_cut_position(struct list_head *list,
- struct list_head *head, struct list_head *entry)
-{
- BUG_ON(list_empty(head));
- if (list_is_singular(head))
- BUG_ON(head->next != entry && head != entry);
- if (entry == head)
- INIT_LIST_HEAD(list);
- else
- __list_cut_position(list, head, entry);
-}
-
/* Macro to expand scalars to 64-bit objects */
#define ito64(x) (sizeof(x) == 8) ? \
diff --git a/include/linux/list.h b/include/linux/list.h
index fc7b700..8766d33 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -326,6 +326,38 @@ static inline int list_is_singular(const struct list_head *head)
return !list_empty(head) && (head->next == head->prev);
}
+static inline void __list_cut_position(struct list_head *list,
+ struct list_head *head, struct list_head *entry)
+{
+ struct list_head *new_first =
+ (entry->next != head) ? entry->next : head;
+ list->next = head->next;
+ list->next->prev = list;
+ list->prev = entry;
+ entry->next = list;
+ head->next = new_first;
+ new_first->prev = head;
+}
+
+/**
+ * list_cut_position - cut a list into two
+ * @list: a new list to add all removed entries
+ * @head: a list with entries
+ * @entry: an entry within head, could be the head itself
+ * and if so we won't won't cut the list
+ */
+static inline void list_cut_position(struct list_head *list,
+ struct list_head *head, struct list_head *entry)
+{
+ BUG_ON(list_empty(head));
+ if (list_is_singular(head))
+ BUG_ON(head->next != entry && head != entry);
+ if (entry == head)
+ INIT_LIST_HEAD(list);
+ else
+ __list_cut_position(list, head, entry);
+}
+
static inline void __list_splice(const struct list_head *list,
struct list_head *head)
{
--
1.5.4.3
next prev parent reply other threads:[~2008-07-20 2:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-20 2:43 [PATCH 0/4] Atheros IEEE 802.11n ath9k driver Luis R. Rodriguez
2008-07-20 2:45 ` [PATCH 1/4] Add new " Luis R. Rodriguez
2008-07-20 2:45 ` [PATCH] [PATCH 2/4] Remove Atheros 11n devices from ath5k Luis R. Rodriguez
2008-07-20 2:47 ` [PATCH 3/4] list.h: Add list_splice_tail() and list_splice_tail_init() Luis R. Rodriguez
2008-07-20 2:48 ` Luis R. Rodriguez [this message]
2008-07-21 5:12 ` [PATCH] [PATCH 2/4] Remove Atheros 11n devices from ath5k Michael Renzmann
2008-07-21 11:58 ` [ath5k-devel] " Luis R. Rodriguez
2008-07-23 19:43 ` [PATCH 1/4] Add new Atheros IEEE 802.11n ath9k driver Johannes Berg
2008-07-23 20:09 ` Harvey Harrison
2008-07-24 2:01 ` [ath9k-devel] " Sujith
2008-07-24 3:18 ` Johannes Berg
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=20080720024802.GU17936@ruslug.rutgers.edu \
--to=lrodriguez@atheros.com \
--cc=ath9k-devel@lists.ath9k.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=torvalds@linux-foundation.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