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: 129529 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3230144lja; Sun, 25 Feb 2018 21:09:38 -0800 (PST) X-Google-Smtp-Source: AH8x227IFI5nPrtxFets7vEUhwCvGnbBlqgTIiHk7Cfv3t4GI8B0D+gjQIvE418pfWqGpB4JRFgD X-Received: by 2002:a17:902:2904:: with SMTP id g4-v6mr9295411plb.170.1519621778840; Sun, 25 Feb 2018 21:09:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519621778; cv=none; d=google.com; s=arc-20160816; b=0pUzF83bvANYh5ftL5op8kKWzS2KnGRl7Uqf/SPD9cfh9aFIlpzKiXZ1wf4mQc5dKo TMTjaw5z4S5Ye4U7A5orplomlQVKcPv0+hiwqPKgV+DdpXyRoeS8Trc688JqT/sW3Rwe TZ/J66U5ivA67IyjfMSHr/QzeM1eoEAcRQmqb2RdFhvfJGw6GUUQzwFvl4IZZMarlv3Z XStCrs+Waz0gltCAwGpmdTJfLH/olcEeEXwKyX/CvmP+0naoNYQm8Q+fToPOO4t0FdHD sr3GuI9Z7fm233Lu2k1hsgHTJunUYfxq0zNaK9m8SuDR4XY9YIk9yb1EisTcm9TZns/i YKlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=qZbJU4xM3O5VkI89+LfIxT9ccFZcbDnHbmJGkd1XZDw=; b=wSFLeOV5LRrb60AV7NCeM021wgrCyD4//5GkCrq8OVaTYUy08bWGG0S1A5Bl0zSx8H Tf2r5g+RkNpIuz5XZFORLjxxj6dxZotFoQ1kGHiW8Q8rUCzJ/NOmvxqJrCIjBR3Ao4y5 mfAqDKN5qE29n7kejZCuBsDyhZKXQKCX5sWpxjbqnXLh08Cx6rK+iHcBX3LOyI0OB4Tc 30w6lOg9GracTwctjk6HD2869pGXk5puYrPxmbaqjYn9QEn1rUo892gQhmSOjkzfjkD+ tUccBITP1vWCQt/LVnHiTPw6pLuYpAXvTRYMiQfCBfY8qFLb9QYowUl0y1TzEgMSTISr 14+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FHDDbmIg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32-v6si6199354pld.217.2018.02.25.21.09.38; Sun, 25 Feb 2018 21:09:38 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=FHDDbmIg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751094AbeBZFJh (ORCPT + 11 others); 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-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 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(-) -- 2.15.0.194.g9af6a3dea062 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,