Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2597681lqb; Tue, 28 May 2024 05:11:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWsuQm9CqQcgqvIEjACl9+HQ7giNpworF6hOjFdaedr7BOdFqbwLTezFj18HWWm8o/7FECPjdgLSxujV170YZa3AhqHLOLSSSNrdPpKhw== X-Google-Smtp-Source: AGHT+IE5xNpNonWnrnGKU/S51orM35HI/NqUZS1Jqo/KwxHg1Rbqz8p8cvtA6HkjKtdv3IMlI1yr X-Received: by 2002:a05:6871:e026:b0:24c:60a5:bc05 with SMTP id 586e51a60fabf-24ca154d006mr12649967fac.50.1716898301941; Tue, 28 May 2024 05:11:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716898301; cv=pass; d=google.com; s=arc-20160816; b=iGclICJmFcGRX/dduqT7l90HOl58Axrw2VQU7HhVsCdl9B0bGlfASreoFp5wACsur+ BZLkXRCC3ayToyd/Ju/DI7X+Cf8BhYm0fpKvNR1DVLMk9xzVraPi/HIRHvuG/EvWPWBl oR+mTucKj6kJ/B8tdmL3IsTqlvrw/soPkf0zaZgBMjFm5lclXNm1XrFA6TDtxSSB7v3i cKa3dxf6cx8UEXNYUvQcMG710Nojt3BCFJbKNkHjT+O+14W/5Sw55pRlqrHxr3Ut9DZb lgDBXLmJj4mnx6teqZu1K7DGp/bOoy0feEwW1xU/NCxNesNhbqp/PeSwpAjQ/dVxhh0B VAXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Fg1EGlaJRanfLejb6N2q5Ba2PgBQz0R7Oj3C2GeXj2g=; fh=4XYaOohdVYhEZbHGt0Kk+nx6gJEFChUOkiUtLj9OjNk=; b=pvTntIQDnKhHCbg/P2Yfk8x8Dge+sAldNGb9hsaT97E6w3gpynyMo2l9eMd5POqOs0 myQd+BXlue7p7HXdMw24c3YjpMLJYcMDsgpp5hdrYszksbl36oqWzajWSV3qMlRQcw79 UEQzsXOEA40NrY1+F3R31yrdFQEzkzX3sSjnCi1Yi5qA3BH2quMR8NADWVHleRYUc08f 1wuSYuI8r1AD4AtpYwYniG/wxNDfEdvBGYkyUlYQi6qVCV05ow79TYNXUt0nXpjYQeEd MkJ6TziurwaRYQpUUl3LSXEmltZ0jL5/irTsUlz6DG9yFvmYPocf/VSr3ssZx6TpW3d9 TKZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rFPpHpfV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18a793csi101605521cf.276.2024.05.28.05.11.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 05:11:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rFPpHpfV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 351D11C22B45 for ; Tue, 28 May 2024 12:11:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C846016D4C5; Tue, 28 May 2024 12:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rFPpHpfV" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCA5816D32F; Tue, 28 May 2024 12:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716898291; cv=none; b=S5S6yceN4wY0yPbauNh7EGQ9S0GGFj/NBuiLPVNPMsyXzEuEZfyODc1GdEReRixrwtou7i6TPU8VKHN65vU9Se8Dpbil4mJUMlQQWpUNOOs1ZFPaYJAecQIBbd3aGAG23k6HVAd7Hak3CFDHkNLzJ9Be5JKiG2O70fOufPsbAYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716898291; c=relaxed/simple; bh=lLoV8zixnH4tiCV5O9FGmiko/YIhlX+oWOkfbbm3RCY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=NnTRq3L9jnI5P4V4v5rONUGxwB4kTMVRFmow71GfvlHEtkHijELQRpiCdOwdOUFef/vIiP0ATk2Vb3okEbmUoDnNwUs5NHpdwxVOLTwfhNsZI1EZn2nHKpybgOR5qrFdRZPFRPqtW3OqTlVbDrkDce4jksAP7eLNjLqLiqzXuhg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rFPpHpfV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E937C3277B; Tue, 28 May 2024 12:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716898290; bh=lLoV8zixnH4tiCV5O9FGmiko/YIhlX+oWOkfbbm3RCY=; h=From:To:Cc:Subject:Date:From; b=rFPpHpfVC8Ft33sJQ0705o9b/6Dubf7liZEQbJ7RrmIMNulsXxrqcV+pgpU+DCwU+ tZSh9EonpGKRBo1VRD6gBo6+wzsvZD7/mM6h5w5ATGwn94U7ITOrFsN34l7CyBHTq+ la5kkhXNcz7LEYdythzgDgoxWNYuBhUuC0UmR6a9RXiIzMFYpvJXgR87OC0rP9fZU8 anIFRn0+uuPZNs4+/03Yb0spRIJEDvBAzjv9DTGSUORlEpHOoS9fLdchudJ8w8ED7s 5P0Y1AI06PaAaWFN6hjUt4BNn9gnaT+IQjgYeIIQ/3UINpicFGBR9x2zUsTZ7a2jgY ZBf5xCZiHQtSg== From: Arnd Bergmann To: Huang Rui , "Gautham R. Shenoy" , Mario Limonciello , "Rafael J. Wysocki" , Viresh Kumar , Perry Yuan , Wyes Karny Cc: Arnd Bergmann , Meng Li , Swapnil Sapkal , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH] cpufreq: amd-pstate: remove global header file Date: Tue, 28 May 2024 14:09:23 +0200 Message-Id: <20240528121124.3588248-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann When extra warnings are enabled, gcc points out a global variable definition in a header: In file included from drivers/cpufreq/amd-pstate-ut.c:29: include/linux/amd-pstate.h:123:27: error: 'amd_pstate_mode_string' defined but not used [-Werror=unused-const-variable=] 123 | static const char * const amd_pstate_mode_string[] = { | ^~~~~~~~~~~~~~~~~~~~~~ This header is only included from two files in the same directory, and one of them uses only a single definition from it, so clean it up by moving most of the contents into the driver that uses them, and making shared bits a local header file. Fixes: 36c5014e5460 ("cpufreq: amd-pstate: optimize driver working mode selection in amd_pstate_param()") Signed-off-by: Arnd Bergmann --- MAINTAINERS | 1 - drivers/cpufreq/amd-pstate-ut.c | 3 +- drivers/cpufreq/amd-pstate.c | 34 ++++++++++++++++++- .../linux => drivers/cpufreq}/amd-pstate.h | 33 ------------------ 4 files changed, 35 insertions(+), 36 deletions(-) rename {include/linux => drivers/cpufreq}/amd-pstate.h (82%) diff --git a/MAINTAINERS b/MAINTAINERS index 070a39b2b098..35a75ab8ef05 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1107,7 +1107,6 @@ L: linux-pm@vger.kernel.org S: Supported F: Documentation/admin-guide/pm/amd-pstate.rst F: drivers/cpufreq/amd-pstate* -F: include/linux/amd-pstate.h F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py AMD PTDMA DRIVER diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c index f04ae67dda37..fc275d41d51e 100644 --- a/drivers/cpufreq/amd-pstate-ut.c +++ b/drivers/cpufreq/amd-pstate-ut.c @@ -26,10 +26,11 @@ #include #include #include -#include #include +#include "amd-pstate.h" + /* * Abbreviations: * amd_pstate_ut: used as a shortform for AMD P-State unit test. diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 1b7e82a0ad2e..91993647e09e 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -46,6 +45,8 @@ #include #include #include + +#include "amd-pstate.h" #include "amd-pstate-trace.h" #define AMD_PSTATE_TRANSITION_LATENCY 20000 @@ -53,6 +54,37 @@ #define CPPC_HIGHEST_PERF_PERFORMANCE 196 #define CPPC_HIGHEST_PERF_DEFAULT 166 +#define AMD_CPPC_EPP_PERFORMANCE 0x00 +#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 +#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF +#define AMD_CPPC_EPP_POWERSAVE 0xFF + +/* + * enum amd_pstate_mode - driver working mode of amd pstate + */ +enum amd_pstate_mode { + AMD_PSTATE_UNDEFINED = 0, + AMD_PSTATE_DISABLE, + AMD_PSTATE_PASSIVE, + AMD_PSTATE_ACTIVE, + AMD_PSTATE_GUIDED, + AMD_PSTATE_MAX, +}; + +static const char * const amd_pstate_mode_string[] = { + [AMD_PSTATE_UNDEFINED] = "undefined", + [AMD_PSTATE_DISABLE] = "disable", + [AMD_PSTATE_PASSIVE] = "passive", + [AMD_PSTATE_ACTIVE] = "active", + [AMD_PSTATE_GUIDED] = "guided", + NULL, +}; + +struct quirk_entry { + u32 nominal_freq; + u32 lowest_freq; +}; + /* * TODO: We need more time to fine tune processors with shared memory solution * with community together. diff --git a/include/linux/amd-pstate.h b/drivers/cpufreq/amd-pstate.h similarity index 82% rename from include/linux/amd-pstate.h rename to drivers/cpufreq/amd-pstate.h index d58fc022ec46..e6a28e7f4dbf 100644 --- a/include/linux/amd-pstate.h +++ b/drivers/cpufreq/amd-pstate.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * linux/include/linux/amd-pstate.h - * * Copyright (C) 2022 Advanced Micro Devices, Inc. * * Author: Meng Li @@ -12,11 +10,6 @@ #include -#define AMD_CPPC_EPP_PERFORMANCE 0x00 -#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 -#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF -#define AMD_CPPC_EPP_POWERSAVE 0xFF - /********************************************************************* * AMD P-state INTERFACE * *********************************************************************/ @@ -108,30 +101,4 @@ struct amd_cpudata { bool suspended; }; -/* - * enum amd_pstate_mode - driver working mode of amd pstate - */ -enum amd_pstate_mode { - AMD_PSTATE_UNDEFINED = 0, - AMD_PSTATE_DISABLE, - AMD_PSTATE_PASSIVE, - AMD_PSTATE_ACTIVE, - AMD_PSTATE_GUIDED, - AMD_PSTATE_MAX, -}; - -static const char * const amd_pstate_mode_string[] = { - [AMD_PSTATE_UNDEFINED] = "undefined", - [AMD_PSTATE_DISABLE] = "disable", - [AMD_PSTATE_PASSIVE] = "passive", - [AMD_PSTATE_ACTIVE] = "active", - [AMD_PSTATE_GUIDED] = "guided", - NULL, -}; - -struct quirk_entry { - u32 nominal_freq; - u32 lowest_freq; -}; - #endif /* _LINUX_AMD_PSTATE_H */ -- 2.39.2