From patchwork Thu May 18 16:37:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9734779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6AC3A601C8 for ; Thu, 18 May 2017 16:38:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5902C285EC for ; Thu, 18 May 2017 16:38:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DA2C28833; Thu, 18 May 2017 16:38:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9947285EC for ; Thu, 18 May 2017 16:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754455AbdERQiM (ORCPT ); Thu, 18 May 2017 12:38:12 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:35232 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755272AbdERQiL (ORCPT ); Thu, 18 May 2017 12:38:11 -0400 Received: by mail-wr0-f176.google.com with SMTP id z52so39796480wrc.2 for ; Thu, 18 May 2017 09:38:10 -0700 (PDT) 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=qRER8akolsR838uxi2ZpYKUK1mYMGjQ6Q7JSj0WVZLU=; b=zeJkvGpoU9CVTYRDtXw6Gy8R+EakhGA0ozd7/KZ9vBzGPk4tzcup0jbwGlDPYVT8DD Tv/TAU9Z2jUxKQjubUi6yoA6vJjZqCNKR5yftazI6xjwu3Ndd2kc0U25SiPzkQthavSa VioqKo/malDxqrh8MeIJhecaC+zj/KpWQxgu8deNTXv7wWVqk1D3LMDgi9F5coZiXgUg Mhz2pieNdWk1FujYBhGaau5aweHwzb245WEg2m1s/Vcs8a07k1/coD8mLbkBUiLFBp9i LeHL/TTkaBpkseLH3YxTbHl2/+ePhX6eJUx9QKuzNVYWc3J+MIlacL9cBius/jNHQRqk B1bg== 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=qRER8akolsR838uxi2ZpYKUK1mYMGjQ6Q7JSj0WVZLU=; b=A1ZsLf5GRxMw0UQ4WVyNggDu4a+2cPe2IVMZsRg0A1sEXia84CEGQFdcWOWGPFeEpl +8qOTZgP0u6b2q1jGQNh03y3YWAu19ClST3eE3JiCPwR/y0CCzQAkwDJ+faZk88B85ml AnFVhFQpPzzZMUUSuN2r7kDhkWei2vzohkzgKjBIJuBN1V6lht+7OkSG5c1NqHOMwkTn WkUIlv3JRYumSTQdSBqyMETqwzpT4ffINCEdVoMN5dHGOBg60dSzNZcG9vSKnTr8v5WV L/5VniNRTZu9b0HXLOuv6OBAsYHmKbPx6mRB50ReUuwoMiO1pWUbk3SJ9xOaCsVH3LKJ MncQ== X-Gm-Message-State: AODbwcDxl6gUwEn3JsmwasRrZV/1AcmA2mHSlF6RvbFTLaISZReBGm9H c/VQhekDoao6y5CT X-Received: by 10.223.135.90 with SMTP id 26mr3207874wrz.199.1495125489781; Thu, 18 May 2017 09:38:09 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 4sm7357655wrv.33.2017.05.18.09.38.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 09:38:09 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Kevin Hilman Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 02/10] clk: add clk_core_set_phase_nolock function Date: Thu, 18 May 2017 18:37:56 +0200 Message-Id: <20170518163804.14123-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170518163804.14123-1-jbrunet@baylibre.com> References: <20170518163804.14123-1-jbrunet@baylibre.com> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Jerome Brunet --- drivers/clk/clk.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index f5c371532509..6031fada37f9 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1873,6 +1873,23 @@ 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; + + if (!core) + return 0; + + trace_clk_set_phase(clk->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 @@ -1895,7 +1912,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; @@ -1906,17 +1923,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;