]> git.baikalelectronics.ru Git - kernel.git/commit
Staging: rtl8192e: rtl_core: Constify rtllib_qos_parameters structures
authorBhumika Goyal <bhumirks@gmail.com>
Tue, 4 Oct 2016 17:52:36 +0000 (23:22 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2016 08:24:51 +0000 (10:24 +0200)
commit40e93b6581c9c18a77badbd241224833cd5341f4
treea1f3878e93912eedd261b5359be36bfafa2a3270
parentf291fdb4a19b5f07ee9178bd5193d495902d8c8d
Staging: rtl8192e: rtl_core: Constify rtllib_qos_parameters structures

Declare the structure rtllib_qos_parameters as constant as it is only
passed as the second argument to the function memcpy. This argument
is constant so the fields of rtllib_qos_parameters structure are
never modified and hence it can be declared as const.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct rtllib_qos_parameters i@p = {...};

@ok1@
identifier r1.i;
position p;
expression e1,e2;
@@
memcpy(e1,&i@p,e2)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct rtllib_qos_parameters i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct rtllib_qos_parameters i;

File size before:
   text    data     bss     dec     hex filename
  30910     496     201   31607    7b77
drivers/staging/rtl8192e/rtl8192e/rtl_core.o

File size after:
   text    data     bss     dec     hex filename
  30942     464     201   31607    7b77
drivers/staging/rtl8192e/rtl8192e/rtl_core.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtl8192e/rtl_core.c