Re: [PATCH] 9p: fix compile error if !CONFIG_SYSCTL

From: Andreas Herrmann
Date: Tue Sep 18 2007 - 16:14:24 EST


On Tue, Sep 18, 2007 at 08:53:19PM +0200, roel wrote:
> Andreas Herrmann wrote:
> > Fix compile error if !CONFIG_SYSCTL:
> >
> > ...
> > LD .tmp_vmlinux1
> > net/built-in.o: In function `init_p9':
> > net/9p/mod.c:59: undefined reference to `p9_sysctl_register'
> > net/built-in.o: In function `exit_p9':
> > net/9p/mod.c:75: undefined reference to `p9_sysctl_unregister'
> > make: *** [.tmp_vmlinux1] Error 1
> > ...
> >
> isn't it nicer to do something like this instead?

No.

> diff --git a/net/9p/sysctl.c b/net/9p/sysctl.c
> index 8b61027..e199865 100644
> --- a/net/9p/sysctl.c
> +++ b/net/9p/sysctl.c
> @@ -68,14 +68,17 @@ static struct ctl_table_header *p9_table_header;
>
> int __init p9_sysctl_register(void)
> {
> +#ifdef CONFIG_SYSCTL
> p9_table_header = register_sysctl_table(p9_ctl_table);
> if (!p9_table_header)
> return -ENOMEM;
> -
> +#endif
> return 0;
> }
>
> void __exit p9_sysctl_unregister(void)
> {
> +#ifdef CONFIG_SYSCTL
> unregister_sysctl_table(p9_table_header);
> +#endif
> }

The problem is not that (un)register_sysctl_table were not defined
if !CONFIG_SYSCTL. There are stubs in kernel/sysctl.c for this case.
I.e. your patch is superfluous.

The point is, 9p/sysctl.c is compiled iff CONFIG_SYSCTL is set.
See net/9p/Makefile ...


Regards,

Andreas

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/