From patchwork Tue Jul 1 20:46:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 32936 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5FF0E203C0 for ; Tue, 1 Jul 2014 20:48:34 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id il7sf22546603vcb.8 for ; Tue, 01 Jul 2014 13:48:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:to:from:in-reply-to :references:message-id:user-agent:subject:date:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=vSXGTwGYW8wC5IKzTAOw8HfX2pp4hGCWSjxrWcA2Cj0=; b=gKfev5pg0PvpG2qsd1jzTOBglbL/EpNl7gW5gu+wpTzaPE4p31sCN2d0AnxgC05SbR ABhSw+cqki9mBe5v9D9usjxnT5t5WgTz4NdB4ObRWA5Lpgn9GazzPwf+vpLu2D1YFn/a WdrJRt2g3+FFOSq2hJHJuxoZAUzXyEzuuX+4h9O+7QqVxSXQYo2+ko+zOZG3ZOO0ndGH 3/5lsQiFwIVmoIcJpA3+eyz0UbOWvWWsNQ5rmGo9lsqsXSeiq84dck6whMdlNn9W0l5q EPoqcN8nOdGFa4wdfUG4dZUswqzOzKhqWVnFOz+//g9wUjgjHYyM8cmHvbqbn8rtKNdH QlIw== X-Gm-Message-State: ALoCoQkk/BBK5RaECyp31pNfulevqAiJoUX0oB6Is0Z5mr7uaDqigweIuEItgVvf1AXOYGND5SOp X-Received: by 10.58.94.166 with SMTP id dd6mr27013251veb.12.1404247713921; Tue, 01 Jul 2014 13:48:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.139 with SMTP id f11ls2287140qgf.87.gmail; Tue, 01 Jul 2014 13:48:33 -0700 (PDT) X-Received: by 10.220.92.193 with SMTP id s1mr2500773vcm.34.1404247713763; Tue, 01 Jul 2014 13:48:33 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id lo19si11900685vdb.15.2014.07.01.13.48.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Jul 2014 13:48:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id lf12so9422286vcb.4 for ; Tue, 01 Jul 2014 13:48:33 -0700 (PDT) X-Received: by 10.220.251.134 with SMTP id ms6mr26657783vcb.10.1404247713639; Tue, 01 Jul 2014 13:48:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp244012vcb; Tue, 1 Jul 2014 13:48:33 -0700 (PDT) X-Received: by 10.69.18.97 with SMTP id gl1mr47579352pbd.78.1404247712809; Tue, 01 Jul 2014 13:48:32 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id hr7si16926314pac.109.2014.07.01.13.48.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jul 2014 13:48:32 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X24xb-0004UM-Pq; Tue, 01 Jul 2014 20:47:27 +0000 Received: from mail-pa0-f52.google.com ([209.85.220.52]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X24xZ-0004Ql-5O for linux-arm-kernel@lists.infradead.org; Tue, 01 Jul 2014 20:47:26 +0000 Received: by mail-pa0-f52.google.com with SMTP id eu11so11236165pac.11 for ; Tue, 01 Jul 2014 13:47:03 -0700 (PDT) X-Received: by 10.68.97.129 with SMTP id ea1mr64538902pbb.73.1404247623788; Tue, 01 Jul 2014 13:47:03 -0700 (PDT) Received: from localhost ([2601:9:5900:1fe:ca60:ff:fe0a:8a36]) by mx.google.com with ESMTPSA id ee5sm34022777pbc.47.2014.07.01.13.47.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 01 Jul 2014 13:47:02 -0700 (PDT) MIME-Version: 1.0 To: =?utf-8?q?Heiko_St=C3=BCbner?= , From: Mike Turquette In-Reply-To: <3089033.Y3HT2Lq8qX@diego> References: <1808429.dNxms7FR7U@diego> <3089033.Y3HT2Lq8qX@diego> Message-ID: <20140701204650.32686.12713@quantum> User-Agent: alot/0.3.5 Subject: Re: [PATCH v4 02/13] clk: composite: allow read-only clocks Date: Tue, 01 Jul 2014 13:46:50 -0700 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140701_134725_229571_B6572F46 X-CRM114-Status: GOOD ( 16.27 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.52 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.52 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Max Schwarz , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mturquette@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Quoting Heiko Stübner (2014-06-22 13:43:35) > This allows readl-only composite clocks by making mux_ops->set_parent and > divider_ops->round_rate/set_rate optional. > > Signed-off-by: Heiko Stuebner > --- > drivers/clk/clk-composite.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c > index 0a4cd21..046d3f6 100644 > --- a/drivers/clk/clk-composite.c > +++ b/drivers/clk/clk-composite.c > @@ -210,7 +210,7 @@ struct clk *clk_register_composite(struct device *dev, const char *name, > clk_composite_ops = &composite->ops; > > if (mux_hw && mux_ops) { > - if (!mux_ops->get_parent || !mux_ops->set_parent) { > + if (!mux_ops->get_parent) { > clk = ERR_PTR(-EINVAL); > goto err; > } > @@ -218,7 +218,8 @@ struct clk *clk_register_composite(struct device *dev, const char *name, > composite->mux_hw = mux_hw; > composite->mux_ops = mux_ops; > clk_composite_ops->get_parent = clk_composite_get_parent; > - clk_composite_ops->set_parent = clk_composite_set_parent; > + if (mux_ops->set_parent) > + clk_composite_ops->set_parent = clk_composite_set_parent; > if (mux_ops->determine_rate) > clk_composite_ops->determine_rate = clk_composite_determine_rate; > } > @@ -235,10 +236,6 @@ struct clk *clk_register_composite(struct device *dev, const char *name, > if (rate_ops->set_rate) { > clk_composite_ops->set_rate = clk_composite_set_rate; > } > - } else { > - WARN(rate_ops->set_rate, > - "%s: missing round_rate op is required\n", > - __func__); Getting rid of this WARN isn't such a great solution. How about rolling in the following cleanup? >From 03a08d7e746aedc6ce99228d629752f241383e7f Mon Sep 17 00:00:00 2001 From: Mike Turquette Date: Tue, 1 Jul 2014 12:11:38 -0700 Subject: [PATCH] clk: composite: improve rate_hw sanity check logic The function pointer population and sanity checking logic got a bit ugly with the advent of the .determine_rate callback. Clean it up. Signed-off-by: Mike Turquette --- drivers/clk/clk-composite.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index faf7c32..bdf4f2b 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -226,21 +226,27 @@ struct clk *clk_register_composite(struct device *dev, const char *name, clk = ERR_PTR(-EINVAL); goto err; } + clk_composite_ops->recalc_rate = clk_composite_recalc_rate; - /* .round_rate is a prerequisite for .set_rate */ - if (rate_ops->round_rate) { - clk_composite_ops->round_rate = clk_composite_round_rate; - if (rate_ops->set_rate) { - clk_composite_ops->set_rate = clk_composite_set_rate; - } + if (rate_ops->determine_rate) + clk_composite_ops->determine_rate = + clk_composite_determine_rate; + else if (rate_ops->round_rate) + clk_composite_ops->round_rate = + clk_composite_round_rate; + + /* .set_rate requires either .round_rate or .determine_rate */ + if (rate_ops->set_rate) { + if (rate_ops->determine_rate || rate_ops->round_rate) + clk_composite_ops->set_rate = + clk_composite_set_rate; + else + WARN(1, "%s: missing round_rate op is required\n", + __func__); } composite->rate_hw = rate_hw; composite->rate_ops = rate_ops; - clk_composite_ops->recalc_rate = clk_composite_recalc_rate; - if (rate_ops->determine_rate || - (rate_ops->round_rate && clk_composite_ops->set_parent)) - clk_composite_ops->determine_rate = clk_composite_determine_rate; } if (gate_hw && gate_ops) {