From patchwork Tue Sep 23 18:44:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 4959011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E98B19F3DF for ; Tue, 23 Sep 2014 18:48:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ACC2F20259 for ; Tue, 23 Sep 2014 18:48:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7ED102015A for ; Tue, 23 Sep 2014 18:48:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XWV6M-0005aZ-Ss; Tue, 23 Sep 2014 18:46:14 +0000 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XWV5R-0003ak-8z for linux-arm-kernel@lists.infradead.org; Tue, 23 Sep 2014 18:45:17 +0000 Received: by mail-wg0-f43.google.com with SMTP id y10so5176965wgg.26 for ; Tue, 23 Sep 2014 11:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=YCf3vZVZYxmU6hTKUE21IcNh6sMLYqCoqxa9R6K7FBY=; b=fzHk6rs2tEe3twmtNfOpJ1Tq4DhpgamOQ056PStgcBSK+W+Vs0liBUC22xKXwUJR8g MB3VFb/G2YpAus++abG6DDfxyzillGMY3j9s9vatiU9MtNj2gaS1E+1QqoNfzLwoCMnX Lk1YDBscgSTvc7rbLvkQh09GefIBDRWzOCEkhBOr+TnlfHUQTsEsN17KfF132U4Ac3uV emxkCmsVQzHp8btG9c4LYM3SaQEYBE96AjMJ4/fzefds/CyQNymoVOcS4zT28YxAnptJ hlLm85pWrqPV2nJ2u5MsLbRbuzr3HWdWT+o8MIVSXK9aJg13IkSMoziATHYCeSWE6piH jO0A== X-Received: by 10.194.185.112 with SMTP id fb16mr1382060wjc.91.1411497895326; Tue, 23 Sep 2014 11:44:55 -0700 (PDT) Received: from cizrna.lan (37-48-33-192.tmcz.cz. [37.48.33.192]) by mx.google.com with ESMTPSA id pn5sm16871650wjc.4.2014.09.23.11.44.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2014 11:44:53 -0700 (PDT) From: Tomeu Vizoso To: Mike Turquette Subject: [PATCH v13 8/9] clk: Take the prepare lock when updating the per-user constraints Date: Tue, 23 Sep 2014 20:44:16 +0200 Message-Id: <1411497857-24726-6-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411497857-24726-1-git-send-email-tomeu.vizoso@collabora.com> References: <1411497613-24049-1-git-send-email-tomeu.vizoso@collabora.com> <1411497857-24726-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140923_114517_482470_1EFDBCC1 X-CRM114-Status: GOOD ( 11.05 ) X-Spam-Score: -0.7 (/) Cc: Russell King , Tomeu Vizoso , Stephen Warren , Peter De Schrijver , linux-kernel@vger.kernel.org, tomasz.figa@gmail.com, rabin@rab.in, Thierry Reding , Javier Martinez Canillas , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tomeu Vizoso --- drivers/clk/clk.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 3eb133c..c507548 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1778,15 +1778,25 @@ EXPORT_SYMBOL_GPL(clk_set_rate); int clk_set_floor_rate(struct clk *clk_user, unsigned long rate) { struct clk_core *clk = clk_to_clk_core(clk_user); + int ret; + + clk_prepare_lock(); clk_user->floor_constraint = rate; - return clk_provider_set_rate(clk, clk_provider_get_rate(clk)); + ret = clk_provider_set_rate(clk, clk_provider_get_rate(clk)); + + clk_prepare_unlock(); + + return ret; } EXPORT_SYMBOL_GPL(clk_set_floor_rate); int clk_set_ceiling_rate(struct clk *clk_user, unsigned long rate) { struct clk_core *clk = clk_to_clk_core(clk_user); + int ret; + + clk_prepare_lock(); WARN(rate > 0 && rate < clk_user->floor_constraint, "clk %s dev %s con %s: new ceiling %lu lower than existing floor %lu\n", @@ -1794,7 +1804,11 @@ int clk_set_ceiling_rate(struct clk *clk_user, unsigned long rate) clk_user->floor_constraint); clk_user->ceiling_constraint = rate; - return clk_provider_set_rate(clk, clk_provider_get_rate(clk)); + ret = clk_provider_set_rate(clk, clk_provider_get_rate(clk)); + + clk_prepare_unlock(); + + return ret; } EXPORT_SYMBOL_GPL(clk_set_ceiling_rate);