From: Rehas Sachdeva <aquannie@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: outreachy-kernel@googlegroups.com,
Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
James Simmons <jsimmons@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] staging: lustre: Constify kernel_param_ops structures
Date: Sat, 1 Oct 2016 22:57:24 +0530 [thread overview]
Message-ID: <20161001172724.GA3299@toblerone> (raw)
In-Reply-To: <alpine.DEB.2.10.1610011911530.3445@hadrien>
On Sat, Oct 01, 2016 at 07:13:16PM +0200, Julia Lawall wrote:
>
>
> On Sat, 1 Oct 2016, Rehas Sachdeva wrote:
>
> > Check for structs which can are not modified and hence can be declared as
> > const. Done using Coccinelle:
>
> "can are" -> "are"
Noted. Thanks
>
> This merits a little more discussion, though. I have the impression that
> these structures are used via the module_param macro. It would be useful
> to look at the expansion of the macros and see what exactly is going on.
>
Oh. I'll take a look at that. Thanks
Rehas
> julia
>
> >
> > // <smpl>
> > @r disable optional_qualifier@
> > identifier s != {peri_clk_data,threshold_attr,tracer_flags,tracer};
> > identifier i;
> > position p;
> > @@
> > static struct s i@p = { ... };
> >
> > @ok@
> > identifier r.i;
> > expression e;
> > position p;
> > @@
> > e = i@p
> >
> > @bad@
> > position p != {r.p,ok.p};
> > identifier r.i;
> > identifier r.s;
> > struct s e;
> > @@
> > e@i@p
> >
> > @depends on !bad disable optional_qualifier@
> > identifier r.i;
> > identifier r.s;
> > @@
> > static
> > +const
> > struct s i = { ... };
> > // </smpl>
> >
> > File size before:
> > text data bss dec hex filename
> > 4651 4296 1344 10291 2833
> > drivers/staging/lustre/lnet/libcfs/debug.o
> >
> > File size after:
> > text data bss dec hex filename
> > 4779 4128 1344 10251 280b
> > drivers/staging/lustre/lnet/libcfs/debug.o
> >
> > Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
> > ---
> > drivers/staging/lustre/lnet/libcfs/debug.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c
> > index 23b36b8..f9194f3 100644
> > --- a/drivers/staging/lustre/lnet/libcfs/debug.c
> > +++ b/drivers/staging/lustre/lnet/libcfs/debug.c
> > @@ -80,7 +80,7 @@ static int libcfs_param_debug_mb_set(const char *val,
> > * it needs quite a bunch of extra processing, so we define special
> > * debugmb parameter type with corresponding methods to handle this case
> > */
> > -static struct kernel_param_ops param_ops_debugmb = {
> > +static const struct kernel_param_ops param_ops_debugmb = {
> > .set = libcfs_param_debug_mb_set,
> > .get = param_get_uint,
> > };
> > @@ -138,7 +138,7 @@ static int param_set_console_max_delay(const char *val,
> > libcfs_console_min_delay, INT_MAX);
> > }
> >
> > -static struct kernel_param_ops param_ops_console_max_delay = {
> > +static const struct kernel_param_ops param_ops_console_max_delay = {
> > .set = param_set_console_max_delay,
> > .get = param_get_delay,
> > };
> > @@ -156,7 +156,7 @@ static int param_set_console_min_delay(const char *val,
> > 1, libcfs_console_max_delay);
> > }
> >
> > -static struct kernel_param_ops param_ops_console_min_delay = {
> > +static const struct kernel_param_ops param_ops_console_min_delay = {
> > .set = param_set_console_min_delay,
> > .get = param_get_delay,
> > };
> > @@ -188,7 +188,7 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp)
> > return param_set_uint_minmax(val, kp, 1, -1);
> > }
> >
> > -static struct kernel_param_ops param_ops_uintpos = {
> > +static const struct kernel_param_ops param_ops_uintpos = {
> > .set = param_set_uintpos,
> > .get = param_get_uint,
> > };
> > --
> > 2.7.4
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161001170549.GA2965%40toblerone.
> > For more options, visit https://groups.google.com/d/optout.
> >
next prev parent reply other threads:[~2016-10-01 17:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-01 17:05 [PATCH] staging: lustre: Constify kernel_param_ops structures Rehas Sachdeva
2016-10-01 17:13 ` [Outreachy kernel] " Julia Lawall
2016-10-01 17:27 ` Rehas Sachdeva [this message]
2016-10-02 10:28 ` Greg Kroah-Hartman
2016-10-02 12:58 ` Rehas Sachdeva
2016-10-02 14:17 ` Julia Lawall
2016-10-02 18:20 ` Rehas Sachdeva
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=20161001172724.GA3299@toblerone \
--to=aquannie@gmail.com \
--cc=andreas.dilger@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jsimmons@infradead.org \
--cc=julia.lawall@lip6.fr \
--cc=oleg.drokin@intel.com \
--cc=outreachy-kernel@googlegroups.com \
/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.