1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-30 17:53:45 +02:00

[backfire] package/mac80211: backport list_for_each_entry_continue_rcu to fix carl1970

git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@23716 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
agb 2010-10-29 21:26:25 +00:00
parent 5549306b83
commit 62eb83c4fa

View File

@ -0,0 +1,47 @@
diff --git a/include/linux/compat-2.6.31.h b/include/linux/compat-2.6.31.h
index 54ddefd..6c454cb 100644
--- a/include/linux/compat-2.6.31.h
+++ b/include/linux/compat-2.6.31.h
@@ -191,6 +191,17 @@ void compat_synchronize_threaded_irq(struct compat_threaded_irq *comp)
cancel_work_sync(&comp->work);
}
+/**
+ * list_entry_rcu - get the struct for this entry
+ * @ptr: the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ *
+ * This primitive may safely run concurrently with the _rcu list-mutation
+ * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
+ */
+#define list_entry_rcu(ptr, type, member) \
+ container_of(rcu_dereference(ptr), type, member)
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index e4dff72..e7e20d9 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -98,6 +98,20 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
#define kfifo_out(a, b, c) __kfifo_get(*a, b, c)
#define kfifo_len(a) __kfifo_len(*a)
+/**
+ * list_for_each_entry_continue_rcu - continue iteration over list of given type
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Continue to iterate over list of given type, continuing after
+ * the current position.
+ */
+#define list_for_each_entry_continue_rcu(pos, head, member) \
+ for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \
+ prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
+
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */
#endif /* LINUX_26_33_COMPAT_H */