mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 11:31:31 +00:00
regmap: provide regmap_assign_bits()
Add another bits helper to regmap API: this one sets given bits if value is true and clears them if it's false. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Link: https://patch.msgid.link/20241108-assign-bits-v1-1-382790562d99@ideasonboard.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
953e549471
commit
d1f4390dd2
@ -1335,6 +1335,15 @@ static inline int regmap_clear_bits(struct regmap *map,
|
||||
return regmap_update_bits_base(map, reg, bits, 0, NULL, false, false);
|
||||
}
|
||||
|
||||
static inline int regmap_assign_bits(struct regmap *map, unsigned int reg,
|
||||
unsigned int bits, bool value)
|
||||
{
|
||||
if (value)
|
||||
return regmap_set_bits(map, reg, bits);
|
||||
else
|
||||
return regmap_clear_bits(map, reg, bits);
|
||||
}
|
||||
|
||||
int regmap_test_bits(struct regmap *map, unsigned int reg, unsigned int bits);
|
||||
|
||||
/**
|
||||
@ -1803,6 +1812,13 @@ static inline int regmap_clear_bits(struct regmap *map,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int regmap_assign_bits(struct regmap *map, unsigned int reg,
|
||||
unsigned int bits, bool value)
|
||||
{
|
||||
WARN_ONCE(1, "regmap API is disabled");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int regmap_test_bits(struct regmap *map,
|
||||
unsigned int reg, unsigned int bits)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user