From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Steve Longerbeam <slongerbeam@gmail.com>
Cc: bhumirks@gmail.com, kernel-janitors@vger.kernel.org,
Philipp Zabel <p.zabel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] [media] media: imx: capture: constify vb2_ops structures
Date: Sat, 5 Aug 2017 12:47:13 +0200 [thread overview]
Message-ID: <1501930033-18249-7-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1501930033-18249-1-git-send-email-Julia.Lawall@lip6.fr>
These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const. Thus the vb2_ops
structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };
@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;
@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/staging/media/imx/imx-media-capture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
index ddab4c2..ea145ba 100644
--- a/drivers/staging/media/imx/imx-media-capture.c
+++ b/drivers/staging/media/imx/imx-media-capture.c
@@ -62,7 +62,7 @@ struct capture_priv {
/* In bytes, per queue */
#define VID_MEM_LIMIT SZ_64M
-static struct vb2_ops capture_qops;
+static const struct vb2_ops capture_qops;
/*
* Video ioctls follow
@@ -503,7 +503,7 @@ static void capture_stop_streaming(struct vb2_queue *vq)
spin_unlock_irqrestore(&priv->q_lock, flags);
}
-static struct vb2_ops capture_qops = {
+static const struct vb2_ops capture_qops = {
.queue_setup = capture_queue_setup,
.buf_init = capture_buf_init,
.buf_prepare = capture_buf_prepare,
next prev parent reply other threads:[~2017-08-05 11:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-05 10:47 [PATCH 0/6] " Julia Lawall
2017-08-05 10:47 ` [PATCH 1/6] [media] v4l2-pci-skeleton: " Julia Lawall
2017-08-05 10:47 ` [PATCH 2/6] [media] media: davinci: vpbe: " Julia Lawall
2017-08-05 10:47 ` [PATCH 3/6] [media] staging: media: davinci_vpfe: " Julia Lawall
2017-08-05 10:47 ` [PATCH 4/6] [media] media: blackfin: bfin_capture: " Julia Lawall
2017-08-05 10:47 ` [PATCH 5/6] staging: bcm2835-camera: " Julia Lawall
2017-08-05 10:47 ` Julia Lawall [this message]
2017-08-14 23:14 ` [PATCH 6/6] [media] media: imx: capture: " Steve Longerbeam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1501930033-18249-7-git-send-email-Julia.Lawall@lip6.fr \
--to=julia.lawall@lip6.fr \
--cc=bhumirks@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=slongerbeam@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®