From patchwork Wed Jun 10 20:04:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 49729 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B87C9245D4 for ; Wed, 10 Jun 2015 20:05:16 +0000 (UTC) Received: by labby2 with SMTP id by2sf5190164lab.1 for ; Wed, 10 Jun 2015 13:05:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=TzeXNkwN2V8VHYmkruCAI1UCjuWeWZZw88BLOwQT1HM=; b=Dbr8D3f4bRm+Y4Ht1WoBq3fYdEWJnM4Ly6nfEPNEM5PIXnBI3hvpNbTa+olmj6tFoS TCpHHvJIn/g/g6UPvC6spPL2zM8p6sak1GFs/sQ8yFUH3Ce4rA7HXUFYLIsmPNPRV9j/ cQ3dqhc6xHfOaMv/aNdQNYp6I62SXtrkXrpPdmlwmI9HrHDR7jZV65J+VdktzBFX3ECL vkvhGpb5GKMTjKB14NinSMJhG8r5WGMoIFWVH/DvRHRNspVFe8fJc+k5TCJzspRnJagr PccwAkenbVes+vwalrAHkSRc1/H47PC9nNYfMGEmxs1VJW6spz6lN6YCO8F+/hUM/aIv 0i9w== X-Gm-Message-State: ALoCoQnEiHRUFvoD0obpmQvgoUxMj2LVS846FA1FGvHk4EPMJNvwwLXKUpjc8BF3R/LC7Yi81sQo X-Received: by 10.152.19.161 with SMTP id g1mr4471457lae.8.1433966715307; Wed, 10 Jun 2015 13:05:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.162 with SMTP id g2ls304355lae.80.gmail; Wed, 10 Jun 2015 13:05:15 -0700 (PDT) X-Received: by 10.112.97.194 with SMTP id ec2mr5893097lbb.88.1433966715166; Wed, 10 Jun 2015 13:05:15 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id jo14si9913423lab.155.2015.06.10.13.05.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jun 2015 13:05:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by labpy14 with SMTP id py14so40214571lab.0 for ; Wed, 10 Jun 2015 13:05:15 -0700 (PDT) X-Received: by 10.112.220.7 with SMTP id ps7mr5822697lbc.72.1433966715075; Wed, 10 Jun 2015 13:05:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3557246lbb; Wed, 10 Jun 2015 13:05:14 -0700 (PDT) X-Received: by 10.180.149.173 with SMTP id ub13mr11919578wib.23.1433966714387; Wed, 10 Jun 2015 13:05:14 -0700 (PDT) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com. [74.125.82.43]) by mx.google.com with ESMTPS id kw8si19969885wjb.181.2015.06.10.13.05.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jun 2015 13:05:14 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.43 as permitted sender) client-ip=74.125.82.43; Received: by wgme6 with SMTP id e6so43223153wgm.2 for ; Wed, 10 Jun 2015 13:05:14 -0700 (PDT) X-Received: by 10.194.76.73 with SMTP id i9mr9333596wjw.149.1433966714023; Wed, 10 Jun 2015 13:05:14 -0700 (PDT) Received: from scallop.lan (cpc4-aztw19-0-0-cust71.18-1.cable.virginm.net. [82.33.25.72]) by mx.google.com with ESMTPSA id g15sm9461528wiv.22.2015.06.10.13.05.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jun 2015 13:05:12 -0700 (PDT) From: Daniel Thompson To: Mike Turquette , Stephen Boyd Cc: Daniel Thompson , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org Subject: [PATCH] clk: fixed: Add comment to clk_fixed_set_rate Date: Wed, 10 Jun 2015 21:04:54 +0100 Message-Id: <1433966694-23559-1-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.4.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@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.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently it is not made explicit why clk_fixed_set_rate() can ignore its arguments and unconditionally return success. Add a comment to explain this. We also mark the clk_ops table const since it should never be modified at runtime. Suggested-by: Stephen Boyd Signed-off-by: Daniel Thompson --- Notes: Changes here emerged from Stephen Boyd's code review of (partiall) borrowed code. This patch applies his review comments to the original code. drivers/clk/clk-fixed-factor.c | 8 +++++++- include/linux/clk-provider.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) -- 2.4.2 diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index e186db2..fccabe4 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -55,10 +55,16 @@ static long clk_factor_round_rate(struct clk_hw *hw, unsigned long rate, static int clk_factor_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { + /* + * We must report success but we can do so unconditionally because + * clk_factor_round_rate returns values that ensure this call is a + * nop. + */ + return 0; } -struct clk_ops clk_fixed_factor_ops = { +const struct clk_ops clk_fixed_factor_ops = { .round_rate = clk_factor_round_rate, .set_rate = clk_factor_set_rate, .recalc_rate = clk_factor_recalc_rate, diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 6d55c31..1af9579 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -459,7 +459,7 @@ struct clk_fixed_factor { unsigned int div; }; -extern struct clk_ops clk_fixed_factor_ops; +extern const struct clk_ops clk_fixed_factor_ops; struct clk *clk_register_fixed_factor(struct device *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div);