[6/6] iio: magnetometer: mmc35240: Constify struct reg_default
diff mbox series

Message ID 20200526210223.1672-7-rikard.falkeborn@gmail.com
State New
Headers show
Series
  • drivers/iio: Constify structs
Related show

Commit Message

Rikard Falkeborn May 26, 2020, 9:02 p.m. UTC
mmc35240_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

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/iio/magnetometer/mmc35240.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron May 31, 2020, 1:48 p.m. UTC | #1
On Tue, 26 May 2020 23:02:23 +0200
Rikard Falkeborn <rikard.falkeborn@gmail.com> wrote:

> mmc35240_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
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/magnetometer/mmc35240.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
> index 1787d656d009..f27586716b5c 100644
> --- a/drivers/iio/magnetometer/mmc35240.c
> +++ b/drivers/iio/magnetometer/mmc35240.c
> @@ -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 },
>  };

Patch
diff mbox series

diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index 1787d656d009..f27586716b5c 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -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 },
 };