[dpdk-dev] [PATCH v3 09/13] drivers/compress: use log register macro

jerinj at marvell.com jerinj at marvell.com
Wed Jul 1 08:48:24 CEST 2020


From: Jerin Jacob <jerinj at marvell.com>

Use log register macro to avoid the code duplication
in the log registration process.

Signed-off-by: Jerin Jacob <jerinj at marvell.com>
Acked-by: Adam Dybkowski <adamx.dybkowski at intel.com>
---
 drivers/compress/isal/isal_compress_pmd.c | 10 +---------
 drivers/compress/octeontx/otx_zip_pmd.c   | 10 +---------
 drivers/compress/zlib/zlib_pmd.c          | 10 +---------
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index 7d2b05c91..0ecca12a8 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -25,8 +25,6 @@
 #define ISAL_VERSION_STRING \
 	ISAL_TOSTRING(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)
 
-int isal_logtype_driver;
-
 /* Verify and set private xform parameters */
 int
 isal_comp_set_priv_xform_parameters(struct isal_priv_xform *priv_xform,
@@ -752,10 +750,4 @@ static struct rte_vdev_driver compdev_isal_pmd_drv = {
 RTE_PMD_REGISTER_VDEV(COMPDEV_NAME_ISAL_PMD, compdev_isal_pmd_drv);
 RTE_PMD_REGISTER_PARAM_STRING(COMPDEV_NAME_ISAL_PMD,
 	"socket_id=<int>");
-
-RTE_INIT(isal_init_log)
-{
-	isal_logtype_driver = rte_log_register("pmd.compress.isal");
-	if (isal_logtype_driver >= 0)
-		rte_log_set_level(isal_logtype_driver, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(isal_logtype_driver, pmd.compress.isal, INFO);
diff --git a/drivers/compress/octeontx/otx_zip_pmd.c b/drivers/compress/octeontx/otx_zip_pmd.c
index bff8ef035..bee90fc7c 100644
--- a/drivers/compress/octeontx/otx_zip_pmd.c
+++ b/drivers/compress/octeontx/otx_zip_pmd.c
@@ -11,8 +11,6 @@
 
 #include "otx_zip.h"
 
-int octtx_zip_logtype_driver;
-
 static const struct rte_compressdev_capabilities
 				octtx_zip_pmd_capabilities[] = {
 	{	.algo = RTE_COMP_ALGO_DEFLATE,
@@ -648,10 +646,4 @@ static struct rte_pci_driver octtx_zip_pmd = {
 
 RTE_PMD_REGISTER_PCI(COMPRESSDEV_NAME_ZIP_PMD, octtx_zip_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(COMPRESSDEV_NAME_ZIP_PMD, pci_id_octtx_zipvf_table);
-
-RTE_INIT(octtx_zip_init_log)
-{
-	octtx_zip_logtype_driver = rte_log_register("pmd.compress.octeontx");
-	if (octtx_zip_logtype_driver >= 0)
-		rte_log_set_level(octtx_zip_logtype_driver, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(octtx_zip_logtype_driver, pmd.compress.octeontx, INFO);
diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c
index e39be2ed8..8a79d15c9 100644
--- a/drivers/compress/zlib/zlib_pmd.c
+++ b/drivers/compress/zlib/zlib_pmd.c
@@ -7,8 +7,6 @@
 
 #include "zlib_pmd_private.h"
 
-int zlib_logtype_driver;
-
 /** Compute next mbuf in the list, assign data buffer and length,
  *  returns 0 if mbuf is NULL
  */
@@ -428,10 +426,4 @@ static struct rte_vdev_driver zlib_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(COMPRESSDEV_NAME_ZLIB_PMD, zlib_pmd_drv);
-
-RTE_INIT(zlib_init_log)
-{
-	zlib_logtype_driver = rte_log_register("pmd.compress.zlib");
-	if (zlib_logtype_driver >= 0)
-		rte_log_set_level(zlib_logtype_driver, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(zlib_logtype_driver, pmd.compress.zlib, INFO);
-- 
2.27.0



More information about the dev mailing list