aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/main.h
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2017-02-22 17:16:42 +0100
committerSimon Wunderlich <sw@simonwunderlich.de>2017-03-16 21:14:53 +0100
commitf7a2bd6544657f125d2c8a8b4f231a8cd225ee8f (patch)
tree3957c6785eb185496ec60b2649d3bfde17461e75 /net/batman-adv/main.h
parentbatman-adv: Fix possible side-effects in _batadv_dbg (diff)
downloadlinux-dev-f7a2bd6544657f125d2c8a8b4f231a8cd225ee8f.tar.xz
linux-dev-f7a2bd6544657f125d2c8a8b4f231a8cd225ee8f.zip
batman-adv: Convert BATADV_PRINT_VID macro to function
The BATADV_PRINT_VID is not free of of possible side-effects. This can be avoided when the the macro is converted to a simple inline function. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv/main.h')
-rw-r--r--net/batman-adv/main.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index f87b17c613a6..810f7d026f54 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -193,6 +193,7 @@ enum batadv_uev_type {
#include <linux/percpu.h>
#include <linux/types.h>
+#include "packet.h"
#include "types.h"
struct net_device;
@@ -200,8 +201,19 @@ struct packet_type;
struct seq_file;
struct sk_buff;
-#define BATADV_PRINT_VID(vid) (((vid) & BATADV_VLAN_HAS_TAG) ? \
- (int)((vid) & VLAN_VID_MASK) : -1)
+/**
+ * batadv_print_vid - return printable version of vid information
+ * @vid: the VLAN identifier
+ *
+ * Return: -1 when no VLAN is used, VLAN id otherwise
+ */
+static inline int batadv_print_vid(unsigned short vid)
+{
+ if (vid & BATADV_VLAN_HAS_TAG)
+ return (int)(vid & VLAN_VID_MASK);
+ else
+ return -1;
+}
extern struct list_head batadv_hardif_list;