From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6F1D8A04A5;
	Wed, 17 Jun 2020 08:30:49 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 9F52F1BED2;
	Wed, 17 Jun 2020 08:30:34 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id B0BCB5B3A
 for <dev@dpdk.org>; Wed, 17 Jun 2020 08:30:32 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 05H6Q4pg010591; Tue, 16 Jun 2020 23:30:31 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0818;
 bh=8VavMKoeUTO9TRGvPPqnHNuCSM0MO8ZGHy6Nv//XnN4=;
 b=pSg7bO2IH35W5t6hSCLAR4SFTdJ8O9MG02gP0lYXcDlVMCzSJ17EH8cwgdJCGYSUQH7l
 fItVe0gBa+MNfZF52isbt8cBo90ZJTWHV3eaA0ldPIf/bPMJW2wiPImq/Ob22jp9MyoB
 JOU7z48E+9QnzWoNlHs6Gu0mmiPvyybmZLcnAJ4zWWCZ3xCTHA1/jTK+CLM8Bpo/v5/9
 0RyU8SfbX+XLG5PiNpL4utFXyBge/hWztrHssASg5zs5inFQW9xB92Q4auqkiRhTU40i
 +OcTIUhdFjcdosZti0xFTHr8zedPc/AbReVY6OPOxmEeVD5sYBP8k5ORV0HE/1YHt4Sq 9g== 
Received: from sc-exch02.marvell.com ([199.233.58.182])
 by mx0b-0016f401.pphosted.com with ESMTP id 31q658jmsh-3
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Tue, 16 Jun 2020 23:30:31 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com
 (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Tue, 16 Jun 2020 23:30:31 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Tue, 16 Jun 2020 23:30:31 -0700
Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])
 by maili.marvell.com (Postfix) with ESMTP id CDFDC3F703F;
 Tue, 16 Jun 2020 23:30:28 -0700 (PDT)
From: <jerinj@marvell.com>
To: <dev@dpdk.org>, Xiao Wang <xiao.w.wang@intel.com>, Matan Azrad
 <matan@mellanox.com>, Viacheslav Ovsiienko <viacheslavo@mellanox.com>
CC: <thomas@monjalon.net>, <olivier.matz@6wind.com>,
 <david.marchand@redhat.com>, Jerin Jacob <jerinj@marvell.com>
Date: Wed, 17 Jun 2020 12:00:37 +0530
Message-ID: <20200617063047.1555518-4-jerinj@marvell.com>
X-Mailer: git-send-email 2.26.2
In-Reply-To: <20200617063047.1555518-1-jerinj@marvell.com>
References: <20200617063047.1555518-1-jerinj@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687
 definitions=2020-06-16_13:2020-06-16,
 2020-06-16 signatures=0
Subject: [dpdk-dev]  [PATCH 03/13] drivers/vdpa: use log register macro
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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(-)

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);
 }
-- 
2.26.2