linux/drivers/staging/most
Bhumika Goyal d983c59775 Staging: most: hdm-dim2: constify attribute_group structures
Check for attribute_group structures that are only passed as a second
argument to the functions sysfs_remove_group and sysfs_create_group. As
these arguments are constant so, attribute_group structures having this
property can also be made constant.
Done using coccinelle:

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

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

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

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

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

File size before:
   text	   data	    bss	    dec	    hex	filename
    509	    160	      0	    669	    29d
drivers/staging/most/hdm-dim2/dim2_sysfs.o

File size after:
   text	   data	    bss	    dec	    hex	filename
    565	     96	      0	    661	    295
drivers/staging/most/hdm-dim2/dim2_sysfs.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-02 17:24:00 +02:00
..
aim-cdev staging: most: aim-cdev: make syscall write accept buffers of arbitrary size 2016-09-23 19:00:44 +02:00
aim-network staging: most: aim-network: fix interrupt unsafe spinlocks 2016-08-18 17:24:00 +02:00
aim-sound Staging: most: aim-sound: constify snd_pcm_ops structures 2016-09-27 13:06:55 +02:00
aim-v4l2 Staging: most: aim-v4l2: constify v4l2_file_operations structures 2016-09-27 13:06:55 +02:00
Documentation staging: most: Documentation: update ABI description 2016-09-12 09:47:15 +02:00
hdm-dim2 Staging: most: hdm-dim2: constify attribute_group structures 2016-10-02 17:24:00 +02:00
hdm-i2c staging: most: use preferred kernel types 2015-10-24 19:08:20 -07:00
hdm-usb staging: most: replace MOST_CH_ISOC_AVP with MOST_CH_ISOC 2016-09-22 11:54:47 +02:00
mostcore staging: most: replace MOST_CH_ISOC_AVP with MOST_CH_ISOC 2016-09-22 11:54:47 +02:00
Kconfig Staging: most: MOST and MOSTCORE should depend on HAS_DMA 2015-09-13 09:24:44 -07:00
Makefile Staging: most: add MOST driver's hdm-usb module 2015-07-24 13:50:43 -07:00
TODO