staging: lustre: libcfs: fix sparse warnings about static declaration
PATCH 1/1 staging: lustre: libcfs: fix sparse warnings about static declaration
make sparse happy since these two fuchtion are only used in module.c. tested by successful compilation.
--- drivers/staging/lustre/lustre/libcfs/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/module.c +2 -4
@@ -42,8 +42,7 @@#include "../../include/linux/lnet/lnet.h" #include "tracefile.h" -void -kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu) {struct page **level0p = &ldu->ldu_memhog_root_page;struct page **level1p;
@@ -86,8 +85,7 @@ kportal_memhog_free (struct libcfs_device_userstate *ldu)LASSERT (ldu->ldu_memhog_pages ==0 ); } -int -kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages, +static int kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages,gfp_t flags) {struct page **level0p;
Signature · 1 line
1.9.1
Ping.
Thanks for any comments
Quoted 35 lines · On Tue, 16 Dec 2014 22:39:38 +0800 from [email protected] wrote:
make sparse happy since these two fuchtion are only used in
module.c. tested by successful compilation.Signed-off-by Jia He <[email protected]>Cc Oleg Drokin <[email protected]>Cc Andreas Dilger <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- drivers/staging/lustre/lustre/libcfs/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/libcfs/module.c +2
-4@@ -42,8 +42,7 @@#include "../../include/linux/lnet/lnet.h" #include "tracefile.h" -void -kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu) {struct page **level0p = &ldu->ldu_memhog_root_page;struct page **level1p;@@ -86,8 +85,7 @@ kportal_memhog_free (struct libcfs_device_userstate *ldu)LASSERT (ldu->ldu_memhog_pages ==0 ); } -int -kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages, +static int kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages,gfp_t flags) {struct page **level0p;
Hi all
Ping again, any comments are welcome
Justin
Quoted 35 lines · On Tue, 16 Dec 2014 22:39:38 +0800 from [email protected] wrote:
make sparse happy since these two fuchtion are only used in
module.c. tested by successful compilation.Signed-off-by Jia He <[email protected]>Cc Oleg Drokin <[email protected]>Cc Andreas Dilger <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- drivers/staging/lustre/lustre/libcfs/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/libcfs/module.c +2
-4@@ -42,8 +42,7 @@#include "../../include/linux/lnet/lnet.h" #include "tracefile.h" -void -kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu) {struct page **level0p = &ldu->ldu_memhog_root_page;struct page **level1p;@@ -86,8 +85,7 @@ kportal_memhog_free (struct libcfs_device_userstate *ldu)LASSERT (ldu->ldu_memhog_pages ==0 ); } -int -kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages, +static int kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages,gfp_t flags) {struct page **level0p;
Jia He,
Quoted 3 lines · Jia He
make sparse happy since these two fuchtion are only used in
module.c. tested by successful compilation.
spelling: s/fuchtion/function/
Not sure if "make sparse happy" is the best way to describe what you are doing. You are fixing sparse warnings.
[...]
drivers/staging/lustre/lustre/libcfs/module.c line 45
Quoted 3 lines
drivers/staging/lustre/lustre/libcfs/module.c +1
-2-void -kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu)
You might as well fix the checkpatch warning created by this line too.
[...]
These functions aren't used outside of this file so making them static looks correct.
Signature · 1 line
- Jeremiah Mahler
PATCH 1/2 staging: lustre: libcfs: fix sparse warnings about static declaration
These functions aren't used outside of this file so making them static to suppress the sparse warnings about static declaration.
--- drivers/staging/lustre/lustre/libcfs/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/module.c +2 -4
@@ -42,8 +42,7 @@#include "../../include/linux/lnet/lnet.h" #include "tracefile.h" -void -kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu) {struct page **level0p = &ldu->ldu_memhog_root_page;struct page **level1p;
@@ -86,8 +85,7 @@ kportal_memhog_free (struct libcfs_device_userstate *ldu)LASSERT (ldu->ldu_memhog_pages ==0 ); } -int -kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages, +static int kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages,gfp_t flags) {struct page **level0p;
Signature · 1 line
1.9.1
PATCH 2/2 staging: lustre: libcfs: fix space between function and open parenthesis
This fixes the space warning checked by check_patch.pl
--- drivers/staging/lustre/lustre/libcfs/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/libcfs/module.c +1 -1
@@ -42,7 +42,7 @@#include "../../include/linux/lnet/lnet.h" #include "tracefile.h" -static void kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu) {struct page **level0p = &ldu->ldu_memhog_root_page;struct page **level1p;
Signature · 1 line
1.9.1
Re: [PATCH 2/2] staging: lustre: libcfs: fix space between function and open parenthesis
Jia He,
Quoted 1 line · Jia He
This fixes the space warning checked by check_patch.pl
^^^
checkpatch.plQuoted 1 line
[...]
drivers/staging/lustre/lustre/libcfs/module.c line 46
Quoted 3 lines
drivers/staging/lustre/lustre/libcfs/module.c +1
-1-static void kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu) {
[...]
I would have included this change in with the previous patch since it is that patch that has the checkpatch warning.
Signature · 1 line
- Jeremiah Mahler
PATCH 1/1 staging: lustre: libcfs: fix sparse warnings about static declaration
In reply to Jeremiah Mahler These functions kportal_memhog_{alloc,free} aren't used outside of
this file, so making them static to suppress the sparse warnings about static declaration.
Besides, this also fixes the space warning checked by checkpatch.pl
--- drivers/staging/lustre/lustre/libcfs/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/module.c +2 -4
@@ -42,8 +42,7 @@#include "../../include/linux/lnet/lnet.h" #include "tracefile.h" -void -kportal_memhog_free (struct libcfs_device_userstate *ldu) +static void kportal_memhog_free (struct libcfs_device_userstate *ldu) {struct page **level0p = &ldu->ldu_memhog_root_page;struct page **level1p;
@@ -86,8 +85,7 @@ kportal_memhog_free (struct libcfs_device_userstate *ldu)LASSERT (ldu->ldu_memhog_pages ==0 ); } -int -kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages, +static int kportal_memhog_alloc (struct libcfs_device_userstate *ldu,int npages,gfp_t flags) {struct page **level0p;
Signature · 1 line
1.9.1
Jia He,
Your patch is looking better :-)
A few nits though.
Quoted 1 line · Jia He
These functions kportal_memhog_{alloc,free} aren't used outside of
^^^^^ Don't indent paragraphs, just use a line between paragraphs.
Quoted 4 lines
this file, so making them static to suppress the sparse warnings about static declaration.
Besides, this also fixes the space warning checked by checkpatch.pl
"Besides" doesn't sound right here. I would just say something like "Also fix the space warning ..."
In your subject line it is helpful to add a version number so people can tell that this is a new revision. For example: [PATCH v2]. git format-patch can add this automatically with the '-v' option.
[...]
Signature · 1 line
- Jeremiah Mahler