iio: adc: constify iio_info structures
PATCH 1/1 iio: adc: constify iio_info structures
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
--- drivers/iio/adc/ti-ads1015.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-ads1015.c +2 -2
@@ -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,
Signature · 1 line
2.7.4
Jonathan Cameron
maintainerQuoted 8 lines · Bhumika Goyal
Declare
iio_infostructures as const as they are only stored in the info field of aiio_devstructure. This field is of type const, soiio_infostructures having similar properties can be made const too.File size before:
text data bss dec hex filename
6944 792 0 7736 1e38drivers/iio/adc/ti-ads1015.o
Quoted 5 lines
File size after:
text data bss dec hex filename 7264 472 0 7736 1e38 drivers/iio/adc/ti-ads1015.oSigned-off-by Bhumika Goyal <[email protected]>
Good find.
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 26 lines
--- drivers/iio/adc/ti-ads1015.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/adc/ti-ads1015.c +2
-2@@ -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,