Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751903AbbEDRdW (ORCPT ); Mon, 4 May 2015 13:33:22 -0400 Received: from smtp-out-180.synserver.de ([212.40.185.180]:1058 "EHLO smtp-out-180.synserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbbEDRdE (ORCPT ); Mon, 4 May 2015 13:33:04 -0400 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 14231 Message-ID: <5547AD4D.4000007@metafoo.de> Date: Mon, 04 May 2015 19:33:01 +0200 From: Lars-Peter Clausen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Kevin Cernekee CC: Liam Girdwood , Mark Brown , dgreid@chromium.org, Andrew Bresticker , Olof Johansson , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V3 1/4] regmap: Use regcache_mark_dirty() to indicate power loss or reset References: <1430697619-22773-1-git-send-email-cernekee@chromium.org> <1430697619-22773-2-git-send-email-cernekee@chromium.org> <554713DD.4020006@metafoo.de> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1576 Lines: 37 On 05/04/2015 04:05 PM, Kevin Cernekee wrote: > On Sun, May 3, 2015 at 11:38 PM, Lars-Peter Clausen 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/