media: staging: max96712: Constify static v4l2_subdev_ops
Subsystems (3)
PATCH 1/1 media: staging: max96712: Constify static v4l2_subdev_ops
The only usage of max96712_subdev_ops is to pass its address to v4l2_i2c_subdev_init() which takes a pointer to const struct v4l2_subdev_ops as argument. Make it const to allow the compiler to put it in read-only memory.
--- drivers/staging/media/max96712/max96712.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/max96712/max96712.c +1 -1
@@ -250,7 +250,7 @@ static const struct v4l2_subdev_pad_ops max96712_pad_ops = { .set_fmt = max96712_get_pad_format, }; -static struct v4l2_subdev_ops max96712_subdev_ops = { +static const struct v4l2_subdev_ops max96712_subdev_ops = { .video = &max96712_video_ops, .pad = &max96712_pad_ops, };
Signature · 1 line
2.34.1
Hej Rikard,
Tack för din patch, ser bra ut.
Quoted 6 lines · Rikard Falkeborn
The only usage of
max96712_subdev_opsis to pass its address tov4l2_i2c_subdev_init()which takes a pointer to const structv4l2_subdev_opsas argument. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Quoted 20 lines
--- drivers/staging/media/max96712/max96712.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/media/max96712/max96712.c +1
-1@@ -250,7 +250,7 @@ static const struct v4l2_subdev_pad_ops max96712_pad_ops = { .set_fmt = max96712_get_pad_format, }; -static struct v4l2_subdev_ops max96712_subdev_ops = { +static const struct v4l2_subdev_ops max96712_subdev_ops = { .video = &max96712_video_ops, .pad = &max96712_pad_ops, };Signature · 1 line
2.34.1
Signature · 2 lines
Kind Regards, Niklas Söderlund
Hi Richard,
Quoting Rikard Falkeborn (2021-11-27 09:49:44)
Quoted 6 lines
The only usage of
max96712_subdev_opsis to pass its address tov4l2_i2c_subdev_init()which takes a pointer to const structv4l2_subdev_opsas argument. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Yes, Good spot.
Quoted 20 lines
--- drivers/staging/media/max96712/max96712.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/media/max96712/max96712.c +1
-1@@ -250,7 +250,7 @@ static const struct v4l2_subdev_pad_ops max96712_pad_ops = { .set_fmt = max96712_get_pad_format, }; -static struct v4l2_subdev_ops max96712_subdev_ops = { +static const struct v4l2_subdev_ops max96712_subdev_ops = { .video = &max96712_video_ops, .pad = &max96712_pad_ops, };Signature · 1 line
2.34.1