From: Bhumika Goyal <bhumirks@gmail.com>
To: julia.lawall@lip6.fr, minyard@acm.org, benh@kernel.crashing.org,
paulus@samba.org, mpe@ellerman.id.au,
openipmi-developer@lists.sourceforge.net,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: Bhumika Goyal <bhumirks@gmail.com>
Subject: [PATCH] char: ipmi: constify ipmi_smi_handlers structures
Date: Mon, 16 Jan 2017 00:45:00 +0530 [thread overview]
Message-ID: <1484507700-28236-1-git-send-email-bhumirks@gmail.com> (raw)
Declare ipmi_smi_handlers structures as const as they are only passed as
an argument to the function ipmi_register_smi. This argument is of type
const, so ipmi_smi_handlers structures having similar properties can be
declared const too.
Done using Coccinelle:
@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct ipmi_smi_handlers i@p={...};
@ok1@
identifier r1.i;
position p;
@@
ipmi_register_smi(&i@p,...)
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct ipmi_smi_handlers i;
Size details after cross compiling the .o file for powerpc architecture
File size before:
text data bss dec hex filename
2777 288 0 3065 bf9 drivers/char/ipmi/ipmi_powernv.o
File size after:
text data bss dec hex filename
2873 192 0 3065 bf9 drivers/char/ipmi/ipmi_powernv.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/char/ipmi/ipmi_powernv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c
index 6e658aa..b338a4b 100644
--- a/drivers/char/ipmi/ipmi_powernv.c
+++ b/drivers/char/ipmi/ipmi_powernv.c
@@ -196,7 +196,7 @@ static void ipmi_powernv_poll(void *send_info)
ipmi_powernv_recv(smi);
}
-static struct ipmi_smi_handlers ipmi_powernv_smi_handlers = {
+static const struct ipmi_smi_handlers ipmi_powernv_smi_handlers = {
.owner = THIS_MODULE,
.start_processing = ipmi_powernv_start_processing,
.sender = ipmi_powernv_send,
--
1.9.1
next reply other threads:[~2017-01-15 19:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-15 19:15 Bhumika Goyal [this message]
2017-01-15 20:28 ` [PATCH] char: ipmi: constify ipmi_smi_handlers structures Corey Minyard
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=1484507700-28236-1-git-send-email-bhumirks@gmail.com \
--to=bhumirks@gmail.com \
--cc=benh@kernel.crashing.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=minyard@acm.org \
--cc=mpe@ellerman.id.au \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).