[v4,11/13] net/nfp: move macro from C file to head file

Message ID 20220623022615.3628093-12-jin.liu@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Add support of NFP3800 chip and firmware with NFDk |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jin Liu June 23, 2022, 2:26 a.m. UTC
  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
firmware with NFDk.

Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@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(-)
  

Patch

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.
  *