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)
commit67f9dcb155875864ccaf74625a7c702e6d07ab31
treea1f3878e93912eedd261b5359be36bfafa2a3270
parent9ab9d4529a612fde4f196d445b7547dd6d6a64ed
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