lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 10 Jun 2013 10:15:39 +0100
From:	Mark Brown <broonie@...nel.org>
To:	Lars-Peter Clausen <lars@...afoo.de>
Cc:	Srinivas KANDAGATLA <srinivas.kandagatla@...com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC] regmap: Add regmap_field APIs

On Sun, Jun 09, 2013 at 06:00:19PM +0200, Lars-Peter Clausen wrote:

> > +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

However as an interface for registering either is OK - the current
MSB/LSB approach is probably better as that's what datasheets tend to
include (which is why I didn't say anything).

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ