From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755324Ab1I2KZd (ORCPT ); Thu, 29 Sep 2011 06:25:33 -0400 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:57717 "EHLO opensource.wolfsonmicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752279Ab1I2KZc (ORCPT ); Thu, 29 Sep 2011 06:25:32 -0400 Date: Thu, 29 Sep 2011 11:25:30 +0100 From: Mark Brown To: Dimitris Papastamos Cc: linux-kernel@vger.kernel.org, Lars-Peter Clausen Subject: Re: [PATCH 8/8] regmap: Ensure we scream if we enable cache bypass/only at the same time Message-ID: <20110929102530.GJ3697@opensource.wolfsonmicro.com> References: <1317289153-21123-1-git-send-email-dp@opensource.wolfsonmicro.com> <1317289153-21123-8-git-send-email-dp@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1317289153-21123-8-git-send-email-dp@opensource.wolfsonmicro.com> X-Cookie: You will be misunderstood by everyone. User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 29, 2011 at 10:39:13AM +0100, Dimitris Papastamos wrote: > void regcache_cache_only(struct regmap *map, bool enable) > { > + BUG_ON(map->cache_bypass && enable); > mutex_lock(&map->lock); I'd move these inside the lock otherwise there's an enable/enable race where two threads check that things are safe simultaneously. I'd also change to WARN_ON(), if nothing else it's hard to see BUG_ON()s that occur prior to console output and PMICs are likely to trigger that sort of stuff.