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>
This commit is contained in:

committed by
Simon Wunderlich

parent
a09c94d07b
commit
f7a2bd6544
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user