LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] regmap: allow const array for {devm_,}regmap_field_bulk_alloc reg_fields
@ 2021-08-02  6:37 Icenowy Zheng
  2021-08-02 15:02 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Icenowy Zheng @ 2021-08-02  6:37 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, Rafael J . Wysocki
  Cc: linux-kernel, Icenowy Zheng

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>
---
 drivers/base/regmap/regmap.c | 4 ++--
 include/linux/regmap.h       | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index dcfa99ea7f31..6ad41d0720ba 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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;
@@ -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;
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index f5f08dd0a116..77755196277c 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -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);
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] regmap: allow const array for {devm_,}regmap_field_bulk_alloc reg_fields
  2021-08-02  6:37 [PATCH] regmap: allow const array for {devm_,}regmap_field_bulk_alloc reg_fields Icenowy Zheng
@ 2021-08-02 15:02 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-08-02 15:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Icenowy Zheng, Rafael J . Wysocki
  Cc: Mark Brown, linux-kernel

On Mon, 2 Aug 2021 14:37:41 +0800, Icenowy Zheng wrote:
> 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: allow const array for {devm_,}regmap_field_bulk_alloc reg_fields
      commit: 29c34975c9391d3ad1fd5dd3c92ba0d41afe9549

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-02 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02  6:37 [PATCH] regmap: allow const array for {devm_,}regmap_field_bulk_alloc reg_fields Icenowy Zheng
2021-08-02 15:02 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).