[03/13] drivers/vdpa: use log register macro
diff mbox series

Message ID 20200617063047.1555518-4-jerinj@marvell.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • rte_log registration usage improvement
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Jerin Jacob Kollanukkaran June 17, 2020, 6:30 a.m. UTC
From: Jerin Jacob <jerinj@marvell.com>

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

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 10 +---------
 drivers/vdpa/mlx5/mlx5_vdpa.c |  7 +++----
 2 files changed, 4 insertions(+), 13 deletions(-)

Patch
diff mbox series

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index ec97178dc..78299fa67 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -24,6 +24,7 @@ 
 
 #include "base/ifcvf.h"
 
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
@@ -44,8 +45,6 @@  static const char * const ifcvf_valid_arguments[] = {
 	NULL
 };
 
-static int ifcvf_vdpa_logtype;
-
 struct ifcvf_internal {
 	struct rte_vdpa_dev_addr dev_addr;
 	struct rte_pci_device *pdev;
@@ -1271,10 +1270,3 @@  static struct rte_pci_driver rte_ifcvf_vdpa = {
 RTE_PMD_REGISTER_PCI(net_ifcvf, rte_ifcvf_vdpa);
 RTE_PMD_REGISTER_PCI_TABLE(net_ifcvf, pci_id_ifcvf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ifcvf, "* vfio-pci");
-
-RTE_INIT(ifcvf_vdpa_init_log)
-{
-	ifcvf_vdpa_logtype = rte_log_register("pmd.net.ifcvf_vdpa");
-	if (ifcvf_vdpa_logtype >= 0)
-		rte_log_set_level(ifcvf_vdpa_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 1113d6cef..b166207c4 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -608,15 +608,14 @@  static struct rte_pci_driver mlx5_vdpa_driver = {
 	.drv_flags = 0,
 };
 
+
+RTE_LOG_REGISTER(mlx5_vdpa_logtype, pmd.vdpa.mlx5, NOTICE);
+
 /**
  * Driver initialization routine.
  */
 RTE_INIT(rte_mlx5_vdpa_init)
 {
-	/* Initialize common log type. */
-	mlx5_vdpa_logtype = rte_log_register("pmd.vdpa.mlx5");
-	if (mlx5_vdpa_logtype >= 0)
-		rte_log_set_level(mlx5_vdpa_logtype, RTE_LOG_NOTICE);
 	if (mlx5_glue)
 		rte_pci_register(&mlx5_vdpa_driver);
 }