linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] constify v4l2_ctrl_ops structures
@ 2018-10-27 12:16 Julia Lawall
  2018-10-27 12:16 ` [PATCH 1/2] media: vicodec: constify v4l2_ctrl_ops structure Julia Lawall
  2018-10-27 12:16 ` [PATCH 2/2] media: ov5645: " Julia Lawall
  0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2018-10-27 12:16 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: kernel-janitors, linux-media, linux-kernel

Make const v4l2_ctrl_ops structures that are only stored in a
const field or passed to a function having a const parameter.

Done with the help of Coccinelle.

---

 drivers/media/i2c/ov5645.c                    |    2 +-
 drivers/media/platform/vicodec/vicodec-core.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] media: vicodec: constify v4l2_ctrl_ops structure
  2018-10-27 12:16 [PATCH 0/2] constify v4l2_ctrl_ops structures Julia Lawall
@ 2018-10-27 12:16 ` Julia Lawall
  2018-10-27 12:16 ` [PATCH 2/2] media: ov5645: " Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2018-10-27 12:16 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: kernel-janitors, Mauro Carvalho Chehab, linux-media, linux-kernel

The v4l2_ctrl_ops structure is only stored in the ops field of a
v4l2_ctrl_config structure, and this field is const, or passed as the
second argument of v4l2_ctrl_new_std, and the corresponding parameter
is declared as const.  Accordingly, the structure can also be const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/media/platform/vicodec/vicodec-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
--- a/drivers/media/platform/vicodec/vicodec-core.c
+++ b/drivers/media/platform/vicodec/vicodec-core.c
@@ -1108,7 +1108,7 @@ static int vicodec_s_ctrl(struct v4l2_ct
 	return -EINVAL;
 }
 
-static struct v4l2_ctrl_ops vicodec_ctrl_ops = {
+static const struct v4l2_ctrl_ops vicodec_ctrl_ops = {
 	.s_ctrl = vicodec_s_ctrl,
 };
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] media: ov5645: constify v4l2_ctrl_ops structure
  2018-10-27 12:16 [PATCH 0/2] constify v4l2_ctrl_ops structures Julia Lawall
  2018-10-27 12:16 ` [PATCH 1/2] media: vicodec: constify v4l2_ctrl_ops structure Julia Lawall
@ 2018-10-27 12:16 ` Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2018-10-27 12:16 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: kernel-janitors, linux-media, linux-kernel

The v4l2_ctrl_ops structure is only passed as the second argument to
functions such as v4l2_ctrl_new_std for which the corresponding
parameter is const, so make the v4l2_ctrl_ops structure const as well.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/media/i2c/ov5645.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -886,7 +886,7 @@ static int ov5645_s_ctrl(struct v4l2_ctr
 	return ret;
 }
 
-static struct v4l2_ctrl_ops ov5645_ctrl_ops = {
+static const struct v4l2_ctrl_ops ov5645_ctrl_ops = {
 	.s_ctrl = ov5645_s_ctrl,
 };
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-27 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-27 12:16 [PATCH 0/2] constify v4l2_ctrl_ops structures Julia Lawall
2018-10-27 12:16 ` [PATCH 1/2] media: vicodec: constify v4l2_ctrl_ops structure Julia Lawall
2018-10-27 12:16 ` [PATCH 2/2] media: ov5645: " Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).