Cleanup of -Wunused-const-variable in drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
Subsystems (3)
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
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' inmvpp2_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
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
@@ -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
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@@ -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
David Miller
maintainerRe: [PATCH] net: mvpp2: cls: Add pmap to fs dump
In reply to Nathan HuckleberryFrom: 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?
Re: [PATCH] net: mvpp2: cls: Add pmap to fs dump
In reply to Nathan HuckleberryHello 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
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
@@ -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
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
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
Re: [PATCH v2] net: mvpp2: debugfs: Add pmap to fs dump
In reply to Nathan HuckleberryFrom: 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.