common/dpaax/caamflib: simplify log macros

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

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
Natanael Copa 2020-11-05 22:17:15 +01:00 committed by Thomas Monjalon
parent 8bf3ff3c37
commit 69cb391787

View File

@ -40,31 +40,27 @@
#define __maybe_unused __rte_unused
#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(SUPPRESS_PRINTS)
#define pr_msg(l, fmt, ...) do { } while (0)
#else
#define pr_debug(fmt, ...) do { } while (0)
#define pr_msg(l, fmt, ...) \
RTE_LOG(l, PMD, "%s(): " fmt "\n", __func__, ##__VA_ARGS__)
#endif
#if !defined(pr_debug)
#if defined(RTA_DEBUG)
#define pr_debug(fmt, ...) pr_msg(DEBUG, fmt, ##__VA_ARGS__)
#else
#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 */
/**