From patchwork Fri Dec 1 21:51:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 120397 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1679696qgn; Fri, 1 Dec 2017 13:54:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMZqjtt7+HDb/j2jCHdjxcBVl/dfJxT1Hz+hJBXflDS81ZIl6a4zrvaQrmRkcd2dhcl4gXcE X-Received: by 10.99.123.21 with SMTP id w21mr7104211pgc.67.1512165247713; Fri, 01 Dec 2017 13:54:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512165247; cv=none; d=google.com; s=arc-20160816; b=mRe9ApyU/juVAt3Siqa7xaXO7jwjW52BbhytEzmE53M3uhRAqJjYT6mezAP/kvX09M OWuLduljcGhzKAHY3QUz/BcGpVPcl5t05MYjBz++vBKLWxvyqhMI88SLjegYUOBBkJzC e8PutYfulf1PJns9OVo3d8CFjEzCWQ8xHXH6wznWbU5qsgb9bOyF+nQ1lvV+svbD8Xrn NmUoO87RuCx1L0SW9am0KaxSR+huhVXn1/LWAvaGNKBiiuxD/arVNlm+hBzk1LVWe+xz drUU9VEpqU/+ED3+Nlpr1xILZDTQOoQLdfCsUwHPGc53Dz5KImIXfOsLWiyIqlJXjRpN toCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=tNPfVL6Tahd92psuj3PD1HLKZN+vrFb1bHg4SrV1els=; b=dr7JknlH1CfpDMTbhHoZ5e7hE/2DrWBALGlIeT+g4PF9T2svtQiRDzimMPD6//7Zcj eICjri0H9cv/opPeYgR6p9UrMfq89VOiwWrFQuyarjAhE+3LSkzYm4ysjMEMsuDveGA6 yGsz46TvFvu9LWoS1m2fnDOLIz8eiwia03LhAXS0gv5FpnwF4aGaI/MvQhRQ0Sbi2MAE 1t2TCq3773z2o0kbrzFmzZUcadqPliacuyOWNQR4SnmPC7Q3tMz+hK+oqyzhPntlm7CE NmJIU7dB1EXCj6Db2BLzNiIJqEAWEvKOZ3QPYYsn4FhekvcXkoCHpEvckJxMSzjTxSrG MQcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=vYoUz84W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h72si5828118pfj.20.2017.12.01.13.54.07; Fri, 01 Dec 2017 13:54:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=vYoUz84W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752143AbdLAVyF (ORCPT + 28 others); Fri, 1 Dec 2017 16:54:05 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:32858 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751039AbdLAVwM (ORCPT ); Fri, 1 Dec 2017 16:52:12 -0500 Received: by mail-wm0-f67.google.com with SMTP id g130so7165529wme.0 for ; Fri, 01 Dec 2017 13:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tNPfVL6Tahd92psuj3PD1HLKZN+vrFb1bHg4SrV1els=; b=vYoUz84W59DimV8dVCOj+8yNAtDyxwd7oHxxu9KgKZ/IlA74uX3qc1xwT4oX4GKSFZ CgmsG2iSy++1I9zaRBvG5nrDDz03dV4omLkL2A+v9BVST8Sk6ODZnaGyULCyP9xr24ls tpzuGEZQ4VdUc7qBuwGuxFxp0qluHHOhX+c5aZ0x0RP90M0N0DVFyA9+7z09nfe8nuWg BphAOe1MOBoNqx07hXG2gnNqjxBgvQLuOR1MQEShRXKs26QXHplCLhqVC4fd0gsSAn6l Cf0PsRPO3dfm3vofbbu4ZKg9cS5cavIJ+fAy8IfCFtpI/hdto9VNGh6O2sVelWDqyk7J WyEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tNPfVL6Tahd92psuj3PD1HLKZN+vrFb1bHg4SrV1els=; b=tbpd12d6DGrbAFJBdwI4CGZBW/t/bFKTBIKKbyYOdXdqLvDFYdm1oFj6NvEArWzGtO EOpprKrPvE/O6PSBmH+yszZ7Rt9QUobXzzFLUetcQ7YpufqFU/NmxlVp5ZDIEmqQJLMv mUJv5G0H+bOmkde+hracS+NTXxicZiW4P2d8HZLwtXYB0iu9JM0JIezuc7tllw1w+S9i Wxb/sySETDCFGusmm+dpd81JcVH4DVEBS3Ac++jWD1sHX0KaKSF4WvxwebTRB37rKV5T eeLjknSyAcE83cVzh6By88t71bd6tcLLJMJ9hH9Y9vU+4J+qsTWI7ifGuG27xYPtuhQG NC6A== X-Gm-Message-State: AJaThX5y+a91REfknC7AOCub/E8DnRlZv9X9gAt+LVP8EZzDFAADnAdP 0E9NM+H1wgnvcPs5E0gRpMD41g== X-Received: by 10.28.214.70 with SMTP id n67mr2124378wmg.83.1512165130955; Fri, 01 Dec 2017 13:52:10 -0800 (PST) Received: from localhost.localdomain (cag06-3-82-243-161-21.fbx.proxad.net. [82.243.161.21]) by smtp.googlemail.com with ESMTPSA id m134sm2078804wmg.6.2017.12.01.13.52.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Dec 2017 13:52:10 -0800 (PST) From: Jerome Brunet To: Stephen Boyd , Michael Turquette Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King , Linus Walleij , Quentin Schulz , Kevin Hilman , Maxime Ripard Subject: [PATCH v5 03/10] clk: add clk_core_set_phase_nolock function Date: Fri, 1 Dec 2017 22:51:53 +0100 Message-Id: <20171201215200.23523-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171201215200.23523-1-jbrunet@baylibre.com> References: <20171201215200.23523-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Create a core function for set_phase, as it is done for set_rate and set_parent. This rework is done to ease the integration of "protected" clock functionality. Acked-by: Linus Walleij Tested-by: Quentin Schulz Tested-by: Maxime Ripard Acked-by: Michael Turquette Signed-off-by: Jerome Brunet --- drivers/clk/clk.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) -- 2.14.3 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index e60b2a26b10b..7946a069ba2e 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1966,6 +1966,25 @@ int clk_set_parent(struct clk *clk, struct clk *parent) } EXPORT_SYMBOL_GPL(clk_set_parent); +static int clk_core_set_phase_nolock(struct clk_core *core, int degrees) +{ + int ret = -EINVAL; + + lockdep_assert_held(&prepare_lock); + + if (!core) + return 0; + + trace_clk_set_phase(core, degrees); + + if (core->ops->set_phase) + ret = core->ops->set_phase(core->hw, degrees); + + trace_clk_set_phase_complete(core, degrees); + + return ret; +} + /** * clk_set_phase - adjust the phase shift of a clock signal * @clk: clock signal source @@ -1988,7 +2007,7 @@ EXPORT_SYMBOL_GPL(clk_set_parent); */ int clk_set_phase(struct clk *clk, int degrees) { - int ret = -EINVAL; + int ret; if (!clk) return 0; @@ -1999,17 +2018,7 @@ int clk_set_phase(struct clk *clk, int degrees) degrees += 360; clk_prepare_lock(); - - trace_clk_set_phase(clk->core, degrees); - - if (clk->core->ops->set_phase) - ret = clk->core->ops->set_phase(clk->core->hw, degrees); - - trace_clk_set_phase_complete(clk->core, degrees); - - if (!ret) - clk->core->phase = degrees; - + ret = clk_core_set_phase_nolock(clk->core, degrees); clk_prepare_unlock(); return ret;