* [PATCH] regmap: Make reg_field's definition always visible
@ 2026-11-28 22:21 Nathan Chancellor
0 siblings, 0 replies; only message in thread
From: Nathan Chancellor @ 2026-11-28 22:21 UTC (permalink / raw)
To: Mark Brown; +Cc: Victor Chernyakin, linux-kernel, Nathan Chancellor
When building without CONFIG_REGMAP, there are a few warnings/errors
from stubs because 'struct reg_field' is only defined in a
CONFIG_REGMAP=y block.
In file included from drivers/regulator/helpers.c:13:
include/linux/regmap.h:2108:53: warning: 'struct reg_field' declared inside parameter list will not be visible outside of this definition or declaration
2108 | regmap_reg_field_read(struct regmap *regmap, struct reg_field field,
| ^~~~~~~~~
include/linux/regmap.h:2108:63: error: parameter 2 ('field') has incomplete type
2108 | regmap_reg_field_read(struct regmap *regmap, struct reg_field field,
| ~~~~~~~~~~~~~~~~~^~~~~
include/linux/regmap.h:2108:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
2108 | regmap_reg_field_read(struct regmap *regmap, struct reg_field field,
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/regmap.h:2116:54: warning: 'struct reg_field' declared inside parameter list will not be visible outside of this definition or declaration
2116 | regmap_reg_field_write(struct regmap *regmap, struct reg_field field,
| ^~~~~~~~~
include/linux/regmap.h:2116:64: error: parameter 2 ('field') has incomplete type
2116 | regmap_reg_field_write(struct regmap *regmap, struct reg_field field,
| ~~~~~~~~~~~~~~~~~^~~~~
include/linux/regmap.h:2116:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
2116 | regmap_reg_field_write(struct regmap *regmap, struct reg_field field,
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Move the definition of 'struct reg_field' out of the CONFIG_REGMAP block
so that it is always defined, clearing up the errors.
Fixes: 39e628387d32 ("regmap: add regmap_reg_field_* APIs")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
include/linux/regmap.h | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 6194948ff9ed..ab43fb603c80 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -212,6 +212,23 @@ struct reg_sequence {
__ret ?: __tmp; \
})
+/**
+ * struct reg_field - Description of an register field
+ *
+ * @reg: Offset of the register within the regmap bank
+ * @lsb: lsb of the register field.
+ * @msb: msb of the register field.
+ * @id_size: port size if it has some ports
+ * @id_offset: address offset for each ports
+ */
+struct reg_field {
+ unsigned int reg;
+ unsigned int lsb;
+ unsigned int msb;
+ unsigned int id_size;
+ unsigned int id_offset;
+};
+
#ifdef CONFIG_REGMAP
enum regmap_endian {
@@ -1454,23 +1471,6 @@ static inline int regmap_assign_bits(struct regmap *map, unsigned int reg,
int regmap_test_bits(struct regmap *map, unsigned int reg, unsigned int bits);
-/**
- * struct reg_field - Description of an register field
- *
- * @reg: Offset of the register within the regmap bank
- * @lsb: lsb of the register field.
- * @msb: msb of the register field.
- * @id_size: port size if it has some ports
- * @id_offset: address offset for each ports
- */
-struct reg_field {
- unsigned int reg;
- unsigned int lsb;
- unsigned int msb;
- unsigned int id_size;
- unsigned int id_offset;
-};
-
#define REG_FIELD(_reg, _lsb, _msb) ((struct reg_field){ \
.reg = _reg, \
.lsb = _lsb, \
---
base-commit: 222b61e9c570dac6c7a786d039e4c226624b426d
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
change-id: 20261128-regmap-fix-wvisibility-d3b884f4c723
Best regards,
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-28 22:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-28 22:21 [PATCH] regmap: Make reg_field's definition always visible Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®