From patchwork Thu Sep 11 14:26:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 4888351 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 6B4769F32F for ; Thu, 11 Sep 2014 14:30:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 381FD2026D for ; Thu, 11 Sep 2014 14:30:26 +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 98B42201EF for ; Thu, 11 Sep 2014 14:30:21 +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 1XS5MC-0002Dg-Lj; Thu, 11 Sep 2014 14:28:20 +0000 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XS5L8-0000mu-3B for linux-arm-kernel@lists.infradead.org; Thu, 11 Sep 2014 14:27:14 +0000 Received: by mail-wg0-f41.google.com with SMTP id k14so5263177wgh.0 for ; Thu, 11 Sep 2014 07:26:50 -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=r2/1H4iQ4RgcDx8aay080jYZpQYLr+0TvGyveUJjkltX3ghxm44WFCMYGJnqxaZN9T CX2j6RLRABPMkn5A6gxep8JyQ7dSX8FrRlRib1hhagsXDlhXnl9ecPAyMbSbOVDM5MaJ qvVgtkbNW8QRtr0t9SWOv+OfpQtljMxfnpGRJqCRx7SEM8AuymBdPFZsJq31UNG4XejT 07Y6U8pNB1piL4MjAfanwoNj5zxBPs4dtN1djo2GDufPSXIh25Nc5+ZTfHHz9d4m63Ho FuY0E3C3ugmeZULGbJCM3sWbhuTf9/BlfzTd9Uy7qph4ppP6AxP7hd2fdvFhno6Ndtoq 9uRg== X-Received: by 10.194.63.205 with SMTP id i13mr2033771wjs.74.1410445610665; Thu, 11 Sep 2014 07:26:50 -0700 (PDT) Received: from localhost.localdomain (37-48-42-23.tmcz.cz. [37.48.42.23]) by mx.google.com with ESMTPSA id ka3sm1421242wjc.3.2014.09.11.07.26.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Sep 2014 07:26:49 -0700 (PDT) From: Tomeu Vizoso To: Mike Turquette Subject: [PATCH v11 8/9] clk: Take the prepare lock when updating the per-user constraints Date: Thu, 11 Sep 2014 16:26:22 +0200 Message-Id: <1410445583-18626-6-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1410445583-18626-1-git-send-email-tomeu.vizoso@collabora.com> References: <1410445421-18362-1-git-send-email-tomeu.vizoso@collabora.com> <1410445583-18626-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140911_072714_335113_C479D63A 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);