From patchwork Sun May 21 21:59:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9739457 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 05AA46034C for ; Sun, 21 May 2017 22:00:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EADCC285C9 for ; Sun, 21 May 2017 22:00:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9E2A285F3; Sun, 21 May 2017 22:00:16 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 89370285C9 for ; Sun, 21 May 2017 22:00:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752186AbdEUWAQ (ORCPT ); Sun, 21 May 2017 18:00:16 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:33165 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752119AbdEUWAP (ORCPT ); Sun, 21 May 2017 18:00:15 -0400 Received: by mail-wm0-f50.google.com with SMTP id m7so3305034wmg.0 for ; Sun, 21 May 2017 15:00:15 -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=ul0QKUjvCPGaQheX6p0VDp+xXtVBrmSHL5RDDKmpV91lwPqXgRtBtfTCyeSBfeSm/i 98G9heM/h2LCE+v82KOxDjFWKx9TeGD4hJFNZQ8j0lj0uLbc4dAWctixX1sYIh9+3fqF sN0YwnWbTi20A0s8clDcvKJtL8YoCHQVhC80MbPPBWONMLjDJtJy11jZWc5+t/31lkeY aB8kSZHSM+3KtCr42nhpIyZWP0ocYxp50ikTQItrPQp0NVROHsAyibfRfK7m/rvjiZlP QkyEi23OHljv4a6YIPp3Lv8E/8BvvEq4V7dD1VnEl+lO5OJQJm9KwDWzu22FqF8/O/cc D6wQ== 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=DOXw3wvqTkc1La74PR5PQMr2PXHHcgO2IL7IMQMM6HV6+j0G3+UakCFrGGX8qEBnQI YcwhFtzSUe7qh9a/4a0eu650AddlE8pmXKwv2Kk1ggrskezTAQDiN+xX/BKTQKE36+zx 97NHv41c41CWDMdSZgftEkiar7Cf+tawpSMkqqukhAFEByxKZl8t+cw1Vx42fOAjtfJT qFrpq1Req5ZbXIVHqbL9WEcIXFVN0DV4lx6NeHPkB2ATG3QpKTMbQ53uqhI3JzTZg+wa jDOKAuw4RIXVvveLlR8preqFCYFLzk7YNARmaPuL4MoaUEvamIMXEZDz7G1eBrn1rAlM MXPA== X-Gm-Message-State: AODbwcDkOgTS3o9YgzjBu3sXrjkYQcG54Ue6KNpKl9OZGkfzVTLTC8YZ WRZhEwl66vLT6dkV X-Received: by 10.223.154.226 with SMTP id a89mr9562261wrc.192.1495404014282; Sun, 21 May 2017 15:00:14 -0700 (PDT) Received: from localhost.localdomain (cag06-3-82-243-161-21.fbx.proxad.net. [82.243.161.21]) by smtp.googlemail.com with ESMTPSA id a73sm12812579wrc.58.2017.05.21.15.00.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 May 2017 15:00:13 -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, Linus Walleij , Boris Brezillon Subject: [PATCH v2 02/11] clk: add clk_core_set_phase_nolock function Date: Sun, 21 May 2017 23:59:49 +0200 Message-Id: <20170521215958.19743-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170521215958.19743-1-jbrunet@baylibre.com> References: <20170521215958.19743-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;