From patchwork Mon Feb 26 05:09:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10241277 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16B4660208 for ; Mon, 26 Feb 2018 05:10:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08695292DF for ; Mon, 26 Feb 2018 05:10:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F186A297C3; Mon, 26 Feb 2018 05:10:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FA5B292DF for ; Mon, 26 Feb 2018 05:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750877AbeBZFKb (ORCPT ); Mon, 26 Feb 2018 00:10:31 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:44295 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbeBZFKb (ORCPT ); Mon, 26 Feb 2018 00:10:31 -0500 Received: by mail-pl0-f67.google.com with SMTP id w21so8654851plp.11 for ; Sun, 25 Feb 2018 21:10:31 -0800 (PST) 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=dPFAnfwJ79b/mg1j2ql0DFEFr1wlX2nawEdtrqpDD5A=; b=IsVe88z3+TJtBGVGTk/oyT3JNrNwWyxxb/gluOHSiFt5ZWxxXNFrR/tizeytZyt53t qqywxrDjYN4pZGWBKWDxOisN3rAHuIerUsciE2QkKxImMVknDe3lPqdXtiUvFCTQ5Kw+ YpK78RZt5ZI5q31OjP1ewEQaS5A5oeViHHiPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=dPFAnfwJ79b/mg1j2ql0DFEFr1wlX2nawEdtrqpDD5A=; b=AVTiQLgY9ap5VDGrQot5786tIhi9ISLv9kvIxbpnpuStn7s3YzS7neb6tEiYJeN4q+ 40z/8K9EF6/uJpDpCpkAU+ddBuCc5krJAvHJXME8Da9x1HBQ50QmG5Uu+HwfGkchCMZo HjmJ4XbkfhAdMG6d4iC4CO954V7AtfBs08yWDrFIYPaVccOgR6GUOb2tJXzXCUQ8W7Bp tSyhCV+nOWg88sHn0keaQjobmRVHgBXEVHlBBTQnrsF+c3C72KdvbmTSvlvgVPr7lv2/ j75VsAvv1tFBeowG/+8Lj2TWXDpaxqU/eTggWJ/odMGuT2T1Q4aKu5z0ZzEBTIrtZ5uf O7JA== X-Gm-Message-State: APf1xPB3Jue9v4j47l1VC2V4iiRKTa2PZU+UixJyZ1gvRDfqiuX2uTGu /CY3N9KjeAV1ucWHm+KnMqX8wg== X-Google-Smtp-Source: AH8x224b/sw3w017PmN2M+txxgYc2IAIjwOtGvbvTzHktxuQ3WSaBoLQwxkJJSmh1Nkby8OwYSnAJA== X-Received: by 2002:a17:902:50e:: with SMTP id 14-v6mr9391194plf.360.1519621830801; Sun, 25 Feb 2018 21:10:30 -0800 (PST) Received: from localhost ([122.172.92.38]) by smtp.gmail.com with ESMTPSA id p14sm4387458pgu.44.2018.02.25.21.10.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Feb 2018 21:10:30 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot Subject: [PATCH 23/27] cpufreq: sh: Don't validate the frequency table twice Date: Mon, 26 Feb 2018 10:39:06 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 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 X-Virus-Scanned: ClamAV using ClamSMTP The cpufreq core is already validating the CPU frequency table after calling the ->init() callback of the cpufreq drivers and the drivers don't need to do the same anymore. Though they need to set the policy->freq_table field directly from the ->init() callback now. Stop validating the frequency table from sh-cpufreq driver. The driver though prints the min/max frequency values and the same is done from the ->ready() callback now to keep the behavior unchanged. Signed-off-by: Viresh Kumar --- drivers/cpufreq/sh-cpufreq.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/sh-cpufreq.c b/drivers/cpufreq/sh-cpufreq.c index 28893d435cf5..5096c0ab781b 100644 --- a/drivers/cpufreq/sh-cpufreq.c +++ b/drivers/cpufreq/sh-cpufreq.c @@ -122,11 +122,7 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy) freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL; if (freq_table) { - int result; - - result = cpufreq_table_validate_and_show(policy, freq_table); - if (result) - return result; + policy->freq_table = freq_table; } else { dev_notice(dev, "no frequency table found, falling back " "to rate rounding.\n"); @@ -137,11 +133,6 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy) (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; } - dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, " - "Maximum %u.%03u MHz.\n", - policy->min / 1000, policy->min % 1000, - policy->max / 1000, policy->max % 1000); - return 0; } @@ -155,6 +146,16 @@ static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy) return 0; } +static void sh_cpufreq_cpu_ready(struct cpufreq_policy *policy) +{ + struct device *dev = get_cpu_device(policy->cpu); + + dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, " + "Maximum %u.%03u MHz.\n", + policy->min / 1000, policy->min % 1000, + policy->max / 1000, policy->max % 1000); +} + static struct cpufreq_driver sh_cpufreq_driver = { .name = "sh", .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, @@ -163,6 +164,7 @@ static struct cpufreq_driver sh_cpufreq_driver = { .verify = sh_cpufreq_verify, .init = sh_cpufreq_cpu_init, .exit = sh_cpufreq_cpu_exit, + .ready = sh_cpufreq_cpu_ready, .attr = cpufreq_generic_attr, };