Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699233 > unrolled thread

[PATCH 00/12] constify mmc_host_ops structures

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2017-07-29 08:30 +0200
Last post2017-07-31 11:00 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/12] constify mmc_host_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-29 08:30 +0200
    [PATCH 11/12] mmc: mediatek: constify mmc_host_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-29 08:30 +0200
    [PATCH 04/12] mmc: moxart: constify mmc_host_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-29 08:30 +0200
    [PATCH 10/12] mmc: sdricoh_cs: constify mmc_host_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-29 08:30 +0200
    [PATCH 08/12] mmc: vub300: constify mmc_host_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-29 08:30 +0200
    Re: [PATCH 00/12] constify mmc_host_ops structures Ulf Hansson <ulf.hansson@linaro.org> - 2017-07-31 11:00 +0200

#1699233 — [PATCH 00/12] constify mmc_host_ops structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-07-29 08:30 +0200
Subject[PATCH 00/12] constify mmc_host_ops structures
Message-ID<u8tq9-6KR-3@gated-at.bofh.it>
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.

---

 drivers/mmc/host/bcm2835.c     |    2 +-
 drivers/mmc/host/davinci_mmc.c |    2 +-
 drivers/mmc/host/moxart-mmc.c  |    2 +-
 drivers/mmc/host/mtk-sd.c      |    2 +-
 drivers/mmc/host/s3cmci.c      |    2 +-
 drivers/mmc/host/sdricoh_cs.c  |    2 +-
 drivers/mmc/host/sh_mmcif.c    |    2 +-
 drivers/mmc/host/sunxi-mmc.c   |    2 +-
 drivers/mmc/host/toshsd.c      |    2 +-
 drivers/mmc/host/usdhi6rol0.c  |    2 +-
 drivers/mmc/host/vub300.c      |    2 +-
 drivers/mmc/host/wmt-sdmmc.c   |    2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

[toc] | [next] | [standalone]


#1699234 — [PATCH 11/12] mmc: mediatek: constify mmc_host_ops structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-07-29 08:30 +0200
Subject[PATCH 11/12] mmc: mediatek: constify mmc_host_ops structures
Message-ID<u8tqa-6KR-19@gated-at.bofh.it>
In reply to#1699233
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/mtk-sd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 68f4453..267f7ab 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -1579,7 +1579,7 @@ static void msdc_hw_reset(struct mmc_host *mmc)
 	sdr_clr_bits(host->base + EMMC_IOCON, 1);
 }
 
-static struct mmc_host_ops mt_msdc_ops = {
+static const struct mmc_host_ops mt_msdc_ops = {
 	.post_req = msdc_post_req,
 	.pre_req = msdc_pre_req,
 	.request = msdc_ops_request,

[toc] | [prev] | [next] | [standalone]


#1699235 — [PATCH 04/12] mmc: moxart: constify mmc_host_ops structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-07-29 08:30 +0200
Subject[PATCH 04/12] mmc: moxart: constify mmc_host_ops structures
Message-ID<u8tqa-6KR-21@gated-at.bofh.it>
In reply to#1699233
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/moxart-mmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index d4dc55a..a0670e9 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -546,7 +546,7 @@ static int moxart_get_ro(struct mmc_host *mmc)
 	return !!(readl(host->base + REG_STATUS) & WRITE_PROT);
 }
 
-static struct mmc_host_ops moxart_ops = {
+static const struct mmc_host_ops moxart_ops = {
 	.request = moxart_request,
 	.set_ios = moxart_set_ios,
 	.get_ro = moxart_get_ro,

[toc] | [prev] | [next] | [standalone]


#1699236 — [PATCH 10/12] mmc: sdricoh_cs: constify mmc_host_ops structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-07-29 08:30 +0200
Subject[PATCH 10/12] mmc: sdricoh_cs: constify mmc_host_ops structures
Message-ID<u8tqa-6KR-25@gated-at.bofh.it>
In reply to#1699233
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/sdricoh_cs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c
index 70cb00a..9e46039 100644
--- a/drivers/mmc/host/sdricoh_cs.c
+++ b/drivers/mmc/host/sdricoh_cs.c
@@ -385,7 +385,7 @@ static int sdricoh_get_ro(struct mmc_host *mmc)
 	return (status & STATUS_CARD_LOCKED);
 }
 
-static struct mmc_host_ops sdricoh_ops = {
+static const struct mmc_host_ops sdricoh_ops = {
 	.request = sdricoh_request,
 	.set_ios = sdricoh_set_ios,
 	.get_ro = sdricoh_get_ro,

[toc] | [prev] | [next] | [standalone]


#1699238 — [PATCH 08/12] mmc: vub300: constify mmc_host_ops structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-07-29 08:30 +0200
Subject[PATCH 08/12] mmc: vub300: constify mmc_host_ops structures
Message-ID<u8tqa-6KR-27@gated-at.bofh.it>
In reply to#1699233
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,

[toc] | [prev] | [next] | [standalone]


#1699829

FromUlf Hansson <ulf.hansson@linaro.org>
Date2017-07-31 11:00 +0200
Message-ID<u9eIp-44A-7@gated-at.bofh.it>
In reply to#1699233
On 29 July 2017 at 07:59, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>
> 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.
>
> ---
>
>  drivers/mmc/host/bcm2835.c     |    2 +-
>  drivers/mmc/host/davinci_mmc.c |    2 +-
>  drivers/mmc/host/moxart-mmc.c  |    2 +-
>  drivers/mmc/host/mtk-sd.c      |    2 +-
>  drivers/mmc/host/s3cmci.c      |    2 +-
>  drivers/mmc/host/sdricoh_cs.c  |    2 +-
>  drivers/mmc/host/sh_mmcif.c    |    2 +-
>  drivers/mmc/host/sunxi-mmc.c   |    2 +-
>  drivers/mmc/host/toshsd.c      |    2 +-
>  drivers/mmc/host/usdhi6rol0.c  |    2 +-
>  drivers/mmc/host/vub300.c      |    2 +-
>  drivers/mmc/host/wmt-sdmmc.c   |    2 +-
>  12 files changed, 12 insertions(+), 12 deletions(-)


Thanks, applied for next!

Kind regards
Uffe

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web