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:	Sat, 25 Apr 2015 12:32:35 +0100
From:	Mark Brown <broonie@...nel.org>
To:	Kevin Cernekee <cernekee@...omium.org>
Cc:	lgirdwood@...il.com, lars@...afoo.de, dgreid@...omium.org,
	abrestic@...omium.org, olofj@...omium.org,
	alsa-devel@...a-project.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 1/4] regmap: cache: Add "was_reset" argument to
 regcache_sync_region()

On Fri, Apr 24, 2015 at 03:36:45PM -0700, Kevin Cernekee wrote:

> index 116655d92269..ece122a6fdeb 100644
> --- a/include/linux/regmap.h
> +++ b/include/linux/regmap.h
> @@ -438,7 +438,7 @@ bool regmap_can_raw_write(struct regmap *map);
>  
>  int regcache_sync(struct regmap *map);
>  int regcache_sync_region(struct regmap *map, unsigned int min,
> -			 unsigned int max);
> +			 unsigned int max, bool was_reset);

This seems pretty ugly - both the fact that we're changing the signature
of the function and the naming of the argument feel inelegant.  The
point isn't if the device has been reset, the point is if the device
currently has the default register values or not, and this means that
the user is responsible for tracking that state until the next time it
does the sync.  That may be immediately like in your case but there's no
reason that has to be the case.  The fact that we're passing in
something called "is_reset" which sounds like a state value for the
register map is a bit of a warning sign here.

What we should be doing here is providing a way for users to tell regmap
if they've reset the register map and actually we already have that
interface, it's just not got the best name - regcache_mark_dirty() is
effectively it since there's really not a lot of other reasons why a
driver would need to mark the cache as dirty.  We're just not handling
it properly.  What we should do instead is to keep the interface as it
is for now and make it behave in a more expected fashion so that if the
cache is explicitly marked dirty we assume that the hardware is in the
default state and otherwise we don't.

Ideally what we'd do is both improve the naming of mark_dirty() (though
that's API churn which is nasty) and arrange for rbtree to cache the
default values lazily, that way the only things in the cache will be
things that have been explicitly changed (we will still want default
checking but it makes life easier and means we don't end up having to do
a full writeout for cases where things have been put into cache mode
without a reset).

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ