mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: "Cosmin Tanislav" <cosmin.tanislav@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Dan Robertson" <dan@dlrobertson.com>,
	"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
	"Nuno Sá" <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 10/10] iio: pressure: bmp280: Constify struct regmap_bus
Date: Wed, 03 Jul 2024 23:04:53 +0200	[thread overview]
Message-ID: <20240703-iio-cont-regmap_bus-v1-10-34754f355b65@gmail.com> (raw)
In-Reply-To: <20240703-iio-cont-regmap_bus-v1-0-34754f355b65@gmail.com>

`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


  parent reply	other threads:[~2024-07-03 21:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 21:04 [PATCH 00/10] iio: " 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 ` [PATCH 03/10] iio: accel: bmi088: " Javier Carrasco
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
2024-07-03 21:04 ` [PATCH 05/10] iio: chemical: bme680: " Javier Carrasco
2024-07-06 10:51   ` [PATCH 05/10]: " Vasileios Amoiridis
2024-07-07 15:24     ` Jonathan Cameron
2024-07-03 21:04 ` [PATCH 06/10] iio: dac: ltc2688: " Javier Carrasco
2024-07-04  7:13   ` Nuno Sá
2024-07-03 21:04 ` [PATCH 07/10] iio: imu: bmi323: " Javier Carrasco
2024-07-03 21:04 ` [PATCH 08/10] iio: imu: bno055: " Javier Carrasco
2024-07-03 21:04 ` [PATCH 09/10] iio: light: gp2ap002: " Javier Carrasco
2024-07-03 21:04 ` Javier Carrasco [this message]
2024-07-06 10:54   ` [PATCH 10/10]: iio: pressure: bmp280: " Vasileios Amoiridis
2024-07-06 10:43 ` [PATCH 00/10] iio: " Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240703-iio-cont-regmap_bus-v1-10-34754f355b65@gmail.com \
    --to=javier.carrasco.cruz@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=dan@dlrobertson.com \
    --cc=jagathjog1996@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®