From patchwork Mon Jun 12 19:44:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9782693 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 7D88E602DA for ; Mon, 12 Jun 2017 19:45:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E16827F86 for ; Mon, 12 Jun 2017 19:45:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62CE12860D; Mon, 12 Jun 2017 19:45:26 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C482027F86 for ; Mon, 12 Jun 2017 19:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=97xHAzxtT8AgxfUe4JnYrqVJbBZqOhE0il92LUPwyi0=; b=NfkJ+3EWH4lF8iJB6E2raDHEVW raoKiA/K932aLOh1x3LB0rJQldnIjNX3313P55r89WDumEMetXlXybUjgxGVpiKlnfy+lk1sChaNx KNfhEny3aVMkCZSh7gowLN/c+w+6YtiyqiCGQSIxxbLe9Tt3gMLhECWC+yU5ob8udO9/JAfIiLdDn CBVvVW4E0qLBe1iMXzm6wd1THCh7s/xWpNlZecJ809lLAjSTkWvkvQH+KBoYnFgsOHc0lU4UnlT27 2tCA/YQ+6pFc9OXM+gTaht7zTLTocQQ+/KcYl8KPrV9IPhmIMul9oig7m+rx6QsSAV6VTH/faZMw+ Y4slvovw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKVH2-0004kH-KA; Mon, 12 Jun 2017 19:45:16 +0000 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKVGw-0003Qa-9W for linux-amlogic@lists.infradead.org; Mon, 12 Jun 2017 19:45:12 +0000 Received: by mail-wr0-x233.google.com with SMTP id v111so110849198wrc.3 for ; Mon, 12 Jun 2017 12:44:49 -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=suQj/aMmdAUwxdtpTIFTI+yks41cWqooqXiUopEF+DE=; b=cAC3wrKEfkVUJ1hi6nWtkG0siZ0/z8A1AmmFFk0A7R0pqP/b7t8Dhmt8QbQZYvfuOA 4llS7Y+bJ0nEa5V7c723UYLFm1csj84yIxl+HPthoAjy2MntW9ins4H8equMHwHxEJ0g vs9AjV723t45FqQyTY7c8oZEHcxrKhOVGmghkRMdt2xhDI+vtnN239wiPnW2SxMxGNsN NCNuOTvRBACk9/tOzqux0M7qpFH+A1By1gJMa6KvIj/eGb48UHHVyrilocCjoazuYUq+ XKmkSfofbDFslwxLkEvm4HCkknIYKEONZZeB6Vxgrro63wgvZmnyKAEitO2lmrpqQ0Vp sr/A== 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=suQj/aMmdAUwxdtpTIFTI+yks41cWqooqXiUopEF+DE=; b=DdROqEOdE6GnZS/3Rw6i3v9ajRDSpYtLJ2f6ICxrABo0yqb/IXtPnEBWGXNiB65kzB O9NGvspnzzaP1knLpHqwKIm6RC1tN4LmN75rb7G9iM6AyPP+xR2iFB1nTSyt2Fe3hFZV hsuxIbTB5cqA/60Jh58d36uAL/7KvlfQiMxwtuCWjicch+UQt3X2mOL5VMUg7fkk0/Wx LNf4RHG2PSEgbHdfvcEfNyItACiP9Aa/BV1wdBuWe7Ps6V8kOAk0xu/aJG6dehJLCfBE fOk/ppOcau8WCincpH1RY/om7ZitOJqo6eXYiAkSFH0Eu+ntaOuXWjBl6N1fvubQeHCm lxFQ== X-Gm-Message-State: AKS2vOx/V53iZK4Dfz2UU2YTwTM4iRqpfypi7ybJA9wv3PlrbEB7t3Jh P7ZPdNuw3HMt99E8 X-Received: by 10.223.139.211 with SMTP id w19mr375909wra.119.1497296688480; Mon, 12 Jun 2017 12:44:48 -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 70sm13250797wmu.28.2017.06.12.12.44.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2017 12:44:48 -0700 (PDT) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v3 02/10] clk: add clk_core_set_phase_nolock function Date: Mon, 12 Jun 2017 21:44:30 +0200 Message-Id: <20170612194438.12298-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170612194438.12298-1-jbrunet@baylibre.com> References: <20170612194438.12298-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170612_124510_487430_EE0C414E X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Kevin Hilman , Linus Walleij , Russell King , linux-amlogic@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.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..dceaf0ff23db 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(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;