From patchwork Fri May 13 08:00:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 9089171 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: X-Original-To: patchwork-linux-clk@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C5019F372 for ; Fri, 13 May 2016 08:00:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEA602010B for ; Fri, 13 May 2016 08:00:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 420F0201BC for ; Fri, 13 May 2016 08:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751770AbcEMIAf (ORCPT ); Fri, 13 May 2016 04:00:35 -0400 Received: from down.free-electrons.com ([37.187.137.238]:46312 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751531AbcEMIAf (ORCPT ); Fri, 13 May 2016 04:00:35 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id 12EE7486; Fri, 13 May 2016 10:00:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost (AMarseille-656-1-585-197.w90-37.abo.wanadoo.fr [90.37.14.197]) by mail.free-electrons.com (Postfix) with ESMTPSA id AE792B0; Fri, 13 May 2016 10:00:32 +0200 (CEST) From: Maxime Ripard To: Mike Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Maxime Ripard Subject: [PATCH] clk: fix critical clock locking Date: Fri, 13 May 2016 10:00:31 +0200 Message-Id: <1463126431-29071-1-git-send-email-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.8.2 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The critical clock handling in __clk_core_init isn't taking the enable lock before calling clk_core_enable, which in turns triggers the warning in the lockdep_assert_held call in that function when lockep is enabled. Add the calls to clk_enable_lock/unlock to make sure it doesn't happen. Fixes: 32b9b1096186 ("clk: Allow clocks to be marked as CRITICAL") Signed-off-by: Maxime Ripard Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner --- Changes from v1: - Removed the redundant prepare lock drivers/clk/clk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index ce39add5a258..d584004f7af7 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2404,8 +2404,13 @@ static int __clk_core_init(struct clk_core *core) core->ops->init(core->hw); if (core->flags & CLK_IS_CRITICAL) { + unsigned long flags; + clk_core_prepare(core); + + flags = clk_enable_lock(); clk_core_enable(core); + clk_enable_unlock(flags); } kref_init(&core->ref);