From patchwork Mon Sep 22 14:15:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 4948071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E7EB8BEEA5 for ; Mon, 22 Sep 2014 14:19:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADEBB20121 for ; Mon, 22 Sep 2014 14:19:45 +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 73CED20125 for ; Mon, 22 Sep 2014 14:19:44 +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 1XW4Qw-0001kc-S7; Mon, 22 Sep 2014 14:17:42 +0000 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XW4Q8-0000mx-9v for linux-arm-kernel@lists.infradead.org; Mon, 22 Sep 2014 14:16:52 +0000 Received: by mail-wg0-f51.google.com with SMTP id m15so2801929wgh.10 for ; Mon, 22 Sep 2014 07:16:30 -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=78sM3u2v+S2fgzQm2Oyf8ARy/mq3v/2+x3zewzOdmsQ=; b=KQ908EEwm67ZqziYXQXlLdvuPS0IOt7AD6EfZAMxKNkyGnvOWMikl0iv5keCOKcbdH EskRkkajhyiHJxOn93lq+kPOUWsaeJFM6oV55v8LARUxzvoAMxNdDF1POz+lyTmOJKSS nuO7TwVwAU+G3toID4QSOEVn54uC141mLG7dv8Wo8vx8J5m/ZOEuw3yxjkdPkp7ukM1U /rcNj3nhkau2TXoH8Xq70SQ+1Q1jjVakqW56XpnhZ7DtuNyzwA3lzJqygRz75oTxamiG 45Tjp8qVAjaeGmJ/L0dsqpoEjOUEMa4qlQo9QXqshPbtswmV8EGXH1/KCEFedw9HUfFh wLmQ== X-Received: by 10.181.23.196 with SMTP id ic4mr15394901wid.69.1411395389968; Mon, 22 Sep 2014 07:16:29 -0700 (PDT) Received: from cizrna.lan (37-48-36-100.tmcz.cz. [37.48.36.100]) by mx.google.com with ESMTPSA id t9sm12442274wjf.41.2014.09.22.07.16.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Sep 2014 07:16:29 -0700 (PDT) From: Tomeu Vizoso To: Mike Turquette Subject: [PATCH v12 09/10] clk: Take the prepare lock when updating the per-user constraints Date: Mon, 22 Sep 2014 16:15:52 +0200 Message-Id: <1411395353-3189-6-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1411395353-3189-1-git-send-email-tomeu.vizoso@collabora.com> References: <1411395124-2476-1-git-send-email-tomeu.vizoso@collabora.com> <1411395353-3189-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140922_071652_526304_9830CB73 X-CRM114-Status: GOOD ( 11.04 ) X-Spam-Score: -0.7 (/) Cc: 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.8 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 17b6ba1..5d23ff3 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1734,15 +1734,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", @@ -1750,7 +1760,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);