public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] mfd: sm501: constify gpio_chip structures
Date: Mon, 12 Sep 2016 11:00:37 +0100	[thread overview]
Message-ID: <20160912100037.GE1873@dell> (raw)
In-Reply-To: <1473596082-32690-3-git-send-email-Julia.Lawall@lip6.fr>

On Sun, 11 Sep 2016, Julia Lawall wrote:

> 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 gpio_chip i@p = { ... };
> 
> @ok@
> identifier r.i;
> expression e;
> position p;
> @@
> e = i@p;
> 
> @bad@
> position p != {r.p,ok.p};
> identifier r.i;
> struct gpio_chip e;
> @@
> e@i@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
>  struct gpio_chip i = { ... };
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/mfd/sm501.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
> index 65cd0d2..4053435 100644
> --- a/drivers/mfd/sm501.c
> +++ b/drivers/mfd/sm501.c
> @@ -1001,7 +1001,7 @@ static int sm501_gpio_output(struct gpio_chip *chip,
>  	return 0;
>  }
>  
> -static struct gpio_chip gpio_chip_template = {
> +static const struct gpio_chip gpio_chip_template = {
>  	.ngpio			= 32,
>  	.direction_input	= sm501_gpio_input,
>  	.direction_output	= sm501_gpio_output,
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2016-09-12  9:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-11 12:14 [PATCH 0/6] constify gpio_chip structures Julia Lawall
2016-09-11 12:14 ` [PATCH 1/6] gpio: " Julia Lawall
2016-09-11 13:13   ` Joachim Eastwood
2016-09-13  8:35   ` Linus Walleij
2016-09-11 12:14 ` [PATCH 2/6] mfd: sm501: " Julia Lawall
2016-09-12 10:00   ` Lee Jones [this message]
2016-09-11 12:14 ` [PATCH 3/6] pinctrl: mediatek: " Julia Lawall
2016-09-13  8:40   ` Linus Walleij
2016-09-11 12:14 ` [PATCH 4/6] pinctrl: stm32: " Julia Lawall
2016-09-13  8:38   ` Linus Walleij
2016-09-11 12:14 ` [PATCH 5/6] ASoC: ac97: " Julia Lawall
2016-09-12 19:05   ` Applied "ASoC: ac97: constify gpio_chip structures" to the asoc tree Mark Brown
2016-09-11 12:14 ` [PATCH 6/6] ASoC: constify gpio_chip structures Julia Lawall

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=20160912100037.GE1873@dell \
    --to=lee.jones@linaro.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox