[06/13] drivers/mempool: use log register macro
diff mbox series

Message ID 20200617063047.1555518-7-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/mempool/dpaa/dpaa_mempool.c       | 10 ++--------
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 10 +---------
 drivers/mempool/octeontx/octeontx_fpavf.c | 10 +---------
 3 files changed, 4 insertions(+), 26 deletions(-)

Comments

Sachin Saxena (OSS) June 21, 2020, 9:46 a.m. UTC | #1
Acked-by: Sachin Saxena<sachin.saxena@oss.nxp.com>


On 17-Jun-20 12:00 PM, jerinj@marvell.com wrote:
> 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/mempool/dpaa/dpaa_mempool.c       | 10 ++--------
>   drivers/mempool/dpaa2/dpaa2_hw_mempool.c  | 10 +---------
>   drivers/mempool/octeontx/octeontx_fpavf.c | 10 +---------
>   3 files changed, 4 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
> index 451e2d5d5..8d1da8028 100644
> --- a/drivers/mempool/dpaa/dpaa_mempool.c
> +++ b/drivers/mempool/dpaa/dpaa_mempool.c
> @@ -36,7 +36,8 @@ struct dpaa_memseg_list rte_dpaa_memsegs
>   	= TAILQ_HEAD_INITIALIZER(rte_dpaa_memsegs);
>   
>   struct dpaa_bp_info *rte_dpaa_bpid_info;
> -int dpaa_logtype_mempool;
> +
> +RTE_LOG_REGISTER(dpaa_logtype_mempool, mempool.dpaa, NOTICE);
>   
>   static int
>   dpaa_mbuf_create_pool(struct rte_mempool *mp)
> @@ -357,10 +358,3 @@ static const struct rte_mempool_ops dpaa_mpool_ops = {
>   };
>   
>   MEMPOOL_REGISTER_OPS(dpaa_mpool_ops);
> -
> -RTE_INIT(dpaa_mp_init_log)
> -{
> -	dpaa_logtype_mempool = rte_log_register("mempool.dpaa");
> -	if (dpaa_logtype_mempool >= 0)
> -		rte_log_set_level(dpaa_logtype_mempool, RTE_LOG_NOTICE);
> -}
> diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> index fa9b53e64..97ce08d78 100644
> --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
> @@ -36,9 +36,6 @@
>   struct dpaa2_bp_info *rte_dpaa2_bpid_info;
>   static struct dpaa2_bp_list *h_bp_list;
>   
> -/* Dynamic logging identified for mempool */
> -int dpaa2_logtype_mempool;
> -
>   static int
>   rte_hw_mbuf_create_pool(struct rte_mempool *mp)
>   {
> @@ -454,9 +451,4 @@ static const struct rte_mempool_ops dpaa2_mpool_ops = {
>   
>   MEMPOOL_REGISTER_OPS(dpaa2_mpool_ops);
>   
> -RTE_INIT(dpaa2_mempool_init_log)
> -{
> -	dpaa2_logtype_mempool = rte_log_register("mempool.dpaa2");
> -	if (dpaa2_logtype_mempool >= 0)
> -		rte_log_set_level(dpaa2_logtype_mempool, RTE_LOG_NOTICE);
> -}
> +RTE_LOG_REGISTER(dpaa2_logtype_mempool, mempool.dpaa2, NOTICE);
> diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
> index 0ff234913..339da7824 100644
> --- a/drivers/mempool/octeontx/octeontx_fpavf.c
> +++ b/drivers/mempool/octeontx/octeontx_fpavf.c
> @@ -105,15 +105,7 @@ struct octeontx_fpadev {
>   
>   static struct octeontx_fpadev fpadev;
>   
> -int octeontx_logtype_fpavf;
> -int octeontx_logtype_fpavf_mbox;
> -
> -RTE_INIT(otx_pool_init_log)
> -{
> -	octeontx_logtype_fpavf = rte_log_register("pmd.mempool.octeontx");
> -	if (octeontx_logtype_fpavf >= 0)
> -		rte_log_set_level(octeontx_logtype_fpavf, RTE_LOG_NOTICE);
> -}
> +RTE_LOG_REGISTER(octeontx_logtype_fpavf, pmd.mempool.octeontx, NOTICE);
>   
>   /* lock is taken by caller */
>   static int

Patch
diff mbox series

diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index 451e2d5d5..8d1da8028 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -36,7 +36,8 @@  struct dpaa_memseg_list rte_dpaa_memsegs
 	= TAILQ_HEAD_INITIALIZER(rte_dpaa_memsegs);
 
 struct dpaa_bp_info *rte_dpaa_bpid_info;
-int dpaa_logtype_mempool;
+
+RTE_LOG_REGISTER(dpaa_logtype_mempool, mempool.dpaa, NOTICE);
 
 static int
 dpaa_mbuf_create_pool(struct rte_mempool *mp)
@@ -357,10 +358,3 @@  static const struct rte_mempool_ops dpaa_mpool_ops = {
 };
 
 MEMPOOL_REGISTER_OPS(dpaa_mpool_ops);
-
-RTE_INIT(dpaa_mp_init_log)
-{
-	dpaa_logtype_mempool = rte_log_register("mempool.dpaa");
-	if (dpaa_logtype_mempool >= 0)
-		rte_log_set_level(dpaa_logtype_mempool, RTE_LOG_NOTICE);
-}
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index fa9b53e64..97ce08d78 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -36,9 +36,6 @@ 
 struct dpaa2_bp_info *rte_dpaa2_bpid_info;
 static struct dpaa2_bp_list *h_bp_list;
 
-/* Dynamic logging identified for mempool */
-int dpaa2_logtype_mempool;
-
 static int
 rte_hw_mbuf_create_pool(struct rte_mempool *mp)
 {
@@ -454,9 +451,4 @@  static const struct rte_mempool_ops dpaa2_mpool_ops = {
 
 MEMPOOL_REGISTER_OPS(dpaa2_mpool_ops);
 
-RTE_INIT(dpaa2_mempool_init_log)
-{
-	dpaa2_logtype_mempool = rte_log_register("mempool.dpaa2");
-	if (dpaa2_logtype_mempool >= 0)
-		rte_log_set_level(dpaa2_logtype_mempool, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(dpaa2_logtype_mempool, mempool.dpaa2, NOTICE);
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 0ff234913..339da7824 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -105,15 +105,7 @@  struct octeontx_fpadev {
 
 static struct octeontx_fpadev fpadev;
 
-int octeontx_logtype_fpavf;
-int octeontx_logtype_fpavf_mbox;
-
-RTE_INIT(otx_pool_init_log)
-{
-	octeontx_logtype_fpavf = rte_log_register("pmd.mempool.octeontx");
-	if (octeontx_logtype_fpavf >= 0)
-		rte_log_set_level(octeontx_logtype_fpavf, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(octeontx_logtype_fpavf, pmd.mempool.octeontx, NOTICE);
 
 /* lock is taken by caller */
 static int