From patchwork Sun Sep 24 20:00:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 114153 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1855377qgf; Sun, 24 Sep 2017 13:02:24 -0700 (PDT) X-Received: by 10.99.50.70 with SMTP id y67mr5339772pgy.291.1506283344900; Sun, 24 Sep 2017 13:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506283344; cv=none; d=google.com; s=arc-20160816; b=CtJU8VlbhF8chXBk6cctUM0T5bh1Lkhi6gp1IkAW5LFHJybDJJCTHR2/wwj+2SkkUh 8Q9S9OuadV6ZxphjrtLZxGkGIpY206gnbSE8y603GBb8tF+pCiBa0+eS96KGw60D+o3C 7+ZYyTe+oyZJAk55O1V7Z+M2rCrtK07nwSb0nF5YTvtY8v4uucf6LnlxCdVI8SPb0yDj 57s3/6sNh//we2JbtowKO+t5NKjnIH6a9NLJC9GxchQjPuUhz8gfVuHqkQEjSLgX6zFX WMy3d8EuMQ3MYMB35rXG81GIasNembzzuHN+JNtqDsYLFMejehA/d1C6gCUBXr4mH+V6 zhwg== 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=xjAYP0CK6vKJPEtTQHybVtFPqkV1q540d7q3mgd06n8=; b=XWbMHjRSzei/xMsCz/gVhKCETiciRz8LmDuLMEV0epLyE8TEphyOHqoAR9QzpggHsW VZ3E8zu1BtwnNL2tm7Xw4GhnFpWpBN+b+mzoKBkCxy3ZhR+NXQF+6y/+/kGtPxzfOtCt 89x1AREt8l88D5wl658ovpoHa5YM4kxKw4zllq4sFjAOTwkiaLsszqgqch3BZtuopDQI dO1bgIQqpHc0RzOdApAoDk5Taa8ge1oNWAxiqh50dIIwW4vsRpkwlTlL8QrvS1e8sNQj 51YFE83D+azIqq0yI1fm2zvgAzQ16prtvbUF4vFBNXwZY49h0slyhXH7CDNk5cOtWIHL /Jmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=L0DrMMhJ; 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 j89si2894585pfk.421.2017.09.24.13.02.24; Sun, 24 Sep 2017 13:02:24 -0700 (PDT) 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=L0DrMMhJ; 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 S1753163AbdIXUCV (ORCPT + 26 others); Sun, 24 Sep 2017 16:02:21 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:47323 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752893AbdIXUAl (ORCPT ); Sun, 24 Sep 2017 16:00:41 -0400 Received: by mail-wm0-f41.google.com with SMTP id r136so14357459wmf.2 for ; Sun, 24 Sep 2017 13:00:40 -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=xjAYP0CK6vKJPEtTQHybVtFPqkV1q540d7q3mgd06n8=; b=L0DrMMhJnPNDJ0DkG957VqRmbo9GB7HyO+DkKSUnm6oYvEGI9RG6lgP0jwD13CkJm+ ibIiY3r5MoOg9f183NysS9mFqx2ZPUOX3wdeCqAUUC1RCuhiJz9YWhnfT5L0sSaNF9FN nz2AoYIc+mYV4/+hjg2suSx+LgGgg5YBvoZKecPeWJ4y2W+cM7n17OJUtWIElnBJS65k c/dRApFmUWOiflB6XisUcx1hNdaKwjPtydpVRt/2L0btLWUFIg0sie/l2HipTAcs0SuI 5QAMg/T7qVhShq3+4Z2kctXzaI0KbAo0p3FCiUKoEMjiONMJEsdeAt7C5NWVST3xadct +FoA== 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=xjAYP0CK6vKJPEtTQHybVtFPqkV1q540d7q3mgd06n8=; b=BPfC6HP6MBW0jEzrX3RDOuung8Wy/ECiocJdAZazTBNGa1ZcUBLUX32gt3e77dxWXZ Y9g5tcYW5Q9jL/mT0VWwFtVkYeQwc+OBZW6XuqomjX9z5eN5bnrA/5A5kSsPqvTO7csc D0Vl8eig6EWWeu5HOnc+LMNlSeLMfa+CtnOZ8T3iWzFqTXtqkNleENvyLoESsEuPG482 FxiNOGV6N1SSzqMEgBjy2v5OK8151SWVN1I1rlpmUME8dVAjOt06xyv3RswK8MT3XDma aE7N0dHnMoQI/7wHR2F2m48FfUpEh6x2LyLuV6wAncnnnQoO1LRq3zJNE0+2Pb9ugf1R BHDA== X-Gm-Message-State: AHPjjUgGb0hsjSNdOjoLfcqhAAVuu94DGu9tKqso+NS81UGwChpi0O9u qzIqHQ0CR8P9UTKdK7pTyt+H2w== X-Google-Smtp-Source: AOwi7QDv0lTIaV9z1KMm4b3kBdFyRDiKK4sqkyhsst3WY+ZakgYJIGy9jDKl3afBamRWXi7Jii7Utg== X-Received: by 10.28.232.138 with SMTP id f10mr8004425wmi.130.1506283240172; Sun, 24 Sep 2017 13:00:40 -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 j5sm6786144wmg.8.2017.09.24.13.00.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Sep 2017 13:00:39 -0700 (PDT) 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 Subject: [PATCH v4 03/10] clk: add clk_core_set_phase_nolock function Date: Sun, 24 Sep 2017 22:00:23 +0200 Message-Id: <20170924200030.6227-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170924200030.6227-1-jbrunet@baylibre.com> References: <20170924200030.6227-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 Signed-off-by: Jerome Brunet --- drivers/clk/clk.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) -- 2.13.5 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 3518f251cfd5..0913688dacb0 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1875,6 +1875,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 @@ -1897,7 +1916,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; @@ -1908,17 +1927,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;