[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170820095828.13812-2-leon@kernel.org>
Date: Sun, 20 Aug 2017 12:58:21 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Doug Ledford <dledford@...hat.com>,
Stephen Hemminger <stephen@...workplumber.org>
Cc: linux-rdma@...r.kernel.org, Leon Romanovsky <leonro@...lanox.com>,
Dennis Dalessandro <dennis.dalessandro@...el.com>,
Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
Jiri Pirko <jiri@...lanox.com>,
Ariel Almog <ariela@...lanox.com>,
David Laight <David.Laight@...LAB.COM>,
Linux Netdev <netdev@...r.kernel.org>
Subject: [PATCH v6 iproute2 1/8] utils: Move BIT macro to common header
From: Leon Romanovsky <leonro@...lanox.com>
BIT() macro was implemented and used by devlink for now, but following
patches of rdmatool will reuse the same macro, so put it in common
header file.
Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
---
devlink/devlink.c | 2 +-
include/utils.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index f9bc16c3..7602970b 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -25,6 +25,7 @@
#include "list.h"
#include "mnlg.h"
#include "json_writer.h"
+#include "utils.h"
#define ESWITCH_MODE_LEGACY "legacy"
#define ESWITCH_MODE_SWITCHDEV "switchdev"
@@ -160,7 +161,6 @@ static void ifname_map_free(struct ifname_map *ifname_map)
free(ifname_map);
}
-#define BIT(nr) (1UL << (nr))
#define DL_OPT_HANDLE BIT(0)
#define DL_OPT_HANDLEP BIT(1)
#define DL_OPT_PORT_TYPE BIT(2)
diff --git a/include/utils.h b/include/utils.h
index 565bda60..1bb6d6a2 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -196,6 +196,8 @@ static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies)
int print_timestamp(FILE *fp);
void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n);
+#define BIT(nr) (1UL << (nr))
+
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
--
2.14.1
Powered by blists - more mailing lists