Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752634AbeAJVks (ORCPT + 1 other); Wed, 10 Jan 2018 16:40:48 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51806 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbeAJVkp (ORCPT ); Wed, 10 Jan 2018 16:40:45 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A08EE601A0 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sboyd@codeaurora.org Date: Wed, 10 Jan 2018 13:40:44 -0800 From: Stephen Boyd To: David Lechner Cc: linux-clk@vger.kernel.org, Michael Turquette , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] clk: fix reentrancy of clk_enable() on UP systems Message-ID: <20180110214044.GD28313@codeaurora.org> References: <1515116768-17089-1-git-send-email-david@lechnology.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1515116768-17089-1-git-send-email-david@lechnology.com> 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 Return-Path: On 01/04, David Lechner wrote: > Reentrant calls to clk_enable() are not working on UP systems. This is > caused by the fact spin_trylock_irqsave() always returns true when > CONFIG_SMP=n (and CONFIG_DEBUG_SPINLOCK=n) which causes the reference > counting to not work correctly when clk_enable_lock() is called twice > before clk_enable_unlock() is called (this happens when clk_enable() > is called from within another clk_enable()). > > This fixes the problem by skipping the call to spin_trylock_irqsave() on UP > systems and relying solely on reference counting. We also make sure to set > flags in this case so that we are not returning an uninitialized value. > > Suggested-by: Stephen Boyd > Signed-off-by: David Lechner > --- Applied to clk-next -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project