diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-09-16 12:55:25 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-09-18 11:58:31 +0100 |
commit | 52ceb7731e7c23101a26e91aad81ae30de87b10d (patch) | |
tree | 3be3940051cfeb056163e1e2581c17c877f35b73 /drivers/iio | |
parent | 7504dfc9e935e3422d5187f8e813da5758976e6d (diff) | |
download | linux-stable-52ceb7731e7c23101a26e91aad81ae30de87b10d.tar.gz linux-stable-52ceb7731e7c23101a26e91aad81ae30de87b10d.tar.bz2 linux-stable-52ceb7731e7c23101a26e91aad81ae30de87b10d.zip |
iio: adc: men_z188_adc: 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
1529 312 0 1841 731
drivers/iio/adc/men_z188_adc.o
and after the change it is:
text data bss dec hex filename
1689 168 0 1857 741
drivers/iio/adc/men_z188_adc.o
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/adc/men_z188_adc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index d095efe1ba14..8f3606de4eaf 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c @@ -78,7 +78,7 @@ static int z188_iio_read_raw(struct iio_dev *iio_dev, return ret; } -static struct iio_info z188_adc_info = { +static const struct iio_info z188_adc_info = { .read_raw = &z188_iio_read_raw, .driver_module = THIS_MODULE, }; |