Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 779b8a1

Browse files
arndbrafaeljw
authored andcommitted
cpufreq: amd-pstate: remove global header file
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: 36c5014 ("cpufreq: amd-pstate: optimize driver working mode selection in amd_pstate_param()") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 1613e60 commit 779b8a1

File tree

4 files changed

+35
-36
lines changed

4 files changed

+35
-36
lines changed

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,6 @@ L: linux-pm@vger.kernel.org
11071107
S: Supported
11081108
F: Documentation/admin-guide/pm/amd-pstate.rst
11091109
F: drivers/cpufreq/amd-pstate*
1110-
F: include/linux/amd-pstate.h
11111110
F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
11121111

11131112
AMD PTDMA DRIVER

drivers/cpufreq/amd-pstate-ut.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
#include <linux/module.h>
2727
#include <linux/moduleparam.h>
2828
#include <linux/fs.h>
29-
#include <linux/amd-pstate.h>
3029

3130
#include <acpi/cppc_acpi.h>
3231

32+
#include "amd-pstate.h"
33+
3334
/*
3435
* Abbreviations:
3536
* amd_pstate_ut: used as a shortform for AMD P-State unit test.

drivers/cpufreq/amd-pstate.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <linux/delay.h>
3737
#include <linux/uaccess.h>
3838
#include <linux/static_call.h>
39-
#include <linux/amd-pstate.h>
4039
#include <linux/topology.h>
4140

4241
#include <acpi/processor.h>
@@ -46,13 +45,46 @@
4645
#include <asm/processor.h>
4746
#include <asm/cpufeature.h>
4847
#include <asm/cpu_device_id.h>
48+
49+
#include "amd-pstate.h"
4950
#include "amd-pstate-trace.h"
5051

5152
#define AMD_PSTATE_TRANSITION_LATENCY 20000
5253
#define AMD_PSTATE_TRANSITION_DELAY 1000
5354
#define CPPC_HIGHEST_PERF_PERFORMANCE 196
5455
#define CPPC_HIGHEST_PERF_DEFAULT 166
5556

57+
#define AMD_CPPC_EPP_PERFORMANCE 0x00
58+
#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80
59+
#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF
60+
#define AMD_CPPC_EPP_POWERSAVE 0xFF
61+
62+
/*
63+
* enum amd_pstate_mode - driver working mode of amd pstate
64+
*/
65+
enum amd_pstate_mode {
66+
AMD_PSTATE_UNDEFINED = 0,
67+
AMD_PSTATE_DISABLE,
68+
AMD_PSTATE_PASSIVE,
69+
AMD_PSTATE_ACTIVE,
70+
AMD_PSTATE_GUIDED,
71+
AMD_PSTATE_MAX,
72+
};
73+
74+
static const char * const amd_pstate_mode_string[] = {
75+
[AMD_PSTATE_UNDEFINED] = "undefined",
76+
[AMD_PSTATE_DISABLE] = "disable",
77+
[AMD_PSTATE_PASSIVE] = "passive",
78+
[AMD_PSTATE_ACTIVE] = "active",
79+
[AMD_PSTATE_GUIDED] = "guided",
80+
NULL,
81+
};
82+
83+
struct quirk_entry {
84+
u32 nominal_freq;
85+
u32 lowest_freq;
86+
};
87+
5688
/*
5789
* TODO: We need more time to fine tune processors with shared memory solution
5890
* with community together.

include/linux/amd-pstate.h renamed to drivers/cpufreq/amd-pstate.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22
/*
3-
* linux/include/linux/amd-pstate.h
4-
*
53
* Copyright (C) 2022 Advanced Micro Devices, Inc.
64
*
75
* Author: Meng Li <li.meng@amd.com>
@@ -12,11 +10,6 @@
1210

1311
#include <linux/pm_qos.h>
1412

15-
#define AMD_CPPC_EPP_PERFORMANCE 0x00
16-
#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80
17-
#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF
18-
#define AMD_CPPC_EPP_POWERSAVE 0xFF
19-
2013
/*********************************************************************
2114
* AMD P-state INTERFACE *
2215
*********************************************************************/
@@ -108,30 +101,4 @@ struct amd_cpudata {
108101
bool suspended;
109102
};
110103

111-
/*
112-
* enum amd_pstate_mode - driver working mode of amd pstate
113-
*/
114-
enum amd_pstate_mode {
115-
AMD_PSTATE_UNDEFINED = 0,
116-
AMD_PSTATE_DISABLE,
117-
AMD_PSTATE_PASSIVE,
118-
AMD_PSTATE_ACTIVE,
119-
AMD_PSTATE_GUIDED,
120-
AMD_PSTATE_MAX,
121-
};
122-
123-
static const char * const amd_pstate_mode_string[] = {
124-
[AMD_PSTATE_UNDEFINED] = "undefined",
125-
[AMD_PSTATE_DISABLE] = "disable",
126-
[AMD_PSTATE_PASSIVE] = "passive",
127-
[AMD_PSTATE_ACTIVE] = "active",
128-
[AMD_PSTATE_GUIDED] = "guided",
129-
NULL,
130-
};
131-
132-
struct quirk_entry {
133-
u32 nominal_freq;
134-
u32 lowest_freq;
135-
};
136-
137104
#endif /* _LINUX_AMD_PSTATE_H */

0 commit comments

Comments
 (0)