regmap: Make reg_field's definition always visible
PATCH 1/1 regmap: Make reg_field's definition always visible
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.
--- include/linux/regmap.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
include/linux/regmap.h +17 -17
@@ -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,
Signature · 2 lines
Cheers, Nathan
Mark Brown
maintainerQuoted 1 line · Nathan Chancellor
regmap: Make reg_field's definition always visible
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-7.5
Thanks!
[1/1] regmap: Make reg_field's definition always visible
https://git.kernel.org/broonie/regmap/c/b56386b4c09a
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