* [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n.
@ 2011-03-13 15:48 Rakib Mullick
2011-03-14 22:34 ` Andrew Morton
2011-03-24 7:54 ` [origin tree build failure] " Ingo Molnar
0 siblings, 2 replies; 6+ messages in thread
From: Rakib Mullick @ 2011-03-13 15:48 UTC (permalink / raw)
To: Jan Harkes; +Cc: Andrew Morton, LKML, coda, codalist
When CONFIG_SYSCTL=n, we get the following warning:
fs/coda/sysctl.c:18: warning: ‘coda_table’ defined but not used
Following patches fixes the above warning by making sure coda_table
and it's callee
function are in the same context. It also cleans up the code by
removing extra #ifdef.
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index c6405ce..d9cc2b3 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -13,7 +13,6 @@
#ifdef CONFIG_SYSCTL
static struct ctl_table_header *fs_table_header;
-#endif
static ctl_table coda_table[] = {
{
@@ -40,7 +39,6 @@ static ctl_table coda_table[] = {
{}
};
-#ifdef CONFIG_SYSCTL
static ctl_table fs_table[] = {
{
.procname = "coda",
@@ -49,22 +47,23 @@ static ctl_table fs_table[] = {
},
{}
};
-#endif
void coda_sysctl_init(void)
{
-#ifdef CONFIG_SYSCTL
if ( !fs_table_header )
fs_table_header = register_sysctl_table(fs_table);
-#endif
}
void coda_sysctl_clean(void)
{
-#ifdef CONFIG_SYSCTL
if ( fs_table_header ) {
unregister_sysctl_table(fs_table_header);
fs_table_header = NULL;
}
-#endif
}
+#else
+
+#define coda_sysctl_init() do { } while (0);
+#define coda_sysctl_clean() do { } while (0);
+
+#endif
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n.
2011-03-13 15:48 [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n Rakib Mullick
@ 2011-03-14 22:34 ` Andrew Morton
2011-03-15 3:27 ` Rakib Mullick
2011-03-24 7:54 ` [origin tree build failure] " Ingo Molnar
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2011-03-14 22:34 UTC (permalink / raw)
To: Rakib Mullick; +Cc: Jan Harkes, LKML, coda, codalist
On Sun, 13 Mar 2011 21:48:23 +0600
Rakib Mullick <rakib.mullick@gmail.com> wrote:
> When CONFIG_SYSCTL=n, we get the following warning:
>
> fs/coda/sysctl.c:18: warning: ___coda_table___ defined but not used
>
> Following patches fixes the above warning by making sure coda_table
> and it's callee
> function are in the same context. It also cleans up the code by
> removing extra #ifdef.
>
> ...
>
> --- a/fs/coda/sysctl.c
> +++ b/fs/coda/sysctl.c
>
> ...
>
> +#else
> +
> +#define coda_sysctl_init() do { } while (0);
> +#define coda_sysctl_clean() do { } while (0);
> +
> +#endif
These do/while stubs should not have the trailing ";" - adding them
will cause breakage in some calling scenarios.
It is much better to implement such stubs in C rather than as macros.
But these stubs can't be doing anything useful anyway: they appear at
the end of a .c file which wasn't #included by anything. Therefore:
--- a/fs/coda/sysctl.c~fs-coda-fix-compile-warning-when-config_sysctl=n-fix
+++ a/fs/coda/sysctl.c
@@ -61,9 +61,4 @@ void coda_sysctl_clean(void)
fs_table_header = NULL;
}
}
-#else
-
-#define coda_sysctl_init() do { } while (0);
-#define coda_sysctl_clean() do { } while (0);
-
#endif
_
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n.
2011-03-14 22:34 ` Andrew Morton
@ 2011-03-15 3:27 ` Rakib Mullick
0 siblings, 0 replies; 6+ messages in thread
From: Rakib Mullick @ 2011-03-15 3:27 UTC (permalink / raw)
To: Andrew Morton; +Cc: Jan Harkes, LKML, coda, codalist
On Tue, Mar 15, 2011 at 4:34 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Sun, 13 Mar 2011 21:48:23 +0600
> Rakib Mullick <rakib.mullick@gmail.com> wrote:
>
> These do/while stubs should not have the trailing ";" - adding them
> will cause breakage in some calling scenarios.
>
I missed that, these stubs are not used by anything. I wasn't sure,
who knows, some random config might trigger some more warning. So I
kept it.
> It is much better to implement such stubs in C rather than as macros.
>
I'll remember.
> But these stubs can't be doing anything useful anyway: they appear at
> the end of a .c file which wasn't #included by anything. Therefore:
>
> --- a/fs/coda/sysctl.c~fs-coda-fix-compile-warning-when-config_sysctl=n-fix
> +++ a/fs/coda/sysctl.c
> @@ -61,9 +61,4 @@ void coda_sysctl_clean(void)
> fs_table_header = NULL;
> }
> }
> -#else
> -
> -#define coda_sysctl_init() do { } while (0);
> -#define coda_sysctl_clean() do { } while (0);
> -
> #endif
> _
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [origin tree build failure] Re: [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n.
2011-03-13 15:48 [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n Rakib Mullick
2011-03-14 22:34 ` Andrew Morton
@ 2011-03-24 7:54 ` Ingo Molnar
2011-03-24 10:46 ` Rakib Mullick
1 sibling, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2011-03-24 7:54 UTC (permalink / raw)
To: Rakib Mullick
Cc: Jan Harkes, Andrew Morton, LKML, coda, codalist, Linus Torvalds
* Rakib Mullick <rakib.mullick@gmail.com> wrote:
> When CONFIG_SYSCTL=n, we get the following warning:
>
> fs/coda/sysctl.c:18: warning: ‘coda_table’ defined but not used
>
> Following patches fixes the above warning by making sure coda_table
> and it's callee
> function are in the same context. It also cleans up the code by
> removing extra #ifdef.
>
>
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> ---
>
> diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
> index c6405ce..d9cc2b3 100644
> --- a/fs/coda/sysctl.c
> +++ b/fs/coda/sysctl.c
FYI, the v2 of this patch:
0bc825d240ab: codafs: fix compile warning when CONFIG_SYSCTL=n
broke the upstream build:
fs/built-in.o: In function `init_coda':
psdev.c:(.init.text+0x2549): undefined reference to `coda_sysctl_clean'
fs/built-in.o: In function `exit_coda':
psdev.c:(.exit.text+0x1bf): undefined reference to `coda_sysctl_clean'
fs/built-in.o: In function `init_coda_psdev':
psdev.c:(.text.unlikely+0x21e1): undefined reference to `coda_sysctl_init'
I don't think the -v2 commit was build-tested with !CONFIG_PROC_SYSCTL &&
CONFIG_CODA_FS=y.
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [origin tree build failure] Re: [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n.
2011-03-24 7:54 ` [origin tree build failure] " Ingo Molnar
@ 2011-03-24 10:46 ` Rakib Mullick
2011-03-24 16:02 ` Randy Dunlap
0 siblings, 1 reply; 6+ messages in thread
From: Rakib Mullick @ 2011-03-24 10:46 UTC (permalink / raw)
To: Ingo Molnar
Cc: Jan Harkes, Andrew Morton, LKML, coda, codalist, Linus Torvalds
On Thu, Mar 24, 2011 at 1:54 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Rakib Mullick <rakib.mullick@gmail.com> wrote:
>
>> When CONFIG_SYSCTL=n, we get the following warning:
>>
>> fs/coda/sysctl.c:18: warning: ‘coda_table’ defined but not used
>>
>> Following patches fixes the above warning by making sure coda_table
>> and it's callee
>> function are in the same context. It also cleans up the code by
>> removing extra #ifdef.
>>
>>
>> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
>> ---
>>
>> diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
>> index c6405ce..d9cc2b3 100644
>> --- a/fs/coda/sysctl.c
>> +++ b/fs/coda/sysctl.c
>
> FYI, the v2 of this patch:
>
> 0bc825d240ab: codafs: fix compile warning when CONFIG_SYSCTL=n
>
> broke the upstream build:
>
> fs/built-in.o: In function `init_coda':
> psdev.c:(.init.text+0x2549): undefined reference to `coda_sysctl_clean'
> fs/built-in.o: In function `exit_coda':
> psdev.c:(.exit.text+0x1bf): undefined reference to `coda_sysctl_clean'
> fs/built-in.o: In function `init_coda_psdev':
> psdev.c:(.text.unlikely+0x21e1): undefined reference to `coda_sysctl_init'
>
> I don't think the -v2 commit was build-tested with !CONFIG_PROC_SYSCTL &&
> CONFIG_CODA_FS=y.
>
Andrew cleans up the unnecessary stubs. But, clearly removed
definition is necessary. And Yes, you are right, I didn't build test
it. Sorry for that. Please consider the following patch.
---
codafs: Fix build break when CONFIG_PROC_SYSCTL=n
Commit 0bc825d240ab (codafs: fix compile warning when
CONFIG_SYSCTL=n), introduces build breakage, when CONFIG_PROC_SYSCTL=n
and CONFIG_CODA_FS=y. This patch fixes it.
fs/built-in.o: In function `init_coda':
psdev.c:(.init.text+0xc02): undefined reference to `coda_sysctl_init'
psdev.c:(.init.text+0xc7c): undefined reference to `coda_sysctl_clean'
fs/built-in.o: In function `exit_coda':
psdev.c:(.exit.text+0xa9): undefined reference to `coda_sysctl_clean'
make: *** [.tmp_vmlinux1] Error 1
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Reported-by: Ingo Molnar <mingo@elte.hu>
---
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index 06d27a4..af56ad5 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -61,4 +61,13 @@ void coda_sysctl_clean(void)
fs_table_header = NULL;
}
}
+
+#else
+void coda_sysctl_init(void)
+{
+}
+
+void coda_sysctl_clean(void)
+{
+}
#endif
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [origin tree build failure] Re: [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n.
2011-03-24 10:46 ` Rakib Mullick
@ 2011-03-24 16:02 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2011-03-24 16:02 UTC (permalink / raw)
To: Rakib Mullick
Cc: Ingo Molnar, Jan Harkes, Andrew Morton, LKML, coda, codalist,
Linus Torvalds
On Thu, 24 Mar 2011 16:46:15 +0600 Rakib Mullick wrote:
> On Thu, Mar 24, 2011 at 1:54 PM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Rakib Mullick <rakib.mullick@gmail.com> wrote:
> >
> >> When CONFIG_SYSCTL=n, we get the following warning:
> >>
> >> fs/coda/sysctl.c:18: warning: ‘coda_table’ defined but not used
> >>
> >> Following patches fixes the above warning by making sure coda_table
> >> and it's callee
> >> function are in the same context. It also cleans up the code by
> >> removing extra #ifdef.
> >>
> >>
> >> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> >> ---
> >>
> >> diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
> >> index c6405ce..d9cc2b3 100644
> >> --- a/fs/coda/sysctl.c
> >> +++ b/fs/coda/sysctl.c
> >
> > FYI, the v2 of this patch:
> >
> > 0bc825d240ab: codafs: fix compile warning when CONFIG_SYSCTL=n
> >
> > broke the upstream build:
> >
> > fs/built-in.o: In function `init_coda':
> > psdev.c:(.init.text+0x2549): undefined reference to `coda_sysctl_clean'
> > fs/built-in.o: In function `exit_coda':
> > psdev.c:(.exit.text+0x1bf): undefined reference to `coda_sysctl_clean'
> > fs/built-in.o: In function `init_coda_psdev':
> > psdev.c:(.text.unlikely+0x21e1): undefined reference to `coda_sysctl_init'
> >
> > I don't think the -v2 commit was build-tested with !CONFIG_PROC_SYSCTL &&
> > CONFIG_CODA_FS=y.
> >
> Andrew cleans up the unnecessary stubs. But, clearly removed
> definition is necessary. And Yes, you are right, I didn't build test
> it. Sorry for that. Please consider the following patch.
>
> ---
> codafs: Fix build break when CONFIG_PROC_SYSCTL=n
>
> Commit 0bc825d240ab (codafs: fix compile warning when
> CONFIG_SYSCTL=n), introduces build breakage, when CONFIG_PROC_SYSCTL=n
> and CONFIG_CODA_FS=y. This patch fixes it.
>
> fs/built-in.o: In function `init_coda':
> psdev.c:(.init.text+0xc02): undefined reference to `coda_sysctl_init'
> psdev.c:(.init.text+0xc7c): undefined reference to `coda_sysctl_clean'
> fs/built-in.o: In function `exit_coda':
> psdev.c:(.exit.text+0xa9): undefined reference to `coda_sysctl_clean'
> make: *** [.tmp_vmlinux1] Error 1
>
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> Reported-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Thanks.
> ---
>
> diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
> index 06d27a4..af56ad5 100644
> --- a/fs/coda/sysctl.c
> +++ b/fs/coda/sysctl.c
> @@ -61,4 +61,13 @@ void coda_sysctl_clean(void)
> fs_table_header = NULL;
> }
> }
> +
> +#else
> +void coda_sysctl_init(void)
> +{
> +}
> +
> +void coda_sysctl_clean(void)
> +{
> +}
> #endif
> --
> 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/
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-24 16:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-13 15:48 [PATCH] fs, coda: Fix compile warning when CONFIG_SYSCTL=n Rakib Mullick
2011-03-14 22:34 ` Andrew Morton
2011-03-15 3:27 ` Rakib Mullick
2011-03-24 7:54 ` [origin tree build failure] " Ingo Molnar
2011-03-24 10:46 ` Rakib Mullick
2011-03-24 16:02 ` Randy Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox