All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Dmitry Torokhov <dtor@vmware.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Show version information for built-in modules in sysfs
Date: Thu, 23 Dec 2010 12:57:56 +1030	[thread overview]
Message-ID: <201012231257.56971.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20101223003823.GA19568@dtor-ws.eng.vmware.com>

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@napali.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.

  reply	other threads:[~2010-12-23  2:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 22:00 [PATCH] Show version information for built-in modules in sysfs Dmitry Torokhov
2010-12-15 22:06 ` Alexey Dobriyan
2010-12-15 22:14   ` Dmitry Torokhov
2010-12-15 23:25     ` Alexey Dobriyan
2010-12-15 23:53       ` Dmitry Torokhov
2010-12-16  0:30         ` Dmitry Torokhov
2010-12-16 12:58         ` Alexey Dobriyan
2010-12-22  1:45           ` Rusty Russell
2010-12-22  1:02 ` Rusty Russell
2010-12-22  1:17   ` Dmitry Torokhov
2010-12-22  1:48     ` Rusty Russell
2010-12-23  0:38       ` Dmitry Torokhov
2010-12-23  2:27         ` Rusty Russell [this message]
2011-01-11 19:03   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012231257.56971.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=dtor@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.