From: Bhumika Goyal Date: Wed, 14 Dec 2016 11:11:10 +0000 (-0200) Subject: [media] media: platform: s3c-camif: constify v4l2_subdev_ops structures X-Git-Tag: v4.11-rc1~132^2~58 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=10106c13f444e3b5adf435d8c12e207f109f469c;p=linux-2.6-block.git [media] media: platform: s3c-camif: constify v4l2_subdev_ops structures 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: Bhumika Goyal Acked-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c index e01ecca46866..1b30be72f4f9 100644 --- a/drivers/media/platform/s3c-camif/camif-capture.c +++ b/drivers/media/platform/s3c-camif/camif-capture.c @@ -1488,7 +1488,7 @@ static const struct v4l2_subdev_pad_ops s3c_camif_subdev_pad_ops = { .set_fmt = s3c_camif_subdev_set_fmt, }; -static struct v4l2_subdev_ops s3c_camif_subdev_ops = { +static const struct v4l2_subdev_ops s3c_camif_subdev_ops = { .pad = &s3c_camif_subdev_pad_ops, };