Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1480827
| Path | csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news.unit0.net!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/3] [media] mxl111sf-tuner: constify dvb_tuner_ops structures |
| Date | Sun, 11 Sep 2016 17:10:02 +0200 |
| Message-ID | <sgeym-7M2-19@gated-at.bofh.it> (permalink) |
| References | <sgeym-7M2-5@gated-at.bofh.it> |
| X-Original-To | Mauro Carvalho Chehab <mchehab@kernel.org> |
| X-Ironport-Av | E=Sophos;i="5.30,317,1470693600"; d="scan'208";a="236016125" |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 61 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | kernel-janitors@vger.kernel.org, Michael Krufky <mkrufky@linuxtv.org>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Sun, 11 Sep 2016 16:44:14 +0200 |
| X-Original-Message-ID | <1473605054-9002-4-git-send-email-Julia.Lawall@lip6.fr> |
| X-Original-References | <1473605054-9002-1-git-send-email-Julia.Lawall@lip6.fr> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1480827 |
Show key headers only | View raw
These structures are only used to copy into other structures, so declare
them as const.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct dvb_tuner_ops i@p = { ... };
@ok1@
identifier r.i;
expression e;
position p;
@@
e = i@p
@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
memcpy(e1, &i@p, e2)
@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct dvb_tuner_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct dvb_tuner_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c
index 7d16252..f141dcc 100644
--- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c
+++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c
@@ -466,7 +466,7 @@ static int mxl111sf_tuner_release(struct dvb_frontend *fe)
/* ------------------------------------------------------------------------- */
-static struct dvb_tuner_ops mxl111sf_tuner_tuner_ops = {
+static const struct dvb_tuner_ops mxl111sf_tuner_tuner_ops = {
.info = {
.name = "MaxLinear MxL111SF",
#if 0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 3/3] [media] mxl111sf-tuner: constify dvb_tuner_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2016-09-11 17:10 +0200
csiph-web