From: Jonathan Cameron <jic23@kernel.org>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] iio: common: ssp_sensors: gyro: constify iio_info structures
Date: Sun, 18 Sep 2016 12:00:20 +0100 [thread overview]
Message-ID: <aedf0bb0-e9f0-52e3-9068-d9fbc4181cbe@kernel.org> (raw)
In-Reply-To: <1474023326-24645-4-git-send-email-Julia.Lawall@lip6.fr>
On 16/09/16 11:55, Julia Lawall wrote:
> Check for iio_info structures that are only stored in the info field of a
> iio_dev structure. This field is declared const, so iio_info structures
> that have this property can be declared as const also.
>
> 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 iio_info i@p = { ... };
>
> @ok@
> identifier r.i;
> struct iio_dev e;
> position p;
> @@
> e.info = &i@p;
>
> @bad@
> position p != {r.p,ok.p};
> identifier r.i;
> struct iio_info e;
> @@
> e@i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
> struct iio_info i = { ... };
> // </smpl>
>
> The result of size on this file before the change is:
> text data bss dec hex filename
> 1245 344 0 1589 635
> drivers/iio/gyro/ssp_gyro_sensor.o
>
> and after the change it is:
> text data bss dec hex filename
> 1397 192 0 1589 635
> drivers/iio/gyro/ssp_gyro_sensor.o
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied to the togreg branch of iio.git. Initially pushed out
as testing for the autobuilders to play with them.
Thanks,
Jonathan
>
> ---
> drivers/iio/gyro/ssp_gyro_sensor.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/gyro/ssp_gyro_sensor.c b/drivers/iio/gyro/ssp_gyro_sensor.c
> index 0a8afdd..1f25f40 100644
> --- a/drivers/iio/gyro/ssp_gyro_sensor.c
> +++ b/drivers/iio/gyro/ssp_gyro_sensor.c
> @@ -74,7 +74,7 @@ static int ssp_gyro_write_raw(struct iio_dev *indio_dev,
> return -EINVAL;
> }
>
> -static struct iio_info ssp_gyro_iio_info = {
> +static const struct iio_info ssp_gyro_iio_info = {
> .read_raw = &ssp_gyro_read_raw,
> .write_raw = &ssp_gyro_write_raw,
> };
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2016-09-18 11:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 10:55 [PATCH 0/3] constify iio_info structures Julia Lawall
2016-09-16 10:55 ` [PATCH 1/3] iio: common: ssp_sensors: accel: " Julia Lawall
2016-09-18 10:56 ` Jonathan Cameron
2016-09-16 10:55 ` [PATCH 2/3] iio: adc: men_z188_adc: " Julia Lawall
2016-09-18 10:58 ` Jonathan Cameron
2016-09-16 10:55 ` [PATCH 3/3] iio: common: ssp_sensors: gyro: " Julia Lawall
2016-09-18 11:00 ` Jonathan Cameron [this message]
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=aedf0bb0-e9f0-52e3-9068-d9fbc4181cbe@kernel.org \
--to=jic23@kernel.org \
--cc=Julia.Lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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