[v4,04/13] drivers/raw: use log register macro
diff mbox series

Message ID 20200701104428.4149689-5-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 fail apply issues
ci/checkpatch success coding style OK

Commit Message

Jerin Jacob Kollanukkaran July 1, 2020, 10:44 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>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c  | 11 +----------
 drivers/raw/dpaa2_qdma/dpaa2_qdma.c    | 11 +----------
 drivers/raw/ifpga/ifpga_rawdev.c       | 10 +---------
 drivers/raw/ioat/ioat_rawdev.c         | 12 ++----------
 drivers/raw/ioat/rte_ioat_rawdev.h     |  2 --
 drivers/raw/ntb/ntb.c                  | 10 +---------
 drivers/raw/skeleton/skeleton_rawdev.c | 11 +----------
 7 files changed, 7 insertions(+), 60 deletions(-)

Patch
diff mbox series

diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
index 7c21c6a52..c7bddbc6c 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c
@@ -20,9 +20,6 @@ 
 #include "dpaa2_cmdif_logs.h"
 #include "rte_pmd_dpaa2_cmdif.h"
 
-/* Dynamic log type identifier */
-int dpaa2_cmdif_logtype;
-
 /* CMDIF driver name */
 #define DPAA2_CMDIF_PMD_NAME dpaa2_dpci
 
@@ -291,10 +288,4 @@  static struct rte_vdev_driver dpaa2_cmdif_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(DPAA2_CMDIF_PMD_NAME, dpaa2_cmdif_drv);
-
-RTE_INIT(dpaa2_cmdif_init_log)
-{
-	dpaa2_cmdif_logtype = rte_log_register("pmd.raw.dpaa2.cmdif");
-	if (dpaa2_cmdif_logtype >= 0)
-		rte_log_set_level(dpaa2_cmdif_logtype, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(dpaa2_cmdif_logtype, pmd.raw.dpaa2.cmdif, INFO);
diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
index 1be1b6ddf..0b9c4e3d7 100644
--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
+++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c
@@ -26,9 +26,6 @@ 
 
 #define DPAA2_QDMA_NO_PREFETCH "no_prefetch"
 
-/* Dynamic log type identifier */
-int dpaa2_qdma_logtype;
-
 uint32_t dpaa2_coherent_no_alloc_cache;
 uint32_t dpaa2_coherent_alloc_cache;
 
@@ -1495,10 +1492,4 @@  static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = {
 RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd);
 RTE_PMD_REGISTER_PARAM_STRING(dpaa2_qdma,
 	"no_prefetch=<int> ");
-
-RTE_INIT(dpaa2_qdma_init_log)
-{
-	dpaa2_qdma_logtype = rte_log_register("pmd.raw.dpaa2.qdma");
-	if (dpaa2_qdma_logtype >= 0)
-		rte_log_set_level(dpaa2_qdma_logtype, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(dpaa2_qdma_logtype, pmd.raw.dpaa2.qdma, INFO);
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index b8701e155..cc25c662b 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -47,8 +47,6 @@ 
 #define RTE_PCI_EXT_CAP_ID(header)       (int)(header & 0x0000ffff)
 #define RTE_PCI_EXT_CAP_NEXT(header)     ((header >> 20) & 0xffc)
 
-int ifpga_rawdev_logtype;
-
 #define PCI_VENDOR_ID_INTEL          0x8086
 /* PCI Device ID */
 #define PCIE_DEVICE_ID_PF_INT_5_X    0xBCBD
@@ -1597,13 +1595,7 @@  static struct rte_pci_driver rte_ifpga_rawdev_pmd = {
 RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci");
-
-RTE_INIT(ifpga_rawdev_init_log)
-{
-	ifpga_rawdev_logtype = rte_log_register("driver.raw.init");
-	if (ifpga_rawdev_logtype >= 0)
-		rte_log_set_level(ifpga_rawdev_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index a8a48f90a..30d9f597e 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -9,9 +9,6 @@ 
 
 #include "rte_ioat_rawdev.h"
 
-/* Dynamic log type identifier */
-int ioat_pmd_logtype;
-
 static struct rte_pci_driver ioat_pmd_drv;
 
 #define IOAT_VENDOR_ID		0x8086
@@ -28,6 +25,8 @@  static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF	0x6f2F
 #define IOAT_DEVICE_ID_ICX	0x0b00
 
+RTE_LOG_REGISTER(ioat_pmd_logtype,  rawdev.ioat, INFO);
+
 #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
 	ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
 
@@ -386,10 +385,3 @@  static struct rte_pci_driver ioat_pmd_drv = {
 RTE_PMD_REGISTER_PCI(IOAT_PMD_RAWDEV_NAME, ioat_pmd_drv);
 RTE_PMD_REGISTER_PCI_TABLE(IOAT_PMD_RAWDEV_NAME, pci_id_ioat_map);
 RTE_PMD_REGISTER_KMOD_DEP(IOAT_PMD_RAWDEV_NAME, "* igb_uio | uio_pci_generic");
-
-RTE_INIT(ioat_pmd_init_log)
-{
-	ioat_pmd_logtype = rte_log_register(IOAT_PMD_LOG_NAME);
-	if (ioat_pmd_logtype >= 0)
-		rte_log_set_level(ioat_pmd_logtype, RTE_LOG_INFO);
-}
diff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h
index 4b271f174..f765a6557 100644
--- a/drivers/raw/ioat/rte_ioat_rawdev.h
+++ b/drivers/raw/ioat/rte_ioat_rawdev.h
@@ -25,8 +25,6 @@ 
 #define IOAT_PMD_RAWDEV_NAME rawdev_ioat
 /** String reported as the device driver name by rte_rawdev_info_get() */
 #define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
-/** Name used to adjust the log level for this driver */
-#define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
 /**
  * Configuration structure for an ioat rawdev instance
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index dd0b72f8c..e40412bb7 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -23,8 +23,6 @@ 
 #include "rte_pmd_ntb.h"
 #include "ntb.h"
 
-int ntb_logtype;
-
 static const struct rte_pci_id pci_id_ntb_map[] = {
 	{ RTE_PCI_DEVICE(NTB_INTEL_VENDOR_ID, NTB_INTEL_DEV_ID_B2B_SKX) },
 	{ .vendor_id = 0, /* sentinel */ },
@@ -1504,10 +1502,4 @@  static struct rte_pci_driver rte_ntb_pmd = {
 RTE_PMD_REGISTER_PCI(raw_ntb, rte_ntb_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(raw_ntb, pci_id_ntb_map);
 RTE_PMD_REGISTER_KMOD_DEP(raw_ntb, "* igb_uio | uio_pci_generic | vfio-pci");
-
-RTE_INIT(ntb_init_log)
-{
-	ntb_logtype = rte_log_register("pmd.raw.ntb");
-	if (ntb_logtype >= 0)
-		rte_log_set_level(ntb_logtype, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(ntb_logtype, pmd.raw.ntb, INFO);
diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index 586183a5b..72ece887a 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -28,9 +28,6 @@ 
 
 #include "skeleton_rawdev.h"
 
-/* Dynamic log type identifier */
-int skeleton_pmd_logtype;
-
 /* Count of instances */
 static uint16_t skeldev_init_once;
 
@@ -759,10 +756,4 @@  static struct rte_vdev_driver skeleton_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME, skeleton_pmd_drv);
-
-RTE_INIT(skeleton_pmd_init_log)
-{
-	skeleton_pmd_logtype = rte_log_register("rawdev.skeleton");
-	if (skeleton_pmd_logtype >= 0)
-		rte_log_set_level(skeleton_pmd_logtype, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);