]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regmap: regmap_multi_reg_read(): make register list const
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Wed, 11 Dec 2024 13:35:58 +0000 (13:35 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 11 Dec 2024 14:24:09 +0000 (14:24 +0000)
Mark the list of registers passed into regmap_multi_reg_read() as a
pointer to const. This allows the caller to define the register list
as const data.

This requires making the same change to _regmap_bulk_read(), which is
called by regmap_multi_reg_read().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20241211133558.884669-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap.c
include/linux/regmap.h

index ff37701b6d6c42b84d35628fb18f607a1db22a33..f2843f814675151354a4deb3248b2cf1443b82af 100644 (file)
@@ -3115,7 +3115,7 @@ int regmap_fields_read(struct regmap_field *field, unsigned int id,
 EXPORT_SYMBOL_GPL(regmap_fields_read);
 
 static int _regmap_bulk_read(struct regmap *map, unsigned int reg,
-                            unsigned int *regs, void *val, size_t val_count)
+                            const unsigned int *regs, void *val, size_t val_count)
 {
        u32 *u32 = val;
        u16 *u16 = val;
@@ -3209,7 +3209,7 @@ EXPORT_SYMBOL_GPL(regmap_bulk_read);
  * A value of zero will be returned on success, a negative errno will
  * be returned in error cases.
  */
-int regmap_multi_reg_read(struct regmap *map, unsigned int *regs, void *val,
+int regmap_multi_reg_read(struct regmap *map, const unsigned int *regs, void *val,
                          size_t val_count)
 {
        if (val_count == 0)
index fd41baccbf3eb97a36ebe16c40690a1d8c5d2671..3871c74f767706eb9cf5ff2c9c2815189124d708 100644 (file)
@@ -1244,7 +1244,7 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg,
                      void *val, size_t val_len);
 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
                     size_t val_count);
-int regmap_multi_reg_read(struct regmap *map, unsigned int *reg, void *val,
+int regmap_multi_reg_read(struct regmap *map, const unsigned int *reg, void *val,
                          size_t val_count);
 int regmap_update_bits_base(struct regmap *map, unsigned int reg,
                            unsigned int mask, unsigned int val,