Skip to content

Commit

Permalink
regmap: allow const array for {devm_,}regmap_field_bulk_alloc reg_fields
Browse files Browse the repository at this point in the history
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 <icenowy@sipeed.com>
Link: https://lore.kernel.org/r/20210802063741.76301-1-icenowy@sipeed.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Icenowy Zheng authored and Mark Brown committed Aug 2, 2021
1 parent d63aa09 commit 29c3497
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ EXPORT_SYMBOL_GPL(devm_regmap_field_alloc);
*/
int regmap_field_bulk_alloc(struct regmap *regmap,
struct regmap_field **rm_field,
struct reg_field *reg_field,
const struct reg_field *reg_field,
int num_fields)
{
struct regmap_field *rf;
Expand Down Expand Up @@ -1334,7 +1334,7 @@ EXPORT_SYMBOL_GPL(regmap_field_bulk_alloc);
int devm_regmap_field_bulk_alloc(struct device *dev,
struct regmap *regmap,
struct regmap_field **rm_field,
struct reg_field *reg_field,
const struct reg_field *reg_field,
int num_fields)
{
struct regmap_field *rf;
Expand Down
5 changes: 3 additions & 2 deletions include/linux/regmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1269,12 +1269,13 @@ void devm_regmap_field_free(struct device *dev, struct regmap_field *field);

int regmap_field_bulk_alloc(struct regmap *regmap,
struct regmap_field **rm_field,
struct reg_field *reg_field,
const struct reg_field *reg_field,
int num_fields);
void regmap_field_bulk_free(struct regmap_field *field);
int devm_regmap_field_bulk_alloc(struct device *dev, struct regmap *regmap,
struct regmap_field **field,
struct reg_field *reg_field, int num_fields);
const struct reg_field *reg_field,
int num_fields);
void devm_regmap_field_bulk_free(struct device *dev,
struct regmap_field *field);

Expand Down

0 comments on commit 29c3497

Please sign in to comment.