• Bhumika Goyal's avatar
    [media] exynos4-is: constify v4l2_subdev_* structures · a2fafda6
    Bhumika Goyal authored
    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_ops i@p = {...};
    
    @ok1@
    identifier r1.i;
    position p;
    expression e1;
    @@
    v4l2_subdev_init(e1,&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_ops i;
    
    File size before:
       text	   data	    bss	    dec	    hex	filename
      16830	   1064	      0	  17894	   45e6 platform/exynos4-is/fimc-capture.o
       7787	    704	     20	   8511	   213f platform/exynos4-is/mipi-csis.o
    
    File size after:
       text	   data	    bss	    dec	    hex	filename
      17022	    880	      0	  17902	   45ee platform/exynos4-is/fimc-capture.o
       8299	    192	     20	   8511	   213f platform/exynos4-is/mipi-csis.o
    Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
    Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    a2fafda6
mipi-csis.c 27 KB