From patchwork Tue Sep 9 14:06:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 4870011 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 2ACD6C0338 for ; Tue, 9 Sep 2014 14:10:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E15E920035 for ; Tue, 9 Sep 2014 14:10:39 +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 A68E820166 for ; Tue, 9 Sep 2014 14:10:38 +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 1XRM5r-0006bJ-9I; Tue, 09 Sep 2014 14:08:27 +0000 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XRM5G-00064T-EE for linux-arm-kernel@lists.infradead.org; Tue, 09 Sep 2014 14:07:50 +0000 Received: by mail-wi0-f181.google.com with SMTP id e4so4538551wiv.2 for ; Tue, 09 Sep 2014 07:07:28 -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=/UhBIcqvVu9Hk1tA728EuCAxrOEaDh+zsXytFF6fQRc=; b=0Q7DM0mW8BUsKt8L8OBAQaiy5GnC01bdTSSnfeMlfZrQCSM/6y7QWtj3W+9RmEPJ93 XkX+VEtclVBdfMCVcKKOKBiSaokq5FRqPyKrqaIWmvF+/uT+BAz6h15YUAZoEVgB3qA1 ERZo0IZDkVOgaw/YGsRTU7siQz+bl3JRpHAOM0OrjYlkTzAiQMqFJ/d5NR347m+QqG+I UrGk10hcnQux7aoSPrfZxCOOwoh2gQBXk3BSgli72fgPppgtUu7Qk8WP751UWzpAdZwg p8r2Zh0eGJEopCH/Egj1VzL9VYCaEEz1z8oZiDiYgioe4iWbrLH2rsq/xJmnZzWP1LYu yw3g== X-Received: by 10.194.7.231 with SMTP id m7mr5719559wja.70.1410271648506; Tue, 09 Sep 2014 07:07:28 -0700 (PDT) Received: from cizrna.lan (37-48-42-146.tmcz.cz. [37.48.42.146]) by mx.google.com with ESMTPSA id bt9sm15019977wjc.44.2014.09.09.07.07.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Sep 2014 07:07:27 -0700 (PDT) From: Tomeu Vizoso To: Mike Turquette Subject: [PATCH v10 8/9] clk: Take the prepare lock when updating the per-user constraints Date: Tue, 9 Sep 2014 16:06:51 +0200 Message-Id: <1410271612-27389-6-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1410271612-27389-1-git-send-email-tomeu.vizoso@collabora.com> References: <1410271329-26637-1-git-send-email-tomeu.vizoso@collabora.com> <1410271612-27389-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140909_070750_636302_86EF9694 X-CRM114-Status: GOOD ( 10.77 ) 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=-4.3 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 f283dcc..1ad8cb7 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);