* [PATCH 01/10] iio: accel: adxl367: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-03 21:04 ` [PATCH 02/10] iio: accel: bma400: " Javier Carrasco
` (9 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`adxl367_spi_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/accel/adxl367_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/accel/adxl367_spi.c b/drivers/iio/accel/adxl367_spi.c
index 118c894015a5..b70117265791 100644
--- a/drivers/iio/accel/adxl367_spi.c
+++ b/drivers/iio/accel/adxl367_spi.c
@@ -72,7 +72,7 @@ static int adxl367_write(void *context, const void *val_buf, size_t val_size)
return spi_sync(st->spi, &st->reg_write_msg);
}
-static struct regmap_bus adxl367_spi_regmap_bus = {
+static const struct regmap_bus adxl367_spi_regmap_bus = {
.read = adxl367_read,
.write = adxl367_write,
};
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 02/10] iio: accel: bma400: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
2024-07-03 21:04 ` [PATCH 01/10] iio: accel: adxl367: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-03 21:04 ` [PATCH 03/10] iio: accel: bmi088: " Javier Carrasco
` (8 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`bma400_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/accel/bma400_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/accel/bma400_spi.c b/drivers/iio/accel/bma400_spi.c
index ec13c044b304..765d8c4a4c4d 100644
--- a/drivers/iio/accel/bma400_spi.c
+++ b/drivers/iio/accel/bma400_spi.c
@@ -53,7 +53,7 @@ static int bma400_regmap_spi_write(void *context, const void *data,
return spi_write(spi, data, count);
}
-static struct regmap_bus bma400_regmap_bus = {
+static const struct regmap_bus bma400_regmap_bus = {
.read = bma400_regmap_spi_read,
.write = bma400_regmap_spi_write,
.read_flag_mask = BIT(7),
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 03/10] iio: accel: bmi088: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
2024-07-03 21:04 ` [PATCH 01/10] iio: accel: adxl367: " Javier Carrasco
2024-07-03 21:04 ` [PATCH 02/10] iio: accel: bma400: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-03 21:04 ` [PATCH 04/10] iio: adc: ad7091r8: " Javier Carrasco
` (7 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`bmi088_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/accel/bmi088-accel-spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/accel/bmi088-accel-spi.c b/drivers/iio/accel/bmi088-accel-spi.c
index 7b419a7b2478..df1adc059aa9 100644
--- a/drivers/iio/accel/bmi088-accel-spi.c
+++ b/drivers/iio/accel/bmi088-accel-spi.c
@@ -36,7 +36,7 @@ static int bmi088_regmap_spi_read(void *context, const void *reg,
return spi_write_then_read(spi, addr, sizeof(addr), val, val_size);
}
-static struct regmap_bus bmi088_regmap_bus = {
+static const struct regmap_bus bmi088_regmap_bus = {
.write = bmi088_regmap_spi_write,
.read = bmi088_regmap_spi_read,
};
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 04/10] iio: adc: ad7091r8: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (2 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 03/10] iio: accel: bmi088: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-04 11:16 ` Nuno Sá
2024-07-04 13:04 ` Schmitt, Marcelo
2024-07-03 21:04 ` [PATCH 05/10] iio: chemical: bme680: " Javier Carrasco
` (6 subsequent siblings)
10 siblings, 2 replies; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`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(-)
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,
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 04/10] iio: adc: ad7091r8: Constify struct regmap_bus
2024-07-03 21:04 ` [PATCH 04/10] iio: adc: ad7091r8: " Javier Carrasco
@ 2024-07-04 11:16 ` Nuno Sá
2024-07-04 13:04 ` Schmitt, Marcelo
1 sibling, 0 replies; 18+ messages in thread
From: Nuno Sá @ 2024-07-04 11:16 UTC (permalink / raw)
To: Javier Carrasco, Cosmin Tanislav, Lars-Peter Clausen,
Michael Hennerich, Jonathan Cameron, Dan Robertson,
Marcelo Schmitt, Nuno Sá, Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel
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>
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [PATCH 04/10] iio: adc: ad7091r8: Constify struct regmap_bus
2024-07-03 21:04 ` [PATCH 04/10] iio: adc: ad7091r8: " Javier Carrasco
2024-07-04 11:16 ` Nuno Sá
@ 2024-07-04 13:04 ` Schmitt, Marcelo
1 sibling, 0 replies; 18+ messages in thread
From: Schmitt, Marcelo @ 2024-07-04 13:04 UTC (permalink / raw)
To: Javier Carrasco, Tanislav, Cosmin, Lars-Peter Clausen,
Hennerich, Michael, Jonathan Cameron, Dan Robertson, Sa, Nuno,
Jagath Jog J, Linus Walleij, marcelo.schmitt1@gmail.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
> 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,
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 05/10] iio: chemical: bme680: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (3 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 04/10] iio: adc: ad7091r8: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-06 10:51 ` [PATCH 05/10]: " Vasileios Amoiridis
2024-07-03 21:04 ` [PATCH 06/10] iio: dac: ltc2688: " Javier Carrasco
` (5 subsequent siblings)
10 siblings, 1 reply; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`bme680_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/chemical/bme680_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/chemical/bme680_spi.c b/drivers/iio/chemical/bme680_spi.c
index 4404d42ae5ec..7c54bd17d4b0 100644
--- a/drivers/iio/chemical/bme680_spi.c
+++ b/drivers/iio/chemical/bme680_spi.c
@@ -100,7 +100,7 @@ static int bme680_regmap_spi_read(void *context, const void *reg,
return spi_write_then_read(spi, &addr, 1, val, val_size);
}
-static struct regmap_bus bme680_regmap_bus = {
+static const struct regmap_bus bme680_regmap_bus = {
.write = bme680_regmap_spi_write,
.read = bme680_regmap_spi_read,
.reg_format_endian_default = REGMAP_ENDIAN_BIG,
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 05/10]: iio: chemical: bme680: Constify struct regmap_bus
2024-07-03 21:04 ` [PATCH 05/10] iio: chemical: bme680: " Javier Carrasco
@ 2024-07-06 10:51 ` Vasileios Amoiridis
2024-07-07 15:24 ` Jonathan Cameron
0 siblings, 1 reply; 18+ messages in thread
From: Vasileios Amoiridis @ 2024-07-06 10:51 UTC (permalink / raw)
To: javier.carrasco.cruz
Cc: Michael.Hennerich, cosmin.tanislav, dan, jagathjog1996, jic23,
lars, linus.walleij, linux-iio, linux-kernel, marcelo.schmitt,
nuno.sa, vassilisamir
For the BME680 part:
Tested-By: Vasileios Amoiridis <vassilisamir@gmail.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 05/10]: iio: chemical: bme680: Constify struct regmap_bus
2024-07-06 10:51 ` [PATCH 05/10]: " Vasileios Amoiridis
@ 2024-07-07 15:24 ` Jonathan Cameron
0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2024-07-07 15:24 UTC (permalink / raw)
To: Vasileios Amoiridis
Cc: javier.carrasco.cruz, Michael.Hennerich, cosmin.tanislav, dan,
jagathjog1996, lars, linus.walleij, linux-iio, linux-kernel,
marcelo.schmitt, nuno.sa
On Sat, 6 Jul 2024 12:51:37 +0200
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
> For the BME680 part:
>
> Tested-By: Vasileios Amoiridis <vassilisamir@gmail.com>
Thanks. Added the tags for this and the other one.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 06/10] iio: dac: ltc2688: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (4 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 05/10] iio: chemical: bme680: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-04 7:13 ` Nuno Sá
2024-07-03 21:04 ` [PATCH 07/10] iio: imu: bmi323: " Javier Carrasco
` (4 subsequent siblings)
10 siblings, 1 reply; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`ltc2688_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/dac/ltc2688.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ltc2688.c b/drivers/iio/dac/ltc2688.c
index af50d2a95898..376dca163c91 100644
--- a/drivers/iio/dac/ltc2688.c
+++ b/drivers/iio/dac/ltc2688.c
@@ -918,7 +918,7 @@ static bool ltc2688_reg_writable(struct device *dev, unsigned int reg)
return false;
}
-static struct regmap_bus ltc2688_regmap_bus = {
+static const struct regmap_bus ltc2688_regmap_bus = {
.read = ltc2688_spi_read,
.write = ltc2688_spi_write,
.read_flag_mask = LTC2688_READ_OPERATION,
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 06/10] iio: dac: ltc2688: Constify struct regmap_bus
2024-07-03 21:04 ` [PATCH 06/10] iio: dac: ltc2688: " Javier Carrasco
@ 2024-07-04 7:13 ` Nuno Sá
0 siblings, 0 replies; 18+ messages in thread
From: Nuno Sá @ 2024-07-04 7:13 UTC (permalink / raw)
To: Javier Carrasco, Cosmin Tanislav, Lars-Peter Clausen,
Michael Hennerich, Jonathan Cameron, Dan Robertson,
Marcelo Schmitt, Nuno Sá, Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel
On Wed, 2024-07-03 at 23:04 +0200, Javier Carrasco wrote:
> `ltc2688_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>
> ---
Indeed,
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 07/10] iio: imu: bmi323: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (5 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 06/10] iio: dac: ltc2688: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-03 21:04 ` [PATCH 08/10] iio: imu: bno055: " Javier Carrasco
` (3 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`bmi323_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/imu/bmi323/bmi323_i2c.c | 2 +-
drivers/iio/imu/bmi323/bmi323_spi.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/bmi323/bmi323_i2c.c b/drivers/iio/imu/bmi323/bmi323_i2c.c
index 52140bf05765..3298e027c97e 100644
--- a/drivers/iio/imu/bmi323/bmi323_i2c.c
+++ b/drivers/iio/imu/bmi323/bmi323_i2c.c
@@ -61,7 +61,7 @@ static int bmi323_regmap_i2c_write(void *context, const void *data,
data + sizeof(u8));
}
-static struct regmap_bus bmi323_regmap_bus = {
+static const struct regmap_bus bmi323_regmap_bus = {
.read = bmi323_regmap_i2c_read,
.write = bmi323_regmap_i2c_write,
};
diff --git a/drivers/iio/imu/bmi323/bmi323_spi.c b/drivers/iio/imu/bmi323/bmi323_spi.c
index 7b1e8127d0dd..571e1cd7ce72 100644
--- a/drivers/iio/imu/bmi323/bmi323_spi.c
+++ b/drivers/iio/imu/bmi323/bmi323_spi.c
@@ -36,7 +36,7 @@ static int bmi323_regmap_spi_write(void *context, const void *data,
return spi_write(spi, data_buff + 1, count - 1);
}
-static struct regmap_bus bmi323_regmap_bus = {
+static const struct regmap_bus bmi323_regmap_bus = {
.read = bmi323_regmap_spi_read,
.write = bmi323_regmap_spi_write,
};
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 08/10] iio: imu: bno055: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (6 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 07/10] iio: imu: bmi323: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-03 21:04 ` [PATCH 09/10] iio: light: gp2ap002: " Javier Carrasco
` (2 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`bno055_ser_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/imu/bno055/bno055_ser_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/imu/bno055/bno055_ser_core.c b/drivers/iio/imu/bno055/bno055_ser_core.c
index 694ff14a3aa2..da7873bfd348 100644
--- a/drivers/iio/imu/bno055/bno055_ser_core.c
+++ b/drivers/iio/imu/bno055/bno055_ser_core.c
@@ -492,7 +492,7 @@ static const struct serdev_device_ops bno055_ser_serdev_ops = {
.write_wakeup = serdev_device_write_wakeup,
};
-static struct regmap_bus bno055_ser_regmap_bus = {
+static const struct regmap_bus bno055_ser_regmap_bus = {
.write = bno055_ser_write_reg,
.read = bno055_ser_read_reg,
};
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 09/10] iio: light: gp2ap002: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (7 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 08/10] iio: imu: bno055: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-03 21:04 ` [PATCH 10/10] iio: pressure: bmp280: " Javier Carrasco
2024-07-06 10:43 ` [PATCH 00/10] iio: " Jonathan Cameron
10 siblings, 0 replies; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`gp2ap002_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/light/gp2ap002.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c
index 7125e011a38a..f8b1d7dd6f5f 100644
--- a/drivers/iio/light/gp2ap002.c
+++ b/drivers/iio/light/gp2ap002.c
@@ -420,7 +420,7 @@ static int gp2ap002_regmap_i2c_write(void *context, unsigned int reg,
return i2c_smbus_write_byte_data(i2c, reg, val);
}
-static struct regmap_bus gp2ap002_regmap_bus = {
+static const struct regmap_bus gp2ap002_regmap_bus = {
.reg_read = gp2ap002_regmap_i2c_read,
.reg_write = gp2ap002_regmap_i2c_write,
};
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 10/10] iio: pressure: bmp280: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (8 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 09/10] iio: light: gp2ap002: " Javier Carrasco
@ 2024-07-03 21:04 ` Javier Carrasco
2024-07-06 10:54 ` [PATCH 10/10]: " Vasileios Amoiridis
2024-07-06 10:43 ` [PATCH 00/10] iio: " Jonathan Cameron
10 siblings, 1 reply; 18+ messages in thread
From: Javier Carrasco @ 2024-07-03 21:04 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Dan Robertson, Marcelo Schmitt, Nuno Sá,
Jagath Jog J, Linus Walleij
Cc: linux-iio, linux-kernel, Javier Carrasco
`bmp280_regmap_bus` and `bmp380_regmap_bus` are conditionally assigned
to `bmp_regmap_bus`, which is only used to pass the struct as a
read-only member.
Add the const modifier to the structs and the pointer to move the data
to a read-only section.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/iio/pressure/bmp280-spi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/pressure/bmp280-spi.c b/drivers/iio/pressure/bmp280-spi.c
index 62b4e58104cf..fee266d4e055 100644
--- a/drivers/iio/pressure/bmp280-spi.c
+++ b/drivers/iio/pressure/bmp280-spi.c
@@ -64,14 +64,14 @@ static int bmp380_regmap_spi_read(void *context, const void *reg,
return 0;
}
-static struct regmap_bus bmp280_regmap_bus = {
+static const struct regmap_bus bmp280_regmap_bus = {
.write = bmp280_regmap_spi_write,
.read = bmp280_regmap_spi_read,
.reg_format_endian_default = REGMAP_ENDIAN_BIG,
.val_format_endian_default = REGMAP_ENDIAN_BIG,
};
-static struct regmap_bus bmp380_regmap_bus = {
+static const struct regmap_bus bmp380_regmap_bus = {
.write = bmp280_regmap_spi_write,
.read = bmp380_regmap_spi_read,
.read_flag_mask = BIT(7),
@@ -83,7 +83,7 @@ static int bmp280_spi_probe(struct spi_device *spi)
{
const struct spi_device_id *id = spi_get_device_id(spi);
const struct bmp280_chip_info *chip_info;
- struct regmap_bus *bmp_regmap_bus;
+ struct regmap_bus const *bmp_regmap_bus;
struct regmap *regmap;
int ret;
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 10/10]: iio: pressure: bmp280: Constify struct regmap_bus
2024-07-03 21:04 ` [PATCH 10/10] iio: pressure: bmp280: " Javier Carrasco
@ 2024-07-06 10:54 ` Vasileios Amoiridis
0 siblings, 0 replies; 18+ messages in thread
From: Vasileios Amoiridis @ 2024-07-06 10:54 UTC (permalink / raw)
To: javier.carrasco.cruz
Cc: Michael.Hennerich, cosmin.tanislav, dan, jagathjog1996, jic23,
lars, linus.walleij, linux-iio, linux-kernel, marcelo.schmitt,
nuno.sa, vassilisamir
For the BMP280 part:
Tested-By: Vasileios Amoiridis <vassilisamir@gmail.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/10] iio: Constify struct regmap_bus
2024-07-03 21:04 [PATCH 00/10] iio: Constify struct regmap_bus Javier Carrasco
` (9 preceding siblings ...)
2024-07-03 21:04 ` [PATCH 10/10] iio: pressure: bmp280: " Javier Carrasco
@ 2024-07-06 10:43 ` Jonathan Cameron
10 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2024-07-06 10:43 UTC (permalink / raw)
To: Javier Carrasco
Cc: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Dan Robertson, Marcelo Schmitt, Nuno Sá, Jagath Jog J,
Linus Walleij, linux-iio, linux-kernel
On Wed, 03 Jul 2024 23:04:43 +0200
Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
> This series adds the const modifier to the remaining regmap_bus
> structs within the IIO subsystem that are effectively used as const
> (i.e., only read after their declaration), but kept as writtable data.
>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Applied, but for now only to the testing tree of iio.git as I'm unlikely to
do another pull request this cycle and will want to rebase the tree on
6.11-rc1 once availabled.
Thanks,
Jonathan
> ---
> Javier Carrasco (10):
> iio: accel: adxl367: Constify struct regmap_bus
> iio: accel: bma400: Constify struct regmap_bus
> iio: accel: bmi088: Constify struct regmap_bus
> iio: adc: ad7091r8: Constify struct regmap_bus
> iio: chemical: bme680: Constify struct regmap_bus
> iio: dac: ltc2688: Constify struct regmap_bus
> iio: imu: bmi323: Constify struct regmap_bus
> iio: imu: bno055: Constify struct regmap_bus
> iio: light: gp2ap002: Constify struct regmap_bus
> iio: pressure: bmp280: Constify struct regmap_bus
>
> drivers/iio/accel/adxl367_spi.c | 2 +-
> drivers/iio/accel/bma400_spi.c | 2 +-
> drivers/iio/accel/bmi088-accel-spi.c | 2 +-
> drivers/iio/adc/ad7091r8.c | 2 +-
> drivers/iio/chemical/bme680_spi.c | 2 +-
> drivers/iio/dac/ltc2688.c | 2 +-
> drivers/iio/imu/bmi323/bmi323_i2c.c | 2 +-
> drivers/iio/imu/bmi323/bmi323_spi.c | 2 +-
> drivers/iio/imu/bno055/bno055_ser_core.c | 2 +-
> drivers/iio/light/gp2ap002.c | 2 +-
> drivers/iio/pressure/bmp280-spi.c | 6 +++---
> 11 files changed, 13 insertions(+), 13 deletions(-)
> ---
> base-commit: 0b58e108042b0ed28a71cd7edf5175999955b233
> change-id: 20240703-iio-cont-regmap_bus-f7578bc89954
>
> Best regards,
^ permalink raw reply [flat|nested] 18+ messages in thread