• Bhumika Goyal's avatar
    [media] media: platform: s3c-camif: constify v4l2_subdev_ops structures · 10106c13
    Bhumika Goyal authored
    Check for v4l2_subdev_ops structures that are only passed as an
    argument to the function v4l2_subdev_init. This argument is of type
    const, so v4l2_subdev_ops structures having this property can also  be
    declared const.
    Done using Coccinelle:
    
    @r1 disable optional_qualifier @
    identifier i;
    position p;
    @@
    static struct v4l2_subdev_ops i@p = {...};
    
    @ok1@
    identifier r1.i;
    position p;
    @@
    v4l2_subdev_init(...,&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
      17171	   1912	     20	  19103	   4a9f
    platform/s3c-camif/camif-capture.o
    
    File size after:
       text	   data	    bss	    dec	    hex	filename
      17235	   1848	     20	  19103	   4a9f
    platform/s3c-camif/camif-capture.o
    Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
    Acked-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
    10106c13
camif-capture.c 42.1 KB