[dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros

Hemant Agrawal hemant.agrawal at nxp.com
Fri Jul 10 07:11:41 CEST 2020


Change it to new location drivers/common/dpaax/caamflib/compat.h

Acked-by: Hemant Agrawal <hemant.agrawal at nxp.com>

-----Original Message-----
From: dev <dev-bounces at dpdk.org> On Behalf Of Natanael Copa
Sent: Wednesday, March 13, 2019 10:37 PM
To: dev at dpdk.org
Cc: Natanael Copa <ncopa at alpinelinux.org>
Subject: [dpdk-dev] [PATCH v3 13/15] crypto/dpaa2_sec: simplify pr_{debug, err, warn} macros

Simplify pr_debug, pr_err and pr_warn macros by add an intermediate pr_msg macro. This way we only need test for SUPPRESS_PRINTS once.

Signed-off-by: Natanael Copa <ncopa at alpinelinux.org>
---
 drivers/crypto/dpaa2_sec/hw/compat.h | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/hw/compat.h b/drivers/crypto/dpaa2_sec/hw/compat.h
index 1362045ca..e36229f5f 100644
--- a/drivers/crypto/dpaa2_sec/hw/compat.h
+++ b/drivers/crypto/dpaa2_sec/hw/compat.h
@@ -40,31 +40,27 @@
 #define __maybe_unused __attribute__((unused))  #endif
 
+#if defined(SUPPRESS_PRINTS)
+#define pr_msg(l, fmt, ...) do { } while (0) #else #define pr_msg(l, 
+fmt, ...) \
+	RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__) #endif
+
 #if !defined(pr_debug)
-#if !defined(SUPPRESS_PRINTS) && defined(RTA_DEBUG) -#define pr_debug(fmt, ...) \
-	RTE_LOG(DEBUG, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
+#if defined(RTA_DEBUG)
+#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
 #else
-#define pr_debug(fmt, ...)     do { } while (0)
+#define pr_debug(fmt, ...) do { } while (0)
 #endif
 #endif /* pr_debug */
 
 #if !defined(pr_err)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_err(fmt, ...) \
-	RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_err(fmt, ...)    do { } while (0)
-#endif
+#define pr_err(fmt, ...) pr_msg(ERR, fmt, ##__VA_ARGS__)
 #endif /* pr_err */
 
 #if !defined(pr_warn)
-#if !defined(SUPPRESS_PRINTS)
-#define pr_warn(fmt, ...) \
-	RTE_LOG(WARNING, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
-#else
-#define pr_warn(fmt, ...)    do { } while (0)
-#endif
+#define pr_warn(fmt, ...) pr_msg(WARNING, fmt, ##__VA_ARGS__)
 #endif /* pr_warn */
 
 /**
--
2.21.0



More information about the dev mailing list