Skip to content

Commit 29c3497

Browse files
Icenowybroonie
authored andcommitted
regmap: allow const array for {devm_,}regmap_field_bulk_alloc reg_fields
The reg_fields array fed to {devm_}regmap_field_bulk_alloc is currently not const, which is not correct on semantics (the functions shouldn't change reg_field contents) and prevents pre-defined const reg_field array to be used. As the implementation of this function doesn't change the content of it, just add const to its prototype. Signed-off-by: Icenowy Zheng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent d63aa09 commit 29c3497

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

drivers/base/regmap/regmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ EXPORT_SYMBOL_GPL(devm_regmap_field_alloc);
12981298
*/
12991299
int regmap_field_bulk_alloc(struct regmap *regmap,
13001300
struct regmap_field **rm_field,
1301-
struct reg_field *reg_field,
1301+
const struct reg_field *reg_field,
13021302
int num_fields)
13031303
{
13041304
struct regmap_field *rf;
@@ -1334,7 +1334,7 @@ EXPORT_SYMBOL_GPL(regmap_field_bulk_alloc);
13341334
int devm_regmap_field_bulk_alloc(struct device *dev,
13351335
struct regmap *regmap,
13361336
struct regmap_field **rm_field,
1337-
struct reg_field *reg_field,
1337+
const struct reg_field *reg_field,
13381338
int num_fields)
13391339
{
13401340
struct regmap_field *rf;

include/linux/regmap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,12 +1269,13 @@ void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
12691269

12701270
int regmap_field_bulk_alloc(struct regmap *regmap,
12711271
struct regmap_field **rm_field,
1272-
struct reg_field *reg_field,
1272+
const struct reg_field *reg_field,
12731273
int num_fields);
12741274
void regmap_field_bulk_free(struct regmap_field *field);
12751275
int devm_regmap_field_bulk_alloc(struct device *dev, struct regmap *regmap,
12761276
struct regmap_field **field,
1277-
struct reg_field *reg_field, int num_fields);
1277+
const struct reg_field *reg_field,
1278+
int num_fields);
12781279
void devm_regmap_field_bulk_free(struct device *dev,
12791280
struct regmap_field *field);
12801281

0 commit comments

Comments
 (0)