]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Staging: most: aim-v4l2: constify v4l2_file_operations structures
authorBhumika Goyal <bhumirks@gmail.com>
Tue, 27 Sep 2016 09:17:12 +0000 (14:47 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Sep 2016 11:06:55 +0000 (13:06 +0200)
Check for v4l2_file_operations structures that are only stored in the
fops field of video_device structures. As this field is constant, so
v4l2_file_operations structures having this property can also be
declared constant.
Done using coccinelle:

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

@ok1@
identifier r1.i;
position p;
struct video_device x;
@@
x.fops=&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 v4l2_file_operations i={...};

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

File size before:
   text    data     bss     dec     hex filename
   5608     160       4    5772    168c
drivers/staging/most/aim-v4l2/video.o

File size after:
   text    data     bss     dec     hex filename
   5696      96       4    5796    16a4
drivers/staging/most/aim-v4l2/video.o

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

index 400f7271e4fce2a7c1328629446c44b6e5f9decc..e0748416aee5f88b7efb11ac68ee47e29c675bdc 100644 (file)
@@ -369,7 +369,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
        return 0;
 }
 
-static struct v4l2_file_operations aim_fops = {
+static const struct v4l2_file_operations aim_fops = {
        .owner      = THIS_MODULE,
        .open       = aim_vdev_open,
        .release    = aim_vdev_close,