diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2016-12-12 16:59:42 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-03-23 20:43:49 +0300 |
commit | 6713c88fd04733eb34438e78118c42bc5c7e0e05 (patch) | |
tree | 820595eca0a93f3cea0a7f5e81491ac023f43a56 /drivers/media/i2c/soc_camera/mt9m001.c | |
parent | 855749a75609122b57b2d4ebd872944836388a14 (diff) | |
download | linux-6713c88fd04733eb34438e78118c42bc5c7e0e05.tar.xz |
[media] media: i2c: soc_camera: constify v4l2_subdev_* structures
v4l2_subdev_{core/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 sizes before and after the changes:
text data bss dec hex filename
3459 696 0 4155 103b /media/i2c/soc_camera/imx074.o
3835 320 0 4155 103b /media/i2c/soc_camera/imx074.o
4749 1048 8 5805 16ad /media/i2c/soc_camera/mt9m001.o
5133 672 8 5813 16b5 /media/i2c/soc_camera/mt9m001.o
5658 1112 8 6778 1a7a /media/i2c/soc_camera/mt9t031.o
6042 728 8 6778 1a7a /media/i2c/soc_camera/mt9t031.o
6726 784 0 7510 1d56 /media/i2c/soc_camera/mt9t112.o
7110 408 0 7518 1d5e /media/i2c/soc_camera/mt9t112.o
6700 960 16 7676 1dfc /media/i2c/soc_camera/mt9v022.o
7084 584 16 7684 1e04 /media/i2c/soc_camera/mt9v022.o
5569 1576 8 7153 1bf1 /media/i2c/soc_camera/ov2640.o
5953 1200 8 7161 1bf9 /media/i2c/soc_camera/ov2640.o
3018 2736 0 5754 167a /media/i2c/soc_camera/ov5642.o
3394 2352 0 5746 1672 /media/i2c/soc_camera/ov5642.o
8348 2104 8 10460 28dc /media/i2c/soc_camera/ov6650.o
8716 1728 8 10452 28d4 /media/i2c/soc_camera/ov6650.o
4165 696 8 4869 1305 /media/i2c/soc_camera/ov772x.o
4549 320 8 4877 130d /media/i2c/soc_camera/ov772x.o
4033 608 8 4649 1229 /media/i2c/soc_camera/ov9640.o
4417 232 8 4657 1231 /media/i2c/soc_camera/ov9640.o
4983 784 8 5775 168f /media/i2c/soc_camera/ov9740.o
5367 408 8 5783 1697 /media/i2c/soc_camera/ov9740.o
8578 1312 8 9898 26aa i2c/soc_camera/rj54n1cb0c.o
8962 936 8 9906 26b2 i2c/soc_camera/rj54n1cb0c.o
3886 696 0 4582 11e6 /media/i2c/soc_camera/tw9910.o
4270 320 0 4590 11ee /media/i2c/soc_camera/tw9910.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c/soc_camera/mt9m001.c')
-rw-r--r-- | drivers/media/i2c/soc_camera/mt9m001.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9m001.c b/drivers/media/i2c/soc_camera/mt9m001.c index 3d6378d4491c..6d1782b26529 100644 --- a/drivers/media/i2c/soc_camera/mt9m001.c +++ b/drivers/media/i2c/soc_camera/mt9m001.c @@ -574,7 +574,7 @@ static const struct v4l2_ctrl_ops mt9m001_ctrl_ops = { .s_ctrl = mt9m001_s_ctrl, }; -static struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = { +static const struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = { #ifdef CONFIG_VIDEO_ADV_DEBUG .g_register = mt9m001_g_register, .s_register = mt9m001_s_register, @@ -630,7 +630,7 @@ static int mt9m001_s_mbus_config(struct v4l2_subdev *sd, return bps == 10 ? 0 : -EINVAL; } -static struct v4l2_subdev_video_ops mt9m001_subdev_video_ops = { +static const struct v4l2_subdev_video_ops mt9m001_subdev_video_ops = { .s_stream = mt9m001_s_stream, .g_mbus_config = mt9m001_g_mbus_config, .s_mbus_config = mt9m001_s_mbus_config, @@ -648,7 +648,7 @@ static const struct v4l2_subdev_pad_ops mt9m001_subdev_pad_ops = { .set_fmt = mt9m001_set_fmt, }; -static struct v4l2_subdev_ops mt9m001_subdev_ops = { +static const struct v4l2_subdev_ops mt9m001_subdev_ops = { .core = &mt9m001_subdev_core_ops, .video = &mt9m001_subdev_video_ops, .sensor = &mt9m001_subdev_sensor_ops, |