Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5867087pxu; Thu, 22 Oct 2020 13:08:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxITpZM9uhYb9toi00wyHLxq95e4jNMksStVnaebwLRc6kJBMlJRpYJ6MAc1mtpkGzKQgw4 X-Received: by 2002:a17:906:8157:: with SMTP id z23mr3805390ejw.274.1603397285441; Thu, 22 Oct 2020 13:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603397285; cv=none; d=google.com; s=arc-20160816; b=AHiLNuZeNxqo3c2d3WBz9md96wMH3YPLTzz0ZwMtBARKhgCuUa9i//shHjVDxRCGUc 9r4aOYUOxit8w4V0C3m1PTlthk5yrfE+z51+l37N9mxq7V5LMPEVUF1idygNypTF5okC 3DTsN4WIbyTz3nB3I6HCrwDG9sHQwGFPM8PpC2duL0+4eLU8ax6Le8JsnxO4C3b8ifjK dTBqYy/Rzvd4cRQVrWTnRfz3Y5bhuhAhGjgiO1Qmz+7VXzkFrPVSoTus159bZZdbfQoJ aMt2YPuy0yEvzyfG7yBEEkKMEHVCStDGEDj/d8fjmI0sU94JcmrVJC23XopQhws18OZv eZjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=D1Y5zY1kB0nSO2szd7gPl05V1yPx1I0KxQIWNH1Y5io=; b=nEulkmdh79B+8dVaKxPytng8aUZ/UpO2KVaOrVs9MAP7SIwn8Pva6tariJwvHMuLW7 ygzahGYooTLsZ8fruat4QVQ7xtxziZY5dMiC2soLMwvjc8Tu5gOCs+izljpHv6BQBAI0 zb7UEv8MW7N1O4pSVTBy5mwDDJ29bqNLU5CDLK1nfkiuxV5PJuUkTVWRSLDPWVkhuNdA zFvnV5RmL3Q+KC1rRDag1bCoyCitLghHk/GId/iCAPNOlcXhvw6ZAtPW47/eKiugfanH ZjJ0sx43NqLqfT7jvJtT98iG0Nw1280vde0S3BqaN20WIFQrx+9hbVCl8WPSKwJu3Fti qZ7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj13si1584721ejb.441.2020.10.22.13.07.42; Thu, 22 Oct 2020 13:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2897706AbgJVL5z (ORCPT + 99 others); Thu, 22 Oct 2020 07:57:55 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:52126 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2897699AbgJVL5y (ORCPT ); Thu, 22 Oct 2020 07:57:54 -0400 Received: from 89-64-87-167.dynamic.chello.pl (89.64.87.167) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.491) id 18c6cd3a29713389; Thu, 22 Oct 2020 13:57:52 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Viresh Kumar , Srinivas Pandruvada , Zhang Rui Subject: [PATCH 2/2] cpufreq: Drop restore_freq from struct cpufreq_policy Date: Thu, 22 Oct 2020 13:57:45 +0200 Message-ID: <3286881.tlMdjJ8CK2@kreacher> In-Reply-To: <1666263.spd1I39WAV@kreacher> References: <1666263.spd1I39WAV@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki The restore_freq field in struct cpufreq_policy is only used by __target_index() in one place and a local variable in that function may as well be used instead of it, so drop it and modify __target_index() accordingly. Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq.c | 10 +++++----- include/linux/cpufreq.h | 5 ----- 2 files changed, 5 insertions(+), 10 deletions(-) Index: linux-pm/drivers/cpufreq/cpufreq.c =================================================================== --- linux-pm.orig/drivers/cpufreq/cpufreq.c +++ linux-pm/drivers/cpufreq/cpufreq.c @@ -2112,7 +2112,7 @@ static int __target_intermediate(struct static int __target_index(struct cpufreq_policy *policy, int index) { struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0}; - unsigned int intermediate_freq = 0; + unsigned int restore_freq, intermediate_freq = 0; unsigned int newfreq = policy->freq_table[index].frequency; int retval = -EINVAL; bool notify; @@ -2120,6 +2120,9 @@ static int __target_index(struct cpufreq if (newfreq == policy->cur) return 0; + /* Save last value to restore later on errors */ + restore_freq = policy->cur; + notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION); if (notify) { /* Handle switching to intermediate frequency */ @@ -2157,7 +2160,7 @@ static int __target_index(struct cpufreq */ if (unlikely(retval && intermediate_freq)) { freqs.old = intermediate_freq; - freqs.new = policy->restore_freq; + freqs.new = restore_freq; cpufreq_freq_transition_begin(policy, &freqs); cpufreq_freq_transition_end(policy, &freqs, 0); } @@ -2194,9 +2197,6 @@ int __cpufreq_driver_target(struct cpufr if (target_freq == policy->cur) return 0; - /* Save last value to restore later on errors */ - policy->restore_freq = policy->cur; - if (!cpufreq_driver->target_index) return -EINVAL; Index: linux-pm/include/linux/cpufreq.h =================================================================== --- linux-pm.orig/include/linux/cpufreq.h +++ linux-pm/include/linux/cpufreq.h @@ -65,7 +65,6 @@ struct cpufreq_policy { unsigned int max; /* in kHz */ unsigned int cur; /* in kHz, only needed if cpufreq * governors are used */ - unsigned int restore_freq; /* = policy->cur before transition */ unsigned int suspend_freq; /* freq to set during suspend */ unsigned int policy; /* see above */ @@ -308,10 +307,6 @@ struct cpufreq_driver { /* define one out of two */ int (*setpolicy)(struct cpufreq_policy *policy); - /* - * On failure, should always restore frequency to policy->restore_freq - * (i.e. old freq). - */ int (*target)(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation); /* Deprecated */