All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Tony Olech <tony.olech@elandigitalsystems.com>
Cc: bhumirks@gmail.com, kernel-janitors@vger.kernel.org,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 08/12] mmc: vub300: constify mmc_host_ops structures
Date: Sat, 29 Jul 2017 07:59:37 +0200	[thread overview]
Message-ID: <1501307981-29745-9-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1501307981-29745-1-git-send-email-Julia.Lawall@lip6.fr>

The mmc_host_ops structure is only stored in the ops field of an
mmc_host structure, which is declared as const.  Thus the mmc_host_ops
structure itself can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct mmc_host_ops i@p = { ... };

@ok1@
struct mmc_host *mmc;
identifier r.i;
position p;
@@
mmc->ops = &i@p

@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct mmc_host_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct mmc_host_ops i = { ... };
// </smpl>

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

---
 drivers/mmc/host/vub300.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index fbeea1a..6e08597 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -2079,7 +2079,7 @@ static void vub300_init_card(struct mmc_host *mmc, struct mmc_card *card)
 	dev_info(&vub300->udev->dev, "NO host QUIRKS for this card\n");
 }
 
-static struct mmc_host_ops vub300_mmc_ops = {
+static const struct mmc_host_ops vub300_mmc_ops = {
 	.request = vub300_mmc_request,
 	.set_ios = vub300_mmc_set_ios,
 	.get_ro = vub300_mmc_get_ro,

WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Tony Olech
	<tony.olech-ze5PQcJzaeOs0fm86SgGizGjJy/sRE9J@public.gmane.org>
Cc: bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 08/12] mmc: vub300: constify mmc_host_ops structures
Date: Sat, 29 Jul 2017 05:59:37 +0000	[thread overview]
Message-ID: <1501307981-29745-9-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1501307981-29745-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

The mmc_host_ops structure is only stored in the ops field of an
mmc_host structure, which is declared as const.  Thus the mmc_host_ops
structure itself can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct mmc_host_ops i@p = { ... };

@ok1@
struct mmc_host *mmc;
identifier r.i;
position p;
@@
mmc->ops = &i@p

@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct mmc_host_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct mmc_host_ops i = { ... };
// </smpl>

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

---
 drivers/mmc/host/vub300.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index fbeea1a..6e08597 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -2079,7 +2079,7 @@ static void vub300_init_card(struct mmc_host *mmc, struct mmc_card *card)
 	dev_info(&vub300->udev->dev, "NO host QUIRKS for this card\n");
 }
 
-static struct mmc_host_ops vub300_mmc_ops = {
+static const struct mmc_host_ops vub300_mmc_ops = {
 	.request = vub300_mmc_request,
 	.set_ios = vub300_mmc_set_ios,
 	.get_ro = vub300_mmc_get_ro,


WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
To: Tony Olech
	<tony.olech-ze5PQcJzaeOs0fm86SgGizGjJy/sRE9J@public.gmane.org>
Cc: bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 08/12] mmc: vub300: constify mmc_host_ops structures
Date: Sat, 29 Jul 2017 07:59:37 +0200	[thread overview]
Message-ID: <1501307981-29745-9-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1501307981-29745-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

The mmc_host_ops structure is only stored in the ops field of an
mmc_host structure, which is declared as const.  Thus the mmc_host_ops
structure itself can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct mmc_host_ops i@p = { ... };

@ok1@
struct mmc_host *mmc;
identifier r.i;
position p;
@@
mmc->ops = &i@p

@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct mmc_host_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct mmc_host_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

---
 drivers/mmc/host/vub300.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index fbeea1a..6e08597 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -2079,7 +2079,7 @@ static void vub300_init_card(struct mmc_host *mmc, struct mmc_card *card)
 	dev_info(&vub300->udev->dev, "NO host QUIRKS for this card\n");
 }
 
-static struct mmc_host_ops vub300_mmc_ops = {
+static const struct mmc_host_ops vub300_mmc_ops = {
 	.request = vub300_mmc_request,
 	.set_ios = vub300_mmc_set_ios,
 	.get_ro = vub300_mmc_get_ro,

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-07-29  6:25 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-29  5:59 [PATCH 00/12] constify mmc_host_ops structures Julia Lawall
2017-07-29  5:59 ` Julia Lawall
2017-07-29  5:59 ` Julia Lawall
2017-07-29  5:59 ` [PATCH 01/12] mmc: wmt-sdmmc: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 02/12] mmc: s3cmci: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 03/12] mmc: davinci: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 04/12] mmc: moxart: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 05/12] mmc: sh_mmcif: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 06/12] mmc: toshsd: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 07/12] mmc: usdhi6rol0: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` Julia Lawall [this message]
2017-07-29  5:59   ` [PATCH 08/12] mmc: vub300: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 09/12] mmc: sunxi: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 10/12] mmc: sdricoh_cs: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 11/12] mmc: mediatek: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59 ` [PATCH 12/12] mmc: bcm2835: " Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-29  5:59   ` Julia Lawall
2017-07-31  5:55   ` Stefan Wahren
2017-07-31  5:55     ` Stefan Wahren
2017-07-31  5:55     ` Stefan Wahren
2017-07-31  8:52 ` [PATCH 00/12] " Ulf Hansson
2017-07-31  8:52   ` Ulf Hansson
2017-07-31  8:52   ` Ulf Hansson
2017-07-31  8:52   ` Ulf Hansson

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=1501307981-29745-9-git-send-email-Julia.Lawall@lip6.fr \
    --to=julia.lawall@lip6.fr \
    --cc=bhumirks@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tony.olech@elandigitalsystems.com \
    --cc=ulf.hansson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.