Move macro __round_mask, round_up and round_down from C file to
corresponding head file, will be used by TX function of nfp net
nfdk firmware.

Signed-off-by: Jin Liu <jin....@corigine.com>
Signed-off-by: Diana Wang <na.w...@corigine.com>
Signed-off-by: Peng Zhang <peng.zh...@corigine.com>
Signed-off-by: Chaoyong He <chaoyong...@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderl...@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -------------------
 drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c 
b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 2feca2ed81..56bbf05cd8 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -94,25 +94,6 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp)
        return rtbl;
 }
 
-/*
- * This looks more complex than it should be. But we need to get the type for
- * the ~ right in round_down (it needs to be as wide as the result!), and we
- * want to evaluate the macro arguments just once each.
- */
-#define __round_mask(x, y) ((__typeof__(x))((y) - 1))
-
-#define round_up(x, y) \
-       (__extension__ ({ \
-               typeof(x) _x = (x); \
-               ((((_x) - 1) | __round_mask(_x, y)) + 1); \
-       }))
-
-#define round_down(x, y) \
-       (__extension__ ({ \
-               typeof(x) _x = (x); \
-               ((_x) & ~__round_mask(_x, y)); \
-       }))
-
 struct nfp_rtsym_table *
 __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 {
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h 
b/drivers/net/nfp/nfpcore/nfp_rtsym.h
index 8b494211bc..d2856e19c3 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.h
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h
@@ -15,6 +15,25 @@
 #define NFP_RTSYM_TARGET_LMEM           -1
 #define NFP_RTSYM_TARGET_EMU_CACHE      -7
 
+/*
+ * This looks more complex than it should be. But we need to get the type for
+ * the ~ right in round_down (it needs to be as wide as the result!), and we
+ * want to evaluate the macro arguments just once each.
+ */
+#define __round_mask(x, y) ((__typeof__(x))((y) - 1))
+
+#define round_up(x, y) \
+       (__extension__ ({ \
+               typeof(x) _x = (x); \
+               ((((_x) - 1) | __round_mask(_x, y)) + 1); \
+       }))
+
+#define round_down(x, y) \
+       (__extension__ ({ \
+               typeof(x) _x = (x); \
+               ((_x) & ~__round_mask(_x, y)); \
+       }))
+
 /*
  * Structure describing a run-time NFP symbol.
  *
-- 
2.27.0

Reply via email to