Skip to contentSkip to conversation

Cleanup of -Wunused-const-variable in drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c

PATCH Superseded Nathan Huckleberry 4 participants 9 messages Jun 13, 2019 – Jun 19, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hey all,

I'm looking into cleaning up ignored warnings in the kernel so we can remove compiler flags to ignore warnings.

There's an unused variable 'mvpp2_dbgfs_prs_pmap_fops' in mvpp2_debugfs.c. It looks like this code is for dumping useful information into userspace. I'd like to either remove the variable or dump it to userspace in the same way the other variables are.

Wanted to reach out for opinions on the best course of action before submitting a patch.

https://github.com/ClangBuiltLinux/linux/issues/529

Thanks,
Nathan Huckleberry

#1 lore raw

Hello Nathan,

Quoted 9 lines · On Thu, 13 Jun 2019 10:53:05 -0700 Nathan Huckleberry <[email protected]> wrote:

Hey all,

I'm looking into cleaning up ignored warnings in the kernel so we can remove compiler flags to ignore warnings.

There's an unused variable 'mvpp2_dbgfs_prs_pmap_fops' in mvpp2_debugfs.c. It looks like this code is for dumping useful information into userspace. I'd like to either remove the variable or dump it to userspace in the same way the other variables are.

Thanks for reporting this.

The ops should actually be used, fixing the warning should be as simple as adding this into mvpp2_dbgfs_prs_entry_init :

+ debugfs_create_file("pmap", 0444, prs_entry_dir, entry,
+ &mvpp2_dbgfs_prs_pmap_fops);
+

Quoted 2 lines

Wanted to reach out for opinions on the best course of action before submitting a patch.

Can you submit a patch, or do you prefer me to do it ?

Thanks,

Maxime

#2 lore raw

PATCH 1/1 net: mvpp2: cls: Add pmap to fs dump

There was an unused variable 'mvpp2_dbgfs_prs_pmap_fops' Added a usage consistent with other fops to dump pmap to userspace.

---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +3 -0
index 0ee39ea47b6b..55947bc63cfd 100644
@@ -566,6 +566,9 @@ static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent,
 	debugfs_create_file("hits", 0444, prs_entry_dir, entry,
 			    &mvpp2_dbgfs_prs_hits_fops);
 
+	ddebugfs_create_file("pmap", 0444, prs_entry_dir, entry,
+			     &mvpp2_dbgfs_prs_pmap_fops);
+
 	return 0;
 }
 
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] net: mvpp2: cls: Add pmap to fs dump

Quoted 8 lines · Nathan Huckleberry' via Clang Built Linux

There was an unused variable 'mvpp2_dbgfs_prs_pmap_fops' Added a usage consistent with other fops to dump pmap to userspace.

Looks good to me based on Maxime's suggestion. Thanks for seeking clarification and following up on the feedback.

Nathan, you should use Suggested-by tags (liberally, IMO) when your patch is based on feedback from others, in this case:

Quoted 15 lines
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +3 -0
index 0ee39ea47b6b..55947bc63cfd 100644
@@ -566,6 +566,9 @@ static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent,
        debugfs_create_file("hits", 0444, prs_entry_dir, entry,
                            &mvpp2_dbgfs_prs_hits_fops);
 
+       ddebugfs_create_file("pmap", 0444, prs_entry_dir, entry,
+                            &mvpp2_dbgfs_prs_pmap_fops);
+
Signature · 2 lines
Thanks,
~Nick Desaulniers
maintainer
#4 lore raw

Re: [PATCH] net: mvpp2: cls: Add pmap to fs dump

In reply to Nathan Huckleberry

From: Nathan Huckleberry <[email protected]>
Date: Tue, 18 Jun 2019 09:09:10 -0700

drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent, · line 569

Quoted 1 line
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +1 -0
+	ddebugfs_create_file("pmap", 0444, prs_entry_dir, entry,

drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c: In function ‘mvpp2_dbgfs_prs_entry_init’:
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c:569:2: error: implicit declaration of function ‘ddebugfs_create_file’; did you mean ‘debugfs_create_file’? [-Werror=implicit-function-declaration]

This doesn't compile, did you build test this?

#5 lore raw

Re: [PATCH] net: mvpp2: cls: Add pmap to fs dump

In reply to Nathan Huckleberry

Hello Nathan,

Quoted 3 lines · On Tue, 18 Jun 2019 09:09:10 -0700 Nathan Huckleberry <[email protected]> wrote:

There was an unused variable 'mvpp2_dbgfs_prs_pmap_fops' Added a usage consistent with other fops to dump pmap to userspace.

Thanks for sending a fix. Besides the typo preventing your patch from compiling, you should also prefix the patch by "net: mvpp2: debugfs:" rather than "cls", which is used for classifier patches.

Thanks,

Maxime

#6 lore raw

PATCH v2 1/1 net: mvpp2: debugfs: Add pmap to fs dump

There was an unused variable 'mvpp2_dbgfs_prs_pmap_fops' Added a usage consistent with other fops to dump pmap to userspace.

---
Changes from v1 -> v2
* Fix typo
* Change commit prefix to debugfs

 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +3 -0
index 0ee39ea47b6b..274fb07362cb 100644
@@ -566,6 +566,9 @@ static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent,
 	debugfs_create_file("hits", 0444, prs_entry_dir, entry,
 			    &mvpp2_dbgfs_prs_hits_fops);
 
+	debugfs_create_file("pmap", 0444, prs_entry_dir, entry,
+			     &mvpp2_dbgfs_prs_pmap_fops);
+
 	return 0;
 }
 
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
Tested-by Reviewed-by on v2 1/1
#7 lore raw

Re: [PATCH v2] net: mvpp2: debugfs: Add pmap to fs dump

Quoted 8 lines · Nathan Huckleberry' via Clang Built Linux

There was an unused variable 'mvpp2_dbgfs_prs_pmap_fops' Added a usage consistent with other fops to dump pmap to userspace.

Changes from v1 -> v2
* Fix typo
* Change commit prefix to debugfs

Compile-

Requires make ... W=1 before the patch to observe the warning.

Quoted 8 lines
 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +0 -0
index 0ee39ea47b6b..274fb07362cb 100644

drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent, · line 571

Quoted 6 lines
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +3 -0
@@ -566,6 +566,9 @@ static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent,
        debugfs_create_file("hits", 0444, prs_entry_dir, entry,
                            &mvpp2_dbgfs_prs_hits_fops);
 
+       debugfs_create_file("pmap", 0444, prs_entry_dir, entry,
+                            &mvpp2_dbgfs_prs_pmap_fops);
+

Thanks,
~Nick Desaulniers

maintainer Applied
#8 lore raw

Re: [PATCH v2] net: mvpp2: debugfs: Add pmap to fs dump

In reply to Nathan Huckleberry

From: Nathan Huckleberry <[email protected]>
Date: Wed, 19 Jun 2019 11:17:15 -0700

Quoted 7 lines

There was an unused variable 'mvpp2_dbgfs_prs_pmap_fops' Added a usage consistent with other fops to dump pmap to userspace.

Applied.