From patchwork Thu Jun 2 14:19:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69175 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp144038qgf; Thu, 2 Jun 2016 07:19:43 -0700 (PDT) X-Received: by 10.98.97.71 with SMTP id v68mr4929320pfb.127.1464877181325; Thu, 02 Jun 2016 07:19:41 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fl5si5132332pad.79.2016.06.02.07.19.40; Thu, 02 Jun 2016 07:19:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932864AbcFBOT2 (ORCPT + 14 others); Thu, 2 Jun 2016 10:19:28 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:33951 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932867AbcFBOT0 (ORCPT ); Thu, 2 Jun 2016 10:19:26 -0400 Received: by mail-pf0-f173.google.com with SMTP id 62so31937599pfd.1 for ; Thu, 02 Jun 2016 07:19:26 -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=YDu5k59mFgpYLEb41PjSzOmO48fShNhT6K+0E6HTd6CMAzNcrWGj84ENNT2ivcAsJd 8UDcJ3zR3SAA5GKl/rAx25eqzNl9VIZhmDFtfJ/G3/ZHkTMcSbCYDBCLu6xARFP9G80j ZbyeQms7x2B8IV2qxCn7QHY/LfkDEG5PsIGUg= 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=WTOx+lS8uoXLKe4romAfKKDuUFwnajfqlVNv27ydrKDUaszGE4+tkuv2mF7Z+jyWcK cM2LRw8AGjWAZxEDs4Nrv7taitZGAEArnpQGujhSniDf1ceNXkjxYA1c4BfX8rtfM2eh 7lzU5tQQwPYNCPsB4TYCLQ6Uc/evj6pBTuxqsb9NQsMZNlbxjVIqX94nDRRBl4IgGO3i GVPrXouEQ+vRB50mHn49O0jcCUDxlrJnAdxj2LlZmVkf7ogyPpjD3MSFpkDd6DJmB55c LsEejQYomVnyKEhrBP3a+ZxJYK2nDIh7vv8gAteN/UvcwnwgsLw/iiZhZUEvOFqnz6cO J8ew== X-Gm-Message-State: ALyK8tJQIEPtn7aKgBqjz2PT99P8T0eWATlfK3Jp39ZDry18hIzTyb852kP14C1t8XEnIcSY X-Received: by 10.98.59.6 with SMTP id i6mr5008505pfa.45.1464877165380; Thu, 02 Jun 2016 07:19:25 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id f66sm1375137pfj.28.2016.06.02.07.19.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 07:19:24 -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 , Dmitry Eremin-Solenikov , Kevin Hilman , Krzysztof Kozlowski , Kukjin Kim , Shawn Guo , Steven Miao Subject: [PATCH 02/11] cpufreq: davinci: Reuse cpufreq_generic_frequency_table_verify() Date: Thu, 2 Jun 2016 19:49:02 +0530 Message-Id: X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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,