drivers/iio: Constify structs
Subsystems (2)
cover drivers/iio: Constify structs
Constify a number of static structs to allow the compiler to put them in read-only memory. The patches are independent.
Rikard Falkeborn (6):
iio: adc: max11100: Constify struct iio_chan_spec
iio: dac: ad5380: Constify struct iio_chan_spec_ext_info
iio: dac: ad5592r-base: Constify struct iio_chan_spec_ext_info
iio: dac: ad5686: Constify static struct iio_chan_spec
iio: light: stk3310: Constify regmap_config
iio: magnetometer: mmc35240: Constify struct reg_default
drivers/iio/adc/max11100.c | 2 +- drivers/iio/dac/ad5380.c | 2 +- drivers/iio/dac/ad5592r-base.c | 2 +- drivers/iio/dac/ad5686.c | 8 ++++---- drivers/iio/dac/ad5686.h | 2 +- drivers/iio/light/stk3310.c | 2 +- drivers/iio/magnetometer/mmc35240.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/6 iio: adc: max11100: Constify struct iio_chan_spec
max11100_channels is not modified and can therefore be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
3776 1168 0 4944 1350 drivers/iio/adc/max11100.o
After:
text data bss dec hex filename
3968 976 0 4944 1350 drivers/iio/adc/max11100.o
--- drivers/iio/adc/max11100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/max11100.c +1 -1
@@ -37,7 +37,7 @@ struct max11100_state {u8 buffer[3 ]____cacheline_aligned ; }; -static struct iio_chan_spec max11100_channels[] = { +static const struct iio_chan_spec max11100_channels[] = { {/* [0] */ .type =IIO_VOLTAGE , .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
Signature · 1 line
2.26.2
Jonathan Cameron
maintainerRe: [PATCH 1/6] iio: adc: max11100: Constify struct iio_chan_spec
Quoted 7 lines · On Tue, 26 May 2020 23:02:18 +0200 Rikard Falkeborn…
max11100_channelsis not modified and can therefore be made const to allow the compiler to put it in read-only memory.Before:
text data bss dec hex filename
3776 1168 0 4944 1350drivers/iio/adc/max11100.o
Quoted 5 lines
After:
text data bss dec hex filename
3968 976 0 4944 1350drivers/iio/adc/max11100.oSigned-off-by Rikard Falkeborn <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 17 lines
--- drivers/iio/adc/max11100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/adc/max11100.c +1
-1@@ -37,7 +37,7 @@ struct max11100_state {u8 buffer[3 ]____cacheline_aligned ; }; -static struct iio_chan_spec max11100_channels[] = { +static const struct iio_chan_spec max11100_channels[] = { {/* [0] */ .type =IIO_VOLTAGE , .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
PATCH 2/6 iio: dac: ad5380: Constify struct iio_chan_spec_ext_info
In reply to Rikard Falkebornad5380_ext_info is not modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename 12060 3280 192 15532 3cac drivers/iio/dac/ad5380.o
After:
text data bss dec hex filename 12252 3088 192 15532 3cac drivers/iio/dac/ad5380.o
--- drivers/iio/dac/ad5380.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5380.c +1 -1
@@ -240,7 +240,7 @@ static const struct iio_info ad5380_info = { .write_raw = ad5380_write_raw, }; -static struct iio_chan_spec_ext_info ad5380_ext_info[] = { +static const struct iio_chan_spec_ext_info ad5380_ext_info[] = { { .name ="powerdown" , .read = ad5380_read_dac_powerdown,
Signature · 1 line
2.26.2
Re: [PATCH 2/6] iio: dac: ad5380: Constify struct iio_chan_spec_ext_info
Quoted 5 lines · Rikard Falkeborn
[External]
ad5380_ext_infois not modified and can be made const to allow the compiler to put it in read-only memory.
Quoted 8 lines
Before:
text data bss dec hex filename 12060 3280 192 15532 3cac drivers/iio/dac/ad5380.oAfter:
text data bss dec hex filename 12252 3088 192 15532 3cac drivers/iio/dac/ad5380.o
Quoted 18 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5380.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/dac/ad5380.c +1
-1@@ -240,7 +240,7 @@ static const struct iio_info ad5380_info = { .write_raw = ad5380_write_raw, }; -static struct iio_chan_spec_ext_info ad5380_ext_info[] = { +static const struct iio_chan_spec_ext_info ad5380_ext_info[] = { { .name ="powerdown" , .read = ad5380_read_dac_powerdown,
Re: [PATCH 2/6] iio: dac: ad5380: Constify struct iio_chan_spec_ext_info
Quoted 10 lines · Alexandru
Quoted 9 lines · Rikard Falkeborn
[External]
ad5380_ext_infois not modified and can be made const to allow the compiler to put it in read-only memory.Before:
text data bss dec hex filename 12060 3280 192 15532 3cac drivers/iio/dac/ad5380.o
Quoted 7 lines
Quoted 4 lines
After:
text data bss dec hex filename 12252 3088 192 15532 3cac drivers/iio/dac/ad5380.o
Applied.
Quoted 18 lines
Quoted 18 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5380.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/dac/ad5380.c +1
-1@@ -240,7 +240,7 @@ static const struct iio_info ad5380_info = { .write_raw = ad5380_write_raw, }; -static struct iio_chan_spec_ext_info ad5380_ext_info[] = { +static const struct iio_chan_spec_ext_info ad5380_ext_info[] = { { .name ="powerdown" , .read = ad5380_read_dac_powerdown,
PATCH 3/6 iio: dac: ad5592r-base: Constify struct iio_chan_spec_ext_info
In reply to Rikard Falkebornad5592r_ext_info is not modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename 13293 2088 256 15637 3d15 drivers/iio/dac/ad5592r-base.o
After:
text data bss dec hex filename 13421 1960 256 15637 3d15 drivers/iio/dac/ad5592r-base.o
--- drivers/iio/dac/ad5592r-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5592r-base.c +1 -1
@@ -484,7 +484,7 @@ static ssize_t ad5592r_show_scale_available(struct iio_dev *iio_dev, st->scale_avail[1][0], st->scale_avail[1][1]); } -static struct iio_chan_spec_ext_info ad5592r_ext_info[] = { +static const struct iio_chan_spec_ext_info ad5592r_ext_info[] = { { .name ="scale_available" , .read = ad5592r_show_scale_available,
Signature · 1 line
2.26.2
Re: [PATCH 3/6] iio: dac: ad5592r-base: Constify struct iio_chan_spec_ext_info
Quoted 5 lines · Rikard Falkeborn
[External]
ad5592r_ext_infois not modified and can be made const to allow the compiler to put it in read-only memory.
Quoted 8 lines
Before:
text data bss dec hex filename 13293 2088 256 15637 3d15 drivers/iio/dac/ad5592r-base.oAfter:
text data bss dec hex filename 13421 1960 256 15637 3d15 drivers/iio/dac/ad5592r-base.o
Quoted 20 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5592r-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/dac/ad5592r- renamed from drivers/iio/dac/ad5592r-base.c +0
-0
base.c
index410e90e5f75f..7402f67a551d100644drivers/iio/dac/ad5592r-base.c +1
-1@@ -484,7 +484,7 @@ static ssize_t ad5592r_show_scale_available(struct iio_dev *iio_dev, st->scale_avail[1][0], st->scale_avail[1][1]); } -static struct iio_chan_spec_ext_info ad5592r_ext_info[] = { +static const struct iio_chan_spec_ext_info ad5592r_ext_info[] = { { .name ="scale_available" ,.read =
ad5592r_show_scale_available,
Re: [PATCH 3/6] iio: dac: ad5592r-base: Constify struct iio_chan_spec_ext_info
Quoted 10 lines · Alexandru
Quoted 9 lines · Rikard Falkeborn
[External]
ad5592r_ext_infois not modified and can be made const to allow the compiler to put it in read-only memory.Before:
text data bss dec hex filename 13293 2088 256 15637 3d15 drivers/iio/dac/ad5592r-base.o
Quoted 6 lines
Quoted 4 lines
After:
text data bss dec hex filename 13421 1960 256 15637 3d15 drivers/iio/dac/ad5592r-base.o
Applied.
Thanks
Quoted 20 lines
Quoted 20 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5592r-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/dac/ad5592r- renamed from drivers/iio/dac/ad5592r-base.c +0
-0
base.c
index410e90e5f75f..7402f67a551d100644drivers/iio/dac/ad5592r-base.c +1
-1@@ -484,7 +484,7 @@ static ssize_t ad5592r_show_scale_available(struct iio_dev *iio_dev, st->scale_avail[1][0], st->scale_avail[1][1]); } -static struct iio_chan_spec_ext_info ad5592r_ext_info[] = { +static const struct iio_chan_spec_ext_info ad5592r_ext_info[] = { { .name ="scale_available" ,.read =
ad5592r_show_scale_available,
PATCH 4/6 iio: dac: ad5686: Constify static struct iio_chan_spec
In reply to Rikard FalkebornThese are never modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
6642 12608 64 19314 4b72 drivers/iio/dac/ad5686.o
After:
text data bss dec hex filename
16946 2304 64 19314 4b72 drivers/iio/dac/ad5686.o
--- drivers/iio/dac/ad5686.c | 8 ++++---- drivers/iio/dac/ad5686.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/iio/dac/ad5686.c +4 -4
@@ -206,12 +206,12 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { }#define DECLARE_AD5693_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ }#define DECLARE_AD5686_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 1, bits, _shift), \ AD5868_CHANNEL(1, 2, bits, _shift), \ AD5868_CHANNEL(2, 4, bits, _shift), \
@@ -219,7 +219,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5676_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \ AD5868_CHANNEL(2, 2, bits, _shift), \
@@ -231,7 +231,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5679_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \ AD5868_CHANNEL(2, 2, bits, _shift), \
drivers/iio/dac/ad5686.h +1 -1
@@ -104,7 +104,7 @@ typedef int (*ad5686_read_func)(struct ad5686_state *st, u8 addr);struct ad5686_chip_info {u16 int_vref_mv;unsigned int num_channels; -struct iio_chan_spec *channels; +const struct iio_chan_spec *channels;enum ad5686_regmap_type regmap_type; };
Signature · 1 line
2.26.2
Re: [PATCH 4/6] iio: dac: ad5686: Constify static struct iio_chan_spec
Quoted 5 lines · Rikard Falkeborn
[External]
These are never modified and can be made const to allow the compiler to put it in read-only memory.
Quoted 8 lines
Before:
text data bss dec hex filename
6642 12608 64 19314 4b72drivers/iio/dac/ad5686.oAfter:
text data bss dec hex filename
16946 2304 64 19314 4b72drivers/iio/dac/ad5686.o
Quoted 60 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5686.c | 8 ++++---- drivers/iio/dac/ad5686.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/iio/dac/ad5686.c +2
-2@@ -206,12 +206,12 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { }#define DECLARE_AD5693_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ }#define DECLARE_AD5686_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 1, bits, _shift), \ AD5868_CHANNEL(1, 2, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 4, bits, _shift), \@@ -219,7 +219,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5676_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 2, bits, _shift), \@@ -231,7 +231,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5679_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +0
-0AD5868_CHANNEL(2, 2, bits, _shift), \drivers/iio/dac/ad5686.h +1
-1@@ -104,7 +104,7 @@ typedef int (*ad5686_read_func)(struct ad5686_state *st, u8 addr);struct ad5686_chip_info {u16 int_vref_mv;unsigned int num_channels; -struct iio_chan_spec *channels; +const struct iio_chan_spec *channels;enum ad5686_regmap_type regmap_type; };
Re: [PATCH 4/6] iio: dac: ad5686: Constify static struct iio_chan_spec
Quoted 10 lines · Alexandru
Quoted 9 lines · Rikard Falkeborn
[External]
These are never modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
6642 12608 64 19314 4b72drivers/iio/dac/ad5686.o
Quoted 7 lines
Quoted 4 lines
After:
text data bss dec hex filename
16946 2304 64 19314 4b72drivers/iio/dac/ad5686.o
Applied.
thanks,
Quoted 60 lines
Quoted 60 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5686.c | 8 ++++---- drivers/iio/dac/ad5686.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/iio/dac/ad5686.c +2
-2@@ -206,12 +206,12 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { }#define DECLARE_AD5693_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ }#define DECLARE_AD5686_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 1, bits, _shift), \ AD5868_CHANNEL(1, 2, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 4, bits, _shift), \@@ -219,7 +219,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5676_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 2, bits, _shift), \@@ -231,7 +231,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5679_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +0
-0AD5868_CHANNEL(2, 2, bits, _shift), \drivers/iio/dac/ad5686.h +1
-1@@ -104,7 +104,7 @@ typedef int (*ad5686_read_func)(struct ad5686_state *st, u8 addr);struct ad5686_chip_info {u16 int_vref_mv;unsigned int num_channels; -struct iio_chan_spec *channels; +const struct iio_chan_spec *channels;enum ad5686_regmap_type regmap_type; };
Re: [PATCH 4/6] iio: dac: ad5686: Constify static struct iio_chan_spec
Quoted 18 lines · Jonathan Cameron
Quoted 15 lines · Alexandru
Quoted 13 lines · Rikard Falkeborn
[External]
These are never modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
6642 12608 64 19314 4b72drivers/iio/dac/ad5686.oAfter:
text data bss dec hex filename
16946 2304 64 19314 4b72drivers/iio/dac/ad5686.o
Quoted 5 lines
Quoted 2 lines
Applied.
thanks,
Was this one really applied? I can't see it anywhere? The rest of the patches in the series are in Linus' tree.
Rikard
Quoted 62 lines
Quoted 61 lines
Quoted 61 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5686.c | 8 ++++---- drivers/iio/dac/ad5686.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/iio/dac/ad5686.c +2
-2@@ -206,12 +206,12 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { }#define DECLARE_AD5693_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ }#define DECLARE_AD5686_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 1, bits, _shift), \ AD5868_CHANNEL(1, 2, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 4, bits, _shift), \@@ -219,7 +219,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5676_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 2, bits, _shift), \@@ -231,7 +231,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5679_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +0
-0AD5868_CHANNEL(2, 2, bits, _shift), \drivers/iio/dac/ad5686.h +1
-1@@ -104,7 +104,7 @@ typedef int (*ad5686_read_func)(struct ad5686_state *st, u8 addr);struct ad5686_chip_info {u16 int_vref_mv;unsigned int num_channels; -struct iio_chan_spec *channels; +const struct iio_chan_spec *channels;enum ad5686_regmap_type regmap_type; };
Jonathan Cameron
maintainerRe: [PATCH 4/6] iio: dac: ad5686: Constify static struct iio_chan_spec
Quoted 19 lines · On Tue, 18 Aug 2020 21:30:17 +0200 Rikard Falkeborn…
Quoted 18 lines · Jonathan Cameron
Quoted 15 lines · Alexandru
Quoted 13 lines · Rikard Falkeborn
[External]
These are never modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
6642 12608 64 19314 4b72drivers/iio/dac/ad5686.oAfter:
text data bss dec hex filename
16946 2304 64 19314 4b72drivers/iio/dac/ad5686.o
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Applied.
thanks,
Was this one really applied? I can't see it anywhere? The rest of the patches in the series are in Linus' tree.
No idea what happened here. Now applied to the togreg branch of iio.git and pushed out as testing. Sorry about that!
Jonathan
Quoted 64 lines
Rikard
Quoted 62 lines
Quoted 61 lines
Quoted 61 lines
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/iio/dac/ad5686.c | 8 ++++---- drivers/iio/dac/ad5686.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/iio/dac/ad5686.c +2
-2@@ -206,12 +206,12 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = { }#define DECLARE_AD5693_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ }#define DECLARE_AD5686_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 1, bits, _shift), \ AD5868_CHANNEL(1, 2, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 4, bits, _shift), \@@ -219,7 +219,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5676_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +1
-1AD5868_CHANNEL(2, 2, bits, _shift), \@@ -231,7 +231,7 @@ static struct iio_chan_spec name[] = { \ }#define DECLARE_AD5679_CHANNELS (name, bits, _shift) \ -static struct iio_chan_spec name[] = { \ +static const struct iio_chan_spec name[] = { \ AD5868_CHANNEL(0, 0, bits, _shift), \ AD5868_CHANNEL(1, 1, bits, _shift), \drivers/iio/dac/ad5686.c +0
-0AD5868_CHANNEL(2, 2, bits, _shift), \drivers/iio/dac/ad5686.h +1
-1@@ -104,7 +104,7 @@ typedef int (*ad5686_read_func)(struct ad5686_state *st, u8 addr);struct ad5686_chip_info {u16 int_vref_mv;unsigned int num_channels; -struct iio_chan_spec *channels; +const struct iio_chan_spec *channels;enum ad5686_regmap_type regmap_type; };
PATCH 5/6 iio: light: stk3310: Constify regmap_config
In reply to Rikard Falkebornstk3310_regmap_config is not modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename 16027 5424 128 21579 544b drivers/iio/light/stk3310.o
After:
text data bss dec hex filename 16347 5104 128 21579 544b drivers/iio/light/stk3310.o
--- drivers/iio/light/stk3310.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/stk3310.c +1 -1
@@ -487,7 +487,7 @@ static bool stk3310_is_volatile_reg(struct device *dev, unsigned int reg) } } -static struct regmap_config stk3310_regmap_config = { +static const struct regmap_config stk3310_regmap_config = { .name =STK3310_REGMAP_NAME , .reg_bits =8 , .val_bits =8 ,
Signature · 1 line
2.26.2
Re: [PATCH 5/6] iio: light: stk3310: Constify regmap_config
Quoted 4 lines · On Tue, 26 May 2020 23:02:22 +0200 Rikard Falkeborn…
stk3310_regmap_configis not modified and can be made const to allow the compiler to put it in read-only memory.Before:
Quoted 8 lines
text data bss dec hex filename 16027 5424 128 21579 544b drivers/iio/light/stk3310.oAfter:
text data bss dec hex filename 16347 5104 128 21579 544b drivers/iio/light/stk3310.oSigned-off-by Rikard Falkeborn <[email protected]>
Applied.
thanks,
Jonathan
Quoted 17 lines
--- drivers/iio/light/stk3310.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/stk3310.c +1
-1@@ -487,7 +487,7 @@ static bool stk3310_is_volatile_reg(struct device *dev, unsigned int reg) } } -static struct regmap_config stk3310_regmap_config = { +static const struct regmap_config stk3310_regmap_config = { .name =STK3310_REGMAP_NAME , .reg_bits =8 , .val_bits =8 ,
PATCH 6/6 iio: magnetometer: mmc35240: Constify struct reg_default
In reply to Rikard Falkebornmmc35240_reg_defaults is not modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename 9759 3288 128 13175 3377 drivers/iio/magnetometer/mmc35240.o
After:
text data bss dec hex filename 9823 3224 128 13175 3377 drivers/iio/magnetometer/mmc35240.o
--- drivers/iio/magnetometer/mmc35240.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/magnetometer/mmc35240.c +1 -1
@@ -459,7 +459,7 @@ static bool mmc35240_is_volatile_reg(struct device *dev, unsigned int reg) } } -static struct reg_default mmc35240_reg_defaults[] = { +static const struct reg_default mmc35240_reg_defaults[] = { {MMC35240_REG_CTRL0 ,0x00 }, {MMC35240_REG_CTRL1 ,0x00 }, };
Signature · 1 line
2.26.2
Jonathan Cameron
maintainerRe: [PATCH 6/6] iio: magnetometer: mmc35240: Constify struct reg_default
Quoted 4 lines · On Tue, 26 May 2020 23:02:23 +0200 Rikard Falkeborn…
mmc35240_reg_defaultsis not modified and can be made const to allow the compiler to put it in read-only memory.Before:
Quoted 8 lines
text data bss dec hex filename 9759 3288 128 13175 3377 drivers/iio/magnetometer/mmc35240.oAfter:
text data bss dec hex filename 9823 3224 128 13175 3377 drivers/iio/magnetometer/mmc35240.oSigned-off-by Rikard Falkeborn <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 17 lines
--- drivers/iio/magnetometer/mmc35240.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/magnetometer/mmc35240.c +1
-1@@ -459,7 +459,7 @@ static bool mmc35240_is_volatile_reg(struct device *dev, unsigned int reg) } } -static struct reg_default mmc35240_reg_defaults[] = { +static const struct reg_default mmc35240_reg_defaults[] = { {MMC35240_REG_CTRL0 ,0x00 }, {MMC35240_REG_CTRL1 ,0x00 }, };