Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6187361ybf; Thu, 5 Mar 2020 15:06:30 -0800 (PST) X-Google-Smtp-Source: ADFU+vu5W4q0S5Vvj0J23EJ490ABrUovLct3UD20BBL0zX85EnhKjQeSynIUm032SQzN6IV/7pPw X-Received: by 2002:aca:c597:: with SMTP id v145mr583206oif.152.1583449589951; Thu, 05 Mar 2020 15:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583449589; cv=none; d=google.com; s=arc-20160816; b=wwwzh6nB7BnC7K8Gbi57INAGvLfzin2gFDdMuw1N0BTeQObbr5O+jRohiUGcueyl9I 4YpqdvEvMU+3GzPdte6v7NbdaccYmHLL90bSY+dmsmn7ms3DHJLhLJS8eEbRdzQEdsxx 6x2bFFjKmuMFzI76CU+U6KTadJGhaR6gKdYSGJ9P7ChjOBQ8p5XLg+4IbN2k0fX2YbXt e0VUOEO5pNjwfkkJ1k9JNi4N/cca/0v72PxPUpZ0Fes1PyhU5dstSQ0om6EW806j6zwb cikaajpp/vuQnzipE07sm8cNKGy1Tfr5uYOYNgVNhdYXvHZMPDv9rudFEn6oC8y2pirW 8APA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=foRZa3QgPjYnIrucT2KIG+DHRjrwOeRt58hoVg1xhFs=; b=0U808KcwpSMM6Q1BV04IQfJaIW8AzEoBDNIxKAaqHT7EkTcl8iU6KTGLoDeszEYtyb pnCDWAzoemIPG5+ADe05eSFc/FP2+d3dFCyVb421QfGOkeIGeFXw3UUVOVUk21+KgJgV AloKAxAJe0VABHUAQ2ZW4l2HhDgPPXIWaO6oG/kP+OPo57tD9+oXmS+X1wLPHra+1VTA LCwIBSBB6ye+Rt0gi+yZcIB1h1ut8tgXHMRsncbkNicdnYvK3kyZSOyHEUM2jdjVGqmO a+pv/KEnA5XfK4ZwltLnMLsdn/VadcxdQie4U7FIjl2HWEbTnHuJzHr4j3Jlc5B/p2jS jsrg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 104si206928otj.252.2020.03.05.15.06.17; Thu, 05 Mar 2020 15:06:29 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726358AbgCEXFh (ORCPT + 99 others); Thu, 5 Mar 2020 18:05:37 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:55902 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbgCEXFh (ORCPT ); Thu, 5 Mar 2020 18:05:37 -0500 Received: from 79.184.237.41.ipv4.supernova.orange.pl (79.184.237.41) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id a1f513d29558e684; Fri, 6 Mar 2020 00:05:35 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Srinivas Pandruvada Subject: [PATCH] cpufreq: intel_pstate: Consolidate policy verification Date: Fri, 06 Mar 2020 00:05:34 +0100 Message-ID: <226215910.rrICADBzDZ@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki There is still some code duplication between intel_pstate_verify_policy() and intel_cpufreq_verify_policy(), so avoid it by moving the common code into a separate function and calling it from both these places. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/intel_pstate.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) Index: linux-pm/drivers/cpufreq/intel_pstate.c =================================================================== --- linux-pm.orig/drivers/cpufreq/intel_pstate.c +++ linux-pm/drivers/cpufreq/intel_pstate.c @@ -2155,15 +2155,19 @@ static void intel_pstate_adjust_policy_m } } -static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy) +static void intel_pstate_verify_cpu_policy(struct cpudata *cpu, + struct cpufreq_policy_data *policy) { - struct cpudata *cpu = all_cpu_data[policy->cpu]; - update_turbo_state(); cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, intel_pstate_get_max_freq(cpu)); intel_pstate_adjust_policy_max(cpu, policy); +} + +static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy) +{ + intel_pstate_verify_cpu_policy(all_cpu_data[policy->cpu], policy); return 0; } @@ -2268,12 +2272,7 @@ static int intel_cpufreq_verify_policy(s { struct cpudata *cpu = all_cpu_data[policy->cpu]; - update_turbo_state(); - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, - intel_pstate_get_max_freq(cpu)); - - intel_pstate_adjust_policy_max(cpu, policy); - + intel_pstate_verify_cpu_policy(cpu, policy); intel_pstate_update_perf_limits(cpu, policy->min, policy->max); return 0;