]> git.baikalelectronics.ru Git - kernel.git/commit
[media] media: platform: xilinx: xilinx-tpg: constify v4l2_subdev_* structures
authorBhumika Goyal <bhumirks@gmail.com>
Sun, 11 Dec 2016 09:52:32 +0000 (07:52 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 3 Feb 2017 11:21:50 +0000 (09:21 -0200)
commit8774d962a9964de0f9b43f5cc3df717043c1c77c
treef40b4ecb9e73d9869944ea45533846921dffb3d8
parentf6cd9defa969e57a0fb333dd8625aea97fa1e9b3
[media] media: platform: xilinx: xilinx-tpg: constify v4l2_subdev_* structures

v4l2_subdev_{core/pad/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle: (One of the scripts used)

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

@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&i@p;

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

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

File size before:
   text    data     bss     dec     hex filename
   6170    2752     144    9066    236a media/platform/xilinx/xilinx-tpg.o

File size after:
   text    data     bss     dec     hex filename
   6666    2384       8    9058    2362 media/platform/xilinx/xilinx-tpg.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/xilinx/xilinx-tpg.c