From patchwork Fri Jun 3 05:28:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69221 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp90795qgf; Thu, 2 Jun 2016 22:29:46 -0700 (PDT) X-Received: by 10.98.12.143 with SMTP id 15mr3668472pfm.12.1464931785693; Thu, 02 Jun 2016 22:29:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r82si5213253pfa.197.2016.06.02.22.29.45; Thu, 02 Jun 2016 22:29:45 -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=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752020AbcFCF3c (ORCPT + 31 others); Fri, 3 Jun 2016 01:29:32 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:33579 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbcFCF33 (ORCPT ); Fri, 3 Jun 2016 01:29:29 -0400 Received: by mail-pf0-f178.google.com with SMTP id b124so39879033pfb.0 for ; Thu, 02 Jun 2016 22:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=ovVlAc/4xsfFz80lVgIdp50ydrSr/oze/d00SKuYSFI=; b=FwBp8JcjUEfnuNVtcpLT3SlffkujoYRyrNpw4Py0iknL6bGTpEwi+qTMr99/GOqSaz sDrDLhLOgJGvR4D5NKC91OBzJlVNd7jX57HtdQ7Ml7wfmBqD+32HJYcJdTguZ6jaOQVE ytWTeFLnQAZCAr9H06RlT2AWfMmVZtMqnAFn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ovVlAc/4xsfFz80lVgIdp50ydrSr/oze/d00SKuYSFI=; b=KrkAGB3TFkw1SbJCMKXDurV26VNPFLCz2h6Iqr4iQoL7XRoTfKYmJiOYdyws54swFV DRW+/8Q/YgQrHU5BVp6aR2THSsI79qQSI9KVVpG+oVEokm4h2y2RVQCAFjqwgC0cclFH 5otVmnlaKxXJdrHIhzpcpFRC7ENs4Y+XSev/a0+59VR9oJZGpxPWkH1lMC38g+8Hx5Z1 BYrLOjc/o/SPuCEuUyTLbDWwrdGV4u+zl2eP0hnAlKo4nHFD9IcUIPGVCroIvetU0iOh nRe4I64mkfQs5HCm6FfKQNWEfioSEVi6+c5sA4yzuOls39RXFI16961VO+GSd4QAbo50 nYzw== X-Gm-Message-State: ALyK8tJEBtP0xVyNxXY3/QoanAum4p1eqvZ7HThWgrWFWlGd/G0BujSXAueGBDV6hW4unsEt X-Received: by 10.98.97.71 with SMTP id v68mr3626316pfb.138.1464931768364; Thu, 02 Jun 2016 22:29:28 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id a19sm4723453pfc.57.2016.06.02.22.29.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 22:29:27 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Sekhar Nori Subject: [PATCH V3 8/8] cpufreq: davinci: Reuse cpufreq_generic_frequency_table_verify() Date: Fri, 3 Jun 2016 10:58:52 +0530 Message-Id: <61f2d54a1921509ad38e0ea69cc06af6cacb4c0a.1464931080.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org policy->freq_table will always be valid for this platform, otherwise driver's probe() would fail. And so this routine will *always* return after calling cpufreq_frequency_table_verify(). This can be done using the generic callback provided by core, lets use it instead. Cc: Sekhar Nori Signed-off-by: Viresh Kumar --- drivers/cpufreq/davinci-cpufreq.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index 7e336d20c184..b95a872800ec 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c @@ -38,26 +38,6 @@ struct davinci_cpufreq { }; static struct davinci_cpufreq cpufreq; -static int davinci_verify_speed(struct cpufreq_policy *policy) -{ - struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; - struct cpufreq_frequency_table *freq_table = pdata->freq_table; - struct clk *armclk = cpufreq.armclk; - - if (freq_table) - return cpufreq_frequency_table_verify(policy, freq_table); - - if (policy->cpu) - return -EINVAL; - - cpufreq_verify_within_cpu_limits(policy); - policy->min = clk_round_rate(armclk, policy->min * 1000) / 1000; - policy->max = clk_round_rate(armclk, policy->max * 1000) / 1000; - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, - policy->cpuinfo.max_freq); - return 0; -} - static int davinci_target(struct cpufreq_policy *policy, unsigned int idx) { struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; @@ -121,7 +101,7 @@ static int davinci_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver davinci_driver = { .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, - .verify = davinci_verify_speed, + .verify = cpufreq_generic_frequency_table_verify, .target_index = davinci_target, .get = cpufreq_generic_get, .init = davinci_cpu_init,