* [PATCH] staging: lustre: linux-prim.c: fix sparse warnings about static declaration
@ 2014-12-29 11:10 Serguey Parkhomovsky
2014-12-30 22:35 ` Jeremiah Mahler
0 siblings, 1 reply; 4+ messages in thread
From: Serguey Parkhomovsky @ 2014-12-29 11:10 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman
Cc: HPDD-discuss, devel, linux-kernel
Fixes the following sparse warnings:
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:198:1: warning: symbol 'libcfs_arch_init' was not declared. Should it be static?
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:204:1: warning: symbol 'libcfs_arch_cleanup' was not declared. Should it be static?
Signed-off-by: Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com>
---
drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
index 19f405e..4fee73f 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
@@ -194,14 +194,12 @@ cfs_clear_sigpending(void)
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
}
-int
-libcfs_arch_init(void)
+static int libcfs_arch_init(void)
{
return 0;
}
-void
-libcfs_arch_cleanup(void)
+static void libcfs_arch_cleanup(void)
{
return;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: lustre: linux-prim.c: fix sparse warnings about static declaration
2014-12-29 11:10 [PATCH] staging: lustre: linux-prim.c: fix sparse warnings about static declaration Serguey Parkhomovsky
@ 2014-12-30 22:35 ` Jeremiah Mahler
2014-12-31 3:04 ` Serguey Parkhomovsky
0 siblings, 1 reply; 4+ messages in thread
From: Jeremiah Mahler @ 2014-12-30 22:35 UTC (permalink / raw)
To: Serguey Parkhomovsky
Cc: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman, HPDD-discuss,
devel, linux-kernel
Serguey,
On Mon, Dec 29, 2014 at 03:10:32AM -0800, Serguey Parkhomovsky wrote:
> Fixes the following sparse warnings:
>
> drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:198:1: warning: symbol 'libcfs_arch_init' was not declared. Should it be static?
> drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c:204:1: warning: symbol 'libcfs_arch_cleanup' was not declared. Should it be static?
>
> Signed-off-by: Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com>
> ---
> drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
> index 19f405e..4fee73f 100644
> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-prim.c
> @@ -194,14 +194,12 @@ cfs_clear_sigpending(void)
> spin_unlock_irqrestore(¤t->sighand->siglock, flags);
> }
>
> -int
> -libcfs_arch_init(void)
> +static int libcfs_arch_init(void)
> {
> return 0;
> }
>
> -void
> -libcfs_arch_cleanup(void)
> +static void libcfs_arch_cleanup(void)
> {
> return;
> }
If you look at the source code just below these functions you will find:
EXPORT_SYMBOL(libcfs_arch_init);
EXPORT_SYMBOL(libcfs_arch_cleanup);
So making these static is incorrect because they are being used outside
of this file.
> --
> 1.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
- Jeremiah Mahler
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: lustre: linux-prim.c: fix sparse warnings about static declaration
2014-12-30 22:35 ` Jeremiah Mahler
@ 2014-12-31 3:04 ` Serguey Parkhomovsky
2014-12-31 5:20 ` Sudip Mukherjee
0 siblings, 1 reply; 4+ messages in thread
From: Serguey Parkhomovsky @ 2014-12-31 3:04 UTC (permalink / raw)
To: Jeremiah Mahler
Cc: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman, HPDD-discuss,
devel, linux-kernel
On Tue, Dec 30, 2014 at 02:35:18PM -0800, Jeremiah Mahler wrote:
>
> If you look at the source code just below these functions you will find:
>
> EXPORT_SYMBOL(libcfs_arch_init);
> EXPORT_SYMBOL(libcfs_arch_cleanup);
>
> So making these static is incorrect because they are being used outside
> of this file.
>
Thanks for the review, and sorry about the noise; I'll be more careful next time.
Serguey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: lustre: linux-prim.c: fix sparse warnings about static declaration
2014-12-31 3:04 ` Serguey Parkhomovsky
@ 2014-12-31 5:20 ` Sudip Mukherjee
0 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2014-12-31 5:20 UTC (permalink / raw)
To: Serguey Parkhomovsky
Cc: Jeremiah Mahler, Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman,
HPDD-discuss, devel, linux-kernel
On Tue, Dec 30, 2014 at 07:04:35PM -0800, Serguey Parkhomovsky wrote:
> On Tue, Dec 30, 2014 at 02:35:18PM -0800, Jeremiah Mahler wrote:
> >
> > If you look at the source code just below these functions you will find:
> >
> > EXPORT_SYMBOL(libcfs_arch_init);
> > EXPORT_SYMBOL(libcfs_arch_cleanup);
> >
> > So making these static is incorrect because they are being used outside
> > of this file.
> >
>
> Thanks for the review, and sorry about the noise; I'll be more careful next time.
these tools are there to help you find the problems in the code.but after that we need to use our own judgement to decide.
in this case the solution is to declare them in libcfs.h
and please atleast buildtest your patch before sending. If you would have compiled this patch then you could have seen 2 new warnings:
"WARNING: "libcfs_arch_init" [drivers/staging/lustre/lustre/libcfs/libcfs.ko] undefined!"
"WARNING: "libcfs_arch_cleanup" [drivers/staging/lustre/lustre/libcfs/libcfs.ko] undefined!"
thanks
sudip
>
> Serguey
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-31 5:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-29 11:10 [PATCH] staging: lustre: linux-prim.c: fix sparse warnings about static declaration Serguey Parkhomovsky
2014-12-30 22:35 ` Jeremiah Mahler
2014-12-31 3:04 ` Serguey Parkhomovsky
2014-12-31 5:20 ` Sudip Mukherjee
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.