https://github.com/torvalds/linux
Revision 1d822a40b81568becba8777b525a1ed255a8078c authored by Bhumika Goyal on 09 January 2017, 15:21:02 UTC, committed by Michael S. Tsirkin on 19 January 2017, 21:46:29 UTC
Declare target_core_fabric_ops strucrues as const as they are only
passed as an argument to the functions target_register_template and
target_unregister_template. The arguments are of type const struct
target_core_fabric_ops *, so target_core_fabric_ops structures having
this property can be declared const.
Done using Coccinelle:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct target_core_fabric_ops i@p={...};

@ok@
position p;
identifier r.i;
@@
(
target_register_template(&i@p)
|
target_unregister_template(&i@p)
)
@bad@
position p!={r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
+const
struct target_core_fabric_ops i;

File size before: drivers/vhost/scsi.o
   text	   data	    bss	    dec	    hex	filename
  18063	   2985	     40	  21088	   5260	drivers/vhost/scsi.o

File size after: drivers/vhost/scsi.o
   text	   data	    bss	    dec	    hex	filename
  18479	   2601	     40	  21120	   5280	drivers/vhost/scsi.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
1 parent 49def18
History
Tip revision: 1d822a40b81568becba8777b525a1ed255a8078c authored by Bhumika Goyal on 09 January 2017, 15:21:02 UTC
vhost: scsi: constify target_core_fabric_ops structures
Tip revision: 1d822a4
File Mode Size
Documentation
arch
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig -rw-r--r-- 59 bytes
.get_maintainer.ignore -rw-r--r-- 31 bytes
.gitattributes -rw-r--r-- 30 bytes
.gitignore -rw-r--r-- 1.3 KB
.mailmap -rw-r--r-- 7.7 KB
COPYING -rw-r--r-- 18.3 KB
CREDITS -rw-r--r-- 96.0 KB
Kbuild -rw-r--r-- 2.8 KB
Kconfig -rw-r--r-- 252 bytes
MAINTAINERS -rw-r--r-- 382.1 KB
Makefile -rw-r--r-- 57.6 KB
README -rw-r--r-- 722 bytes

README

back to top