From patchwork Mon Feb 26 05:08:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10241235 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 3F07160208 for ; Mon, 26 Feb 2018 05:09:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30356292DF for ; Mon, 26 Feb 2018 05:09:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2512C297C3; Mon, 26 Feb 2018 05:09:39 +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 A349E292DF for ; Mon, 26 Feb 2018 05:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751094AbeBZFJh (ORCPT ); Mon, 26 Feb 2018 00:09:37 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36481 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeBZFJh (ORCPT ); Mon, 26 Feb 2018 00:09:37 -0500 Received: by mail-pf0-f195.google.com with SMTP id 68so6085734pfx.3 for ; Sun, 25 Feb 2018 21:09:37 -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=qZbJU4xM3O5VkI89+LfIxT9ccFZcbDnHbmJGkd1XZDw=; b=FHDDbmIgVUPcGG5u8orSM1HSArLknhcWOe+Mf/WQKkaPaSdI3y6wePIlb5pB8dzUNd d3+6xRxoEsRYM1HIm33nSlZjJ8Zy0U30I0zzwkf7ykbcoovvcbni6MLWFGNuQbJBAmF1 Gr+cp6Nwtez18QKK3FkrpHgFgOHKiBeW6QZJQ= 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=qZbJU4xM3O5VkI89+LfIxT9ccFZcbDnHbmJGkd1XZDw=; b=UVpEbc+g5SsxR5i23qWZQXwQgRoFCt6TMmLd1z0vNR6hwD4H9DDH749UYNjGomaMoU mWmTCOX0jyGzd7kw6HHSNFu+SnYGJqVh1mlGb3wCftNZer7FNWY5hOuPqLIX/XxOovGb ctHVHOS5rb2M3wbj1XwuYSbty0d9YKHMAls3sm6gJhy/Pg/2JAp5JltuvKmxCA6mqJEX BJ1DM50fyFXyQLoAWhw3RpJTdSDP/vDHJ4SjRgYEHZnHFIrXYNCuGunXQi/qX3YrM3wN /wVKv2WjbL1r/9kyzue5kBoPvNB7wA2ThOpZXkSdstKf2Apy6Mp9jwFf6jvv0AiBhCyg jnRQ== X-Gm-Message-State: APf1xPAUzMtRQ7Jlxz9xUKtsWX03qu3nOzKcJvmgsoLg/hreh4aO/Tuc E7W7GZZ5bV6ieL6peuKb8t7jXA== X-Google-Smtp-Source: AG47ELssZpzJRfsqWvXEp5P/QBU2/fMyFj/1NGmKpnu632tl7tKjbqY1dv+hS0uPPDHjmq68tiuJhA== X-Received: by 10.98.55.7 with SMTP id e7mr1994089pfa.112.1519621776798; Sun, 25 Feb 2018 21:09:36 -0800 (PST) Received: from localhost ([122.172.92.38]) by smtp.gmail.com with ESMTPSA id h17sm6358753pfd.64.2018.02.25.21.09.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Feb 2018 21:09:36 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot Subject: [PATCH 03/27] cpufreq: acpi: Don't validate the frequency table twice Date: Mon, 26 Feb 2018 10:38:46 +0530 Message-Id: <06cc728bfe2ebd52dce2ccd2310a40cc9d4db1dc.1519620578.git.viresh.kumar@linaro.org> 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 acpi-cpufreq driver. The driver needs to crosscheck if the max frequency corresponds to the P-state 0 or not and the same is done from the ->ready() callback now. Signed-off-by: Viresh Kumar --- drivers/cpufreq/acpi-cpufreq.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index d0c34df0529c..9449657d72f0 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -794,15 +794,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) valid_states++; } freq_table[valid_states].frequency = CPUFREQ_TABLE_END; + policy->freq_table = freq_table; perf->state = 0; - result = cpufreq_table_validate_and_show(policy, freq_table); - if (result) - goto err_freqfree; - - if (perf->states[0].core_frequency * 1000 != policy->cpuinfo.max_freq) - pr_warn(FW_WARN "P-state 0 is not max freq\n"); - switch (perf->control_register.space_id) { case ACPI_ADR_SPACE_SYSTEM_IO: /* @@ -842,8 +836,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) return result; -err_freqfree: - kfree(freq_table); err_unreg: acpi_processor_unregister_performance(cpu); err_free_mask: @@ -871,6 +863,15 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) return 0; } +static void acpi_cpufreq_cpu_ready(struct cpufreq_policy *policy) +{ + struct acpi_processor_performance *perf = per_cpu_ptr(acpi_perf_data, + policy->cpu); + + if (perf->states[0].core_frequency * 1000 != policy->cpuinfo.max_freq) + pr_warn(FW_WARN "P-state 0 is not max freq\n"); +} + static int acpi_cpufreq_resume(struct cpufreq_policy *policy) { struct acpi_cpufreq_data *data = policy->driver_data; @@ -898,6 +899,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .bios_limit = acpi_processor_get_bios_limit, .init = acpi_cpufreq_cpu_init, .exit = acpi_cpufreq_cpu_exit, + .ready = acpi_cpufreq_cpu_ready, .resume = acpi_cpufreq_resume, .name = "acpi-cpufreq", .attr = acpi_cpufreq_attr,