From patchwork Wed Jul 2 23:58:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 33008 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 15ED920672 for ; Wed, 2 Jul 2014 23:58:29 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kq14sf62282227pab.8 for ; Wed, 02 Jul 2014 16:58:29 -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:from:to:subject:date:message-id :user-agent:in-reply-to:references:mime-version: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=vGH9WGi1wY1UV7MPEYPGSgabxe9bxT0KLUdzXwpDBSU=; b=AJATLeexeD63YrebQPlVaPx7VJL8fUcZ3qxwIXdqiMXe3/n3dmAYGWCs9OMl9KPKp6 F3tddlK2frv+GB+DojWPIeBbgd33NJ1h8zcc+dK+wORM6WSxYYbb/s3xJ4KSk42hQLsB z0+VihZPxR0W1Uv0gvgn2JnNSMoDYPe/oj4zj0+hnNQw9fmVXeeS/a2JgAbQE+KmDphP KHZxB88mdN/GEgxSW9WFnyv1T46auEFdvTXkwsWU9a8KQlvywohYL8dSktn7SWdpHDEh +GdjasoE9Da1dbduIDwkXq6JowMAPFTfTElsJnmzUx3IRp0WFoq0qACM39hYKZZCVxSS R55g== X-Gm-Message-State: ALoCoQlTS6Ziwxh4quI3qpTuuW0vjkjKDOxR1S1gP9Pp/mMBK2/lHAWBsLEp0Ucohpnp3/uaXcVH X-Received: by 10.67.4.35 with SMTP id cb3mr631466pad.15.1404345509316; Wed, 02 Jul 2014 16:58:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.107 with SMTP id h98ls284596qge.68.gmail; Wed, 02 Jul 2014 16:58:29 -0700 (PDT) X-Received: by 10.58.247.167 with SMTP id yf7mr113282vec.46.1404345509166; Wed, 02 Jul 2014 16:58:29 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id ne10si13550429veb.55.2014.07.02.16.58.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Jul 2014 16:58:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jx11so12229124veb.34 for ; Wed, 02 Jul 2014 16:58:28 -0700 (PDT) X-Received: by 10.58.210.168 with SMTP id mv8mr731288vec.12.1404345508735; Wed, 02 Jul 2014 16:58:28 -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 tc5csp331193vcb; Wed, 2 Jul 2014 16:58:28 -0700 (PDT) X-Received: by 10.66.132.81 with SMTP id os17mr924573pab.137.1404345507825; Wed, 02 Jul 2014 16:58:27 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ot9si31503661pac.53.2014.07.02.16.58.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Jul 2014 16:58:27 -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 1X2UOn-0001cJ-P5; Wed, 02 Jul 2014 23:57:13 +0000 Received: from gloria.sntech.de ([95.129.55.99]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X2UOk-0001U3-Fw for linux-arm-kernel@lists.infradead.org; Wed, 02 Jul 2014 23:57:11 +0000 Received: from ip9234425c.dynamic.kabel-deutschland.de ([146.52.66.92] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1X2UOO-0003WG-GH; Thu, 03 Jul 2014 01:56:48 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Mike Turquette Subject: [PATCH v5 03/14] clk: composite: improve rate_hw sanity check logic Date: Thu, 03 Jul 2014 01:58:14 +0200 Message-ID: <2694753.hNjIfgCHO5@diego> User-Agent: KMail/4.11.5 (Linux/3.13-1-amd64; KDE/4.11.3; x86_64; ; ) In-Reply-To: <156042792.J76K6jxIGl@diego> References: <156042792.J76K6jxIGl@diego> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140702_165710_693877_2B956AB4 X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: arm@kernel.org, linux-arm-kernel@lists.infradead.org, Max Schwarz 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: heiko@sntech.de X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 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 From: Mike Turquette 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..b9355da 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) {