[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201012231257.56971.rusty@rustcorp.com.au>
Date: Thu, 23 Dec 2010 12:57:56 +1030
From: Rusty Russell <rusty@...tcorp.com.au>
To: Dmitry Torokhov <dtor@...are.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Show version information for built-in modules in sysfs
On Thu, 23 Dec 2010 11:08:23 am Dmitry Torokhov wrote:
> On Tue, Dec 21, 2010 at 05:48:45PM -0800, Rusty Russell wrote:
> > On Wed, 22 Dec 2010 11:47:12 am Dmitry Torokhov wrote:
> > > On Tue, Dec 21, 2010 at 05:02:40PM -0800, Rusty Russell wrote:
> > > > On Thu, 16 Dec 2010 08:30:19 am Dmitry Torokhov wrote:
> > > > > +
> > > > > +#ifdef MODULE
> > > > > #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
> > > > > +#else
> > > > > +#define MODULE_VERSION(_version) \
> > > > > + extern ssize_t __modver_version_show(struct module_attribute *, \
> > > > > + struct module *, char *); \
> > > > > + static struct module_version_attribute __modver_version_attr \
> > > > > + __used \
> > > > > + __attribute__ ((unused,__section__ ("__modver"),aligned(sizeof(void *)))) \
> > > >
> > > > __used and unused seems overkill, and confused.
> > > >
> > >
> > > Must admit that I copied used/unused verbatim from linux/moduleparam.h:
> > >
> > > /* This is the fundamental function for registering boot/module
> > > parameters. */
> > > #define __module_param_call(prefix, name, ops, arg, isbool, perm) \
> > > /* Default value instead of permissions? */ \
> > > static int __param_perm_check_##name __attribute__((unused)) = \
> > > BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
> > > + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \
> > > static const char __param_str_##name[] = prefix #name; \
> > > static struct kernel_param __moduleparam_const __param_##name \
> > > __used \
> > > __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
> > > = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \
> > > { arg } }
> > >
> > >
> > > So should it be removed from here as well?
> >
> > I think so, but (as always!) check git blame.
> >
>
> Whew, found it:
>
> commit 4d62364652499ef106d1c0737968a879ef077bd4
> Author: akpm <akpm>
> Date: Tue Jan 20 05:13:24 2004 +0000
>
> [PATCH] make gcc 3.4 compilation work
>
> From: David Mosberger <davidm@...ali.hpl.hp.com>
>
> With gcc-3.4 we need "attribute((used))" declarations to get "make
> modules_install" to work.
>
> Otherwise these sections get dropped from the final image (I assume).
>
> BKrev: 400cb8f4ByHxZCElstAaZ3mBZ2oflQ
>
> ...
>
> diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
> index 0a5becb..cbca007 100644
> --- a/include/linux/moduleparam.h
> +++ b/include/linux/moduleparam.h
> @@ -52,6 +52,7 @@ struct kparam_array
> #define __module_param_call(prefix, name, set, get, arg, perm) \
> static char __param_str_##name[] __initdata = prefix #name; \
> static struct kernel_param const __param_##name \
> + __attribute_used__ \
> __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
> = { __param_str_##name, perm, set, get, arg }
>
>
> Since we still claim to support GCC 3.4 I guess __used is still
> needed...
Well, __used is correct. But this unused should have been removed
at the same time.
Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists