diff mbox series

[04/10] iio: adc: ad7091r8: Constify struct regmap_bus

Message ID 20240703-iio-cont-regmap_bus-v1-4-34754f355b65@gmail.com (mailing list archive)
State Accepted
Headers show
Series iio: Constify struct regmap_bus | expand

Commit Message

Javier Carrasco July 3, 2024, 9:04 p.m. UTC
`ad7091r8_regmap_bus` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/iio/adc/ad7091r8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nuno Sá July 4, 2024, 11:16 a.m. UTC | #1
On Wed, 2024-07-03 at 23:04 +0200, Javier Carrasco wrote:
> `ad7091r8_regmap_bus` is not modified and can be declared as const to
> move its data to a read-only section.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Marcelo Schmitt July 4, 2024, 1:04 p.m. UTC | #2
> From: Javier Carrasco <javier.carrasco.cruz@gmail.com> 
> Sent: Wednesday, July 3, 2024 6:05 PM
> To: Tanislav, Cosmin <Cosmin.Tanislav@analog.com>; Lars-Peter Clausen <lars@metafoo.de>; Hennerich, Michael <Michael.Hennerich@analog.com>; Jonathan Cameron <jic23@kernel.org>; Dan Robertson <dan@dlrobertson.com>; Schmitt, Marcelo <Marcelo.Schmitt@analog.com>; Sa, Nuno > <Nuno.Sa@analog.com>; Jagath Jog J <jagathjog1996@gmail.com>; Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org; Javier Carrasco <javier.carrasco.cruz@gmail.com>
> Subject: [PATCH 04/10] iio: adc: ad7091r8: Constify struct regmap_bus
>
> `ad7091r8_regmap_bus` is not modified and can be declared as const to move its data to a read-only section.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
>  drivers/iio/adc/ad7091r8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>

> diff --git a/drivers/iio/adc/ad7091r8.c b/drivers/iio/adc/ad7091r8.c index 700564305057..c9e014d6a77c 100644
> --- a/drivers/iio/adc/ad7091r8.c
> +++ b/drivers/iio/adc/ad7091r8.c
> @@ -159,7 +159,7 @@ static int ad7091r_regmap_bus_reg_write(void *context, unsigned int reg,
>  	return spi_write(spi, &st->tx_buf, 2);  }
>  
> -static struct regmap_bus ad7091r8_regmap_bus = {
> +static const struct regmap_bus ad7091r8_regmap_bus = {
>  	.reg_read = ad7091r_regmap_bus_reg_read,
>  	.reg_write = ad7091r_regmap_bus_reg_write,
>  	.reg_format_endian_default = REGMAP_ENDIAN_BIG,
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7091r8.c b/drivers/iio/adc/ad7091r8.c
index 700564305057..c9e014d6a77c 100644
--- a/drivers/iio/adc/ad7091r8.c
+++ b/drivers/iio/adc/ad7091r8.c
@@ -159,7 +159,7 @@  static int ad7091r_regmap_bus_reg_write(void *context, unsigned int reg,
 	return spi_write(spi, &st->tx_buf, 2);
 }
 
-static struct regmap_bus ad7091r8_regmap_bus = {
+static const struct regmap_bus ad7091r8_regmap_bus = {
 	.reg_read = ad7091r_regmap_bus_reg_read,
 	.reg_write = ad7091r_regmap_bus_reg_write,
 	.reg_format_endian_default = REGMAP_ENDIAN_BIG,