public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH v6 01/20] batman-adv: Add compatibility code for kref_get_unless_zero
@ 2016-01-16  9:29 Sven Eckelmann
  2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 02/20] batman-adv: Convert batadv_hardif_neigh_node to kref Sven Eckelmann
                   ` (19 more replies)
  0 siblings, 20 replies; 39+ messages in thread
From: Sven Eckelmann @ 2016-01-16  9:29 UTC (permalink / raw)
  To: b.a.t.m.a.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v6:
 - removed patches which are now applied in the branch next
 - rebased remaining patches on the patch
   "batman-adv: Avoid recursive call_rcu for batadv_nc_node" which was
   modified by Marek while he applied the patches (this unfortunately made
   some of the remaining patches "hard" to apply)
v5:
 - add hack which allows to compile against stable kernel like 3.2.44 which
   also added the kref_get_unless_zero function
v4:
 - fix function names in commit messages
 - fix double whitespace in batadv_tt_orig_list_entry_release kerneldoc
 - add extra patch for batadv_claim_free_ref kerneldoc fix
 - change the phrase "free it" in all *_free_ref/*_put functions to "release it"
v3:
 - update copyright year
v2:
 - split patchset into fixes and kref migration to make it easier when the
   decision is made where each patch will be applied

 compat-include/linux/kref.h | 46 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 compat-include/linux/kref.h

diff --git a/compat-include/linux/kref.h b/compat-include/linux/kref.h
new file mode 100644
index 0000000..bb3442c
--- /dev/null
+++ b/compat-include/linux/kref.h
@@ -0,0 +1,46 @@
+/* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
+ *
+ * Marek Lindner, Simon Wunderlich
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * This file contains macros for maintaining compatibility with older versions
+ * of the Linux kernel.
+ */
+
+#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_
+#define _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_
+
+#include <linux/version.h>
+#include_next <linux/kref.h>
+
+#include <linux/atomic.h>
+#include <linux/kernel.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
+
+/* some stable versions like Linux 3.2.44 also introduced this function
+ * and would therefore break the build because they trigger a redefinition
+ * of this function. Instead rename this function to be in the batadv_*
+ * namespace
+ */
+#define kref_get_unless_zero(__kref) batadv_kref_get_unless_zero(__kref)
+
+static inline int __must_check batadv_kref_get_unless_zero(struct kref *kref)
+{
+	return atomic_add_unless(&kref->refcount, 1, 0);
+}
+
+#endif /* < KERNEL_VERSION(3, 8, 0) */
+
+#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_KREF_H_ */
-- 
2.7.0.rc3


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

end of thread, other threads:[~2016-01-17  8:42 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-16  9:29 [B.A.T.M.A.N.] [PATCH v6 01/20] batman-adv: Add compatibility code for kref_get_unless_zero Sven Eckelmann
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 02/20] batman-adv: Convert batadv_hardif_neigh_node to kref Sven Eckelmann
2016-01-17  5:20   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 03/20] batman-adv: Convert batadv_gw_node " Sven Eckelmann
2016-01-17  5:22   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 04/20] batman-adv: Convert batadv_softif_vlan " Sven Eckelmann
2016-01-17  5:23   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 05/20] batman-adv: Convert batadv_bla_backbone_gw " Sven Eckelmann
2016-01-17  5:25   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 06/20] batman-adv: Convert batadv_bla_claim " Sven Eckelmann
2016-01-17  5:26   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 07/20] batman-adv: Convert batadv_nc_node " Sven Eckelmann
2016-01-17  5:28   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 08/20] batman-adv: Convert batadv_nc_path " Sven Eckelmann
2016-01-17  5:30   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 09/20] batman-adv: Convert batadv_dat_entry " Sven Eckelmann
2016-01-17  5:32   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 10/20] batman-adv: Convert batadv_tvlv_container " Sven Eckelmann
2016-01-17  5:33   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 11/20] batman-adv: Convert batadv_tvlv_handler " Sven Eckelmann
2016-01-17  6:51   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 12/20] batman-adv: Convert batadv_tt_orig_list_entry " Sven Eckelmann
2016-01-17  6:56   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 13/20] batman-adv: Convert batadv_neigh_ifinfo " Sven Eckelmann
2016-01-17  6:57   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 14/20] batman-adv: Convert batadv_orig_ifinfo " Sven Eckelmann
2016-01-17  6:59   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 15/20] batman-adv: Convert batadv_neigh_node " Sven Eckelmann
2016-01-17  7:01   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 16/20] batman-adv: Convert batadv_hard_iface " Sven Eckelmann
2016-01-17  8:35   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 17/20] batman-adv: Convert batadv_orig_node_vlan " Sven Eckelmann
2016-01-17  8:38   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 18/20] batman-adv: Convert batadv_orig_node " Sven Eckelmann
2016-01-17  8:40   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 19/20] batman-adv: Convert batadv_tt_common_entry " Sven Eckelmann
2016-01-17  8:42   ` Marek Lindner
2016-01-16  9:29 ` [B.A.T.M.A.N.] [PATCH v6 20/20] batman-adv: Rename *_free_ref function to *_put Sven Eckelmann
2016-01-17  5:17 ` [B.A.T.M.A.N.] [PATCH v6 01/20] batman-adv: Add compatibility code for kref_get_unless_zero Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox