[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51B4A693.4080503@metafoo.de>
Date: Sun, 09 Jun 2013 18:00:19 +0200
From: Lars-Peter Clausen <lars@...afoo.de>
To: Srinivas KANDAGATLA <srinivas.kandagatla@...com>
CC: Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] regmap: Add regmap_field APIs
[...]
> +int regmap_field_write(struct regmap_field *field, unsigned int val)
> +{
> + int field_bits;
> + unsigned int reg_mask;
> + field_bits = field->msb - field->lsb + 1;
> + reg_mask = ((BIT(field_bits) - 1) << field->lsb);
> + return regmap_update_bits(field->regmap, field->reg,
> + reg_mask, val << field->lsb);
Considering that you'd do the same calculations over and over again it would
probably make more sense store the mask rather than the msb in the struct
> +}
> +EXPORT_SYMBOL_GPL(regmap_field_write);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists