Staging: media: radio-bcm2048: constify v4l2_ioctl_ops structure
authorBhumika Goyal <bhumirks@gmail.com>
Sun, 9 Oct 2016 10:35:23 +0000 (16:05 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Oct 2016 08:25:01 +0000 (10:25 +0200)
commit7f140181b47e6cbac398a4aac908a7e29b3af4ee
tree9a371c5a2b691b6c46db39c7e0a78a7d79266da4
parent5c065b53ec47eb6ee6551728070c12bd4bdb6b54
Staging: media: radio-bcm2048: constify v4l2_ioctl_ops structure

Declare the structure v4l2_ioctl_ops as const as it is only stored in
the ioctl_ops field of video_device structure. As this field is of type
const struct v4l2_ioctl_ops *, so v4l2_ioctl_ops structures having this
property can also be made const.
Done using coccinelle:

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

@ok1@
identifier r1.i;
position p;
struct video_device s;
@@
s.ioctl_ops=&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_ioctl_ops i={...};

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

File size before:
   text    data     bss     dec     hex filename
  20465    3220      32   23717    5ca5
drivers/staging/media/bcm2048/radio-bcm2048.o

File size after:
   text    data     bss     dec     hex filename
  21425    2260      32   23717    5ca5
drivers/staging/media/bcm2048/radio-bcm2048.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>
drivers/staging/media/bcm2048/radio-bcm2048.c