summaryrefslogtreecommitdiff
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-06-17 17:40:07 +0100
committerMark Brown <broonie@kernel.org>2015-06-17 17:40:07 +0100
commitd2b923ef7b0e549dabcef0ca4605e2c0e4058216 (patch)
tree0a150394eb1e1633467e5a00fb78274699bc364e /drivers/base/regmap
parent5934590796f244149638c914a2329cede7338e25 (diff)
parent921cc29473a0d7c109105c1876ddb432f4a4be7d (diff)
Merge remote-tracking branch 'regmap/fix/field' into regmap-linus
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/regmap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 9f7f78ede01b..1c76dcb502cf 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -945,11 +945,10 @@ EXPORT_SYMBOL_GPL(devm_regmap_init);
static void regmap_field_init(struct regmap_field *rm_field,
struct regmap *regmap, struct reg_field reg_field)
{
- int field_bits = reg_field.msb - reg_field.lsb + 1;
rm_field->regmap = regmap;
rm_field->reg = reg_field.reg;
rm_field->shift = reg_field.lsb;
- rm_field->mask = ((BIT(field_bits) - 1) << reg_field.lsb);
+ rm_field->mask = GENMASK(reg_field.msb, reg_field.lsb);
rm_field->id_size = reg_field.id_size;
rm_field->id_offset = reg_field.id_offset;
}