]> Git Repo - linux.git/commitdiff
char: ipmi: constify ipmi_smi_handlers structures
authorBhumika Goyal <[email protected]>
Sun, 15 Jan 2017 19:15:00 +0000 (00:45 +0530)
committerCorey Minyard <[email protected]>
Thu, 9 Feb 2017 15:10:56 +0000 (09:10 -0600)
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 <[email protected]>
Signed-off-by: Corey Minyard <[email protected]>
drivers/char/ipmi/ipmi_powernv.c

index 6e658aa114f19da873b5d201d6c131b7350311cd..b338a4becbf8c72baa8a8e9b6b0396c1e6ee3c60 100644 (file)
@@ -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,
This page took 0.064182 seconds and 4 git commands to generate.