linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: talgi@mellanox.com
Cc: saeedm@mellanox.com, linux-kernel@vger.kernel.org, Qian Cai <cai@lca.pw>
Subject: [PATCH] linux/dim: fix -Wunused-const-variable warnings
Date: Mon, 22 Jul 2019 09:08:43 -0400	[thread overview]
Message-ID: <1563800923-15441-1-git-send-email-cai@lca.pw> (raw)

There are a lot of compilation warnings due to tx_profile[] and
rx_profile[] are only used in lib/dim/net_dim.c but include/linux/dim.h
is included elsewhere.

In file included from ./include/rdma/ib_verbs.h:64,
                 from ./include/linux/mlx5/device.h:37,
                 from ./include/linux/mlx5/driver.h:51,
                 from
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:37:
./include/linux/dim.h:326:1: warning: 'tx_profile' defined but not used
[-Wunused-const-variable=]
 tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
 ^~~~~~~~~~
./include/linux/dim.h:320:1: warning: 'rx_profile' defined but not used
[-Wunused-const-variable=]
 rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
 ^~~~~~~~~~

Fix them by moving tx_profile[] and rx_profile[] into lib/dim/net_dim.c
instead.

Signed-off-by: Qian Cai <cai@lca.pw>
---
 include/linux/dim.h | 12 ------------
 lib/dim/net_dim.c   | 12 ++++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/linux/dim.h b/include/linux/dim.h
index d3a0fbfff2bb..d5f3b10fe6e1 100644
--- a/include/linux/dim.h
+++ b/include/linux/dim.h
@@ -316,18 +316,6 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
 	{64, 32}   \
 }
 
-static const struct dim_cq_moder
-rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
-	NET_DIM_RX_EQE_PROFILES,
-	NET_DIM_RX_CQE_PROFILES,
-};
-
-static const struct dim_cq_moder
-tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
-	NET_DIM_TX_EQE_PROFILES,
-	NET_DIM_TX_CQE_PROFILES,
-};
-
 /**
  *	net_dim_get_rx_moderation - provide a CQ moderation object for the given RX profile
  *	@cq_period_mode: CQ period mode
diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
index 5bcc902c5388..f2a8674721cf 100644
--- a/lib/dim/net_dim.c
+++ b/lib/dim/net_dim.c
@@ -5,6 +5,18 @@
 
 #include <linux/dim.h>
 
+static const struct dim_cq_moder
+rx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
+	NET_DIM_RX_EQE_PROFILES,
+	NET_DIM_RX_CQE_PROFILES,
+};
+
+static const struct dim_cq_moder
+tx_profile[DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
+	NET_DIM_TX_EQE_PROFILES,
+	NET_DIM_TX_CQE_PROFILES,
+};
+
 struct dim_cq_moder
 net_dim_get_rx_moderation(u8 cq_period_mode, int ix)
 {
-- 
1.8.3.1


             reply	other threads:[~2019-07-22 13:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 13:08 Qian Cai [this message]
2019-07-22 21:10 ` [PATCH] linux/dim: fix -Wunused-const-variable warnings Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1563800923-15441-1-git-send-email-cai@lca.pw \
    --to=cai@lca.pw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=talgi@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).