diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-09-16 12:55:26 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-09-18 11:59:51 +0100 |
commit | becf05e748b3842b792373d812e41c5a407aef5f (patch) | |
tree | 8a7365e269475be3fe963caf1075c22e69da4920 /drivers/iio/gyro | |
parent | 52ceb7731e7c23101a26e91aad81ae30de87b10d (diff) | |
download | lwn-becf05e748b3842b792373d812e41c5a407aef5f.tar.gz lwn-becf05e748b3842b792373d812e41c5a407aef5f.zip |
iio: common: ssp_sensors: gyro: constify iio_info structures
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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r-- | drivers/iio/gyro/ssp_gyro_sensor.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/gyro/ssp_gyro_sensor.c b/drivers/iio/gyro/ssp_gyro_sensor.c index 0a8afdd21728..1f25f406c545 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, }; |