* [PATCH] iio: adc: constify iio_info structures
@ 2017-01-21 17:03 Bhumika Goyal
2017-01-22 13:19 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2017-01-21 17:03 UTC (permalink / raw)
To: julia.lawall, jic23, knaack.h, lars, pmeerw, linux-iio, linux-kernel
Cc: Bhumika Goyal
Declare iio_info structures as const as they are only stored in
the info field of a iio_dev structure. This field is of type const,
so iio_info structures having similar properties can be made const too.
File size before:
text data bss dec hex filename
6944 792 0 7736 1e38 drivers/iio/adc/ti-ads1015.o
File size after:
text data bss dec hex filename
7264 472 0 7736 1e38 drivers/iio/adc/ti-ads1015.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/iio/adc/ti-ads1015.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index cde6f13..422b314 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -472,14 +472,14 @@ static const struct attribute_group ads1115_attribute_group = {
.attrs = ads1115_attributes,
};
-static struct iio_info ads1015_info = {
+static const struct iio_info ads1015_info = {
.driver_module = THIS_MODULE,
.read_raw = ads1015_read_raw,
.write_raw = ads1015_write_raw,
.attrs = &ads1015_attribute_group,
};
-static struct iio_info ads1115_info = {
+static const struct iio_info ads1115_info = {
.driver_module = THIS_MODULE,
.read_raw = ads1015_read_raw,
.write_raw = ads1015_write_raw,
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: adc: constify iio_info structures
2017-01-21 17:03 [PATCH] iio: adc: constify iio_info structures Bhumika Goyal
@ 2017-01-22 13:19 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2017-01-22 13:19 UTC (permalink / raw)
To: Bhumika Goyal, julia.lawall, knaack.h, lars, pmeerw, linux-iio,
linux-kernel
On 21/01/17 17:03, Bhumika Goyal wrote:
> Declare iio_info structures as const as they are only stored in
> the info field of a iio_dev structure. This field is of type const,
> so iio_info structures having similar properties can be made const too.
>
> File size before:
> text data bss dec hex filename
> 6944 792 0 7736 1e38 drivers/iio/adc/ti-ads1015.o
>
> File size after:
> text data bss dec hex filename
> 7264 472 0 7736 1e38 drivers/iio/adc/ti-ads1015.o
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Good find.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/adc/ti-ads1015.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index cde6f13..422b314 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -472,14 +472,14 @@ static const struct attribute_group ads1115_attribute_group = {
> .attrs = ads1115_attributes,
> };
>
> -static struct iio_info ads1015_info = {
> +static const struct iio_info ads1015_info = {
> .driver_module = THIS_MODULE,
> .read_raw = ads1015_read_raw,
> .write_raw = ads1015_write_raw,
> .attrs = &ads1015_attribute_group,
> };
>
> -static struct iio_info ads1115_info = {
> +static const struct iio_info ads1115_info = {
> .driver_module = THIS_MODULE,
> .read_raw = ads1015_read_raw,
> .write_raw = ads1015_write_raw,
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-22 13:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-21 17:03 [PATCH] iio: adc: constify iio_info structures Bhumika Goyal
2017-01-22 13:19 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).