Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regmap: regmap_multi_reg_read(): make register list const

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>

authored by

Richard Fitzgerald and committed by
Mark Brown
eb708cd6 1331fb66

+3 -3
+2 -2
drivers/base/regmap/regmap.c
··· 3115 3115 EXPORT_SYMBOL_GPL(regmap_fields_read); 3116 3116 3117 3117 static int _regmap_bulk_read(struct regmap *map, unsigned int reg, 3118 - unsigned int *regs, void *val, size_t val_count) 3118 + const unsigned int *regs, void *val, size_t val_count) 3119 3119 { 3120 3120 u32 *u32 = val; 3121 3121 u16 *u16 = val; ··· 3209 3209 * A value of zero will be returned on success, a negative errno will 3210 3210 * be returned in error cases. 3211 3211 */ 3212 - int regmap_multi_reg_read(struct regmap *map, unsigned int *regs, void *val, 3212 + int regmap_multi_reg_read(struct regmap *map, const unsigned int *regs, void *val, 3213 3213 size_t val_count) 3214 3214 { 3215 3215 if (val_count == 0)
+1 -1
include/linux/regmap.h
··· 1244 1244 void *val, size_t val_len); 1245 1245 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, 1246 1246 size_t val_count); 1247 - int regmap_multi_reg_read(struct regmap *map, unsigned int *reg, void *val, 1247 + int regmap_multi_reg_read(struct regmap *map, const unsigned int *reg, void *val, 1248 1248 size_t val_count); 1249 1249 int regmap_update_bits_base(struct regmap *map, unsigned int reg, 1250 1250 unsigned int mask, unsigned int val,