lkml.org 
[lkml]   [2015]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3 1/4] regmap: Use regcache_mark_dirty() to indicate power loss or reset
On 05/04/2015 04:05 PM, Kevin Cernekee wrote:
> On Sun, May 3, 2015 at 11:38 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
>>> diff --git a/drivers/base/regmap/regcache.c
>>> b/drivers/base/regmap/regcache.c
>>> index 7eb7b3b98794..63af3103d0c6 100644
>>> --- a/drivers/base/regmap/regcache.c
>>> +++ b/drivers/base/regmap/regcache.c
>>> @@ -253,6 +253,9 @@ static int regcache_default_sync(struct regmap *map,
>>> unsigned int min,
>>> unsigned int max)
>>> {
>>> unsigned int reg;
>>> + bool no_sync_defaults = map->no_sync_defaults;
>>> +
>>> + map->no_sync_defaults = false;
>>
>>
>> This needs to be done at the end in regcache_sync(), the same place where
>> dirty is set to false.
>
> But map->cache_dirty means "any register is dirty," not "all registers
> are dirty." So it can only be cleared after a successful flush.
>
> If one of the writes fails and regcache_sync() has to return
> prematurely, we probably don't want no_sync_defaults to stay true
> because some of the HW registers might not match map->reg_defaults
> anymore.

Makes sense. But it should still be done in a central place rather than
repeating it in every sync implementation. You can still put it at the end
of regcache_sync(), just clear it regardless of whether it succeeded or not.



\
 
 \ /
  Last update: 2015-05-04 19:41    [W:0.033 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site