]> git.openfabrics.org - ~emulex/for-vlad/old/compat.git/commitdiff
compat: llist_add_batch was added in 3.2
authorVladimir Sokolovsky <vlad@mellanox.com>
Sun, 3 Jun 2012 10:05:27 +0000 (13:05 +0300)
committerVladimir Sokolovsky <vlad@mellanox.com>
Sun, 3 Jun 2012 10:11:03 +0000 (13:11 +0300)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
compat/compat-3.1.c
compat/compat-3.2.c
include/linux/llist.h

index 700cff77a3870a04ca050b92b47f1a93c04368e3..5eda45f64068532d501dd814b17a3325c613a1ea 100644 (file)
 
 #include <asm/system.h>
 
-/**
- * llist_add_batch - add several linked entries in batch
- * @new_first: first entry in batch to be added
- * @new_last:  last entry in batch to be added
- * @head:      the head for your lock-less list
- *
- * Return whether list is empty before adding.
- */
-bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
-                    struct llist_head *head)
-{
-       struct llist_node *entry, *old_entry;
-
-       entry = head->first;
-       for (;;) {
-               old_entry = entry;
-               new_last->next = entry;
-               entry = cmpxchg(&head->first, old_entry, new_first);
-               if (entry == old_entry)
-                       break;
-       }
-
-       return old_entry == NULL;
-}
-EXPORT_SYMBOL_GPL(llist_add_batch);
-
 /**
  * llist_del_first - delete the first entry of lock-less list
  * @head:      the head for your lock-less list
index dd85387c1f2ae9e21f9977afafa0a2a4eab98101..4569f733e9916608b8cf812babf57fbfb8570a6f 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/device.h>
 #include <linux/ethtool.h>
 #include <linux/rtnetlink.h>
+#include <linux/llist.h>
 
 int __netdev_printk(const char *level, const struct net_device *dev,
                           struct va_format *vaf)
@@ -48,3 +49,30 @@ int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
         return dev->ethtool_ops->get_settings(dev, cmd);
 }
 EXPORT_SYMBOL(__ethtool_get_settings);
+
+/**
+ * llist_add_batch - add several linked entries in batch
+ * @new_first: first entry in batch to be added
+ * @new_last:  last entry in batch to be added
+ * @head:      the head for your lock-less list
+ *
+ * Return whether list is empty before adding.
+ */
+bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
+                    struct llist_head *head)
+{
+       struct llist_node *entry, *old_entry;
+
+       entry = head->first;
+       for (;;) {
+               old_entry = entry;
+               new_last->next = entry;
+               entry = cmpxchg(&head->first, old_entry, new_first);
+               if (entry == old_entry)
+                       break;
+       }
+
+       return old_entry == NULL;
+}
+EXPORT_SYMBOL_GPL(llist_add_batch);
+
index f6d82284a7a02e72309fbaffef0159107c503386..b15d0c7186e4ca70d8810a1c57ece06da8176cfc 100644 (file)
@@ -1,6 +1,12 @@
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
 #include_next <linux/llist.h>
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+#include_next <linux/llist.h>
+extern bool llist_add_batch(struct llist_node *new_first,
+                           struct llist_node *new_last,
+                           struct llist_head *head);
 #else
 
 #ifndef LLIST_H
@@ -190,4 +196,4 @@ extern bool llist_add_batch(struct llist_node *new_first,
 extern struct llist_node *llist_del_first(struct llist_head *head);
 
 #endif /* LLIST_H */
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) */
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */