]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/linux/linux-6.0.7-platform-x86-amd-Fix-pmc-compile-dependency-errors.patch
d890c24c03ced8ae8633ffe9e7bd16c4129612d2
[ipfire-2.x.git] / src / patches / linux / linux-6.0.7-platform-x86-amd-Fix-pmc-compile-dependency-errors.patch
1 From: Yupeng Li <liyupeng@zbhlos.com>
2 To: Shyam-sundar.S-k@amd.com, hdegoede@redhat.com, markgross@kernel.org
3 Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,
4 caizp2008@163.com, Yupeng Li <liyupeng@zbhlos.com>
5 Subject: [PATCH 1/1] platform/x86/amd: Fix pmc compile dependency errors.
6 Date: Wed, 26 Oct 2022 15:25:31 +0800
7
8 When disabled CONFIG_SUSPEND and CONFIG_DEBUG_FS, get_metrics_table
9 and amd_pmc_idlemask_read is defined under two conditions of this,
10 pmc build with implicit declaration of function error.Some build error
11 messages are as follows:
12
13 CC [M] drivers/platform/x86/amd/pmc.o
14 drivers/platform/x86/amd/pmc.c: In function ‘smu_fw_info_show’:
15 drivers/platform/x86/amd/pmc.c:436:6: error: implicit declaration of function ‘get_metrics_table’ [-Werror=implicit-function-declaration]
16 436 | if (get_metrics_table(dev, &table))
17 | ^~~~~~~~~~~~~~~~~
18 drivers/platform/x86/amd/pmc.c: In function ‘amd_pmc_idlemask_show’:
19 drivers/platform/x86/amd/pmc.c:508:8: error: implicit declaration of function ‘amd_pmc_idlemask_read’; did you mean ‘amd_pmc_idlemask_show’? [-Werror=implicit-function-declaration]
20 508 | rc = amd_pmc_idlemask_read(dev, NULL, s);
21 | ^~~~~~~~~~~~~~~~~~~~~
22 | amd_pmc_idlemask_show
23 cc1: some warnings being treated as errors
24
25 Signed-off-by: Yupeng Li <liyupeng@zbhlos.com>
26 Reviewed-by: Caicai <caizp2008@163.com>
27 ---
28 drivers/platform/x86/amd/pmc.c | 5 ++++-
29 1 file changed, 4 insertions(+), 1 deletion(-)
30
31 diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
32 index ce859b300712..2b08039921b8 100644
33 --- a/drivers/platform/x86/amd/pmc.c
34 +++ b/drivers/platform/x86/amd/pmc.c
35 @@ -433,8 +433,10 @@ static int smu_fw_info_show(struct seq_file *s, void *unused)
36 struct smu_metrics table;
37 int idx;
38
39 +#if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS)
40 if (get_metrics_table(dev, &table))
41 return -EINVAL;
42 +#endif
43
44 seq_puts(s, "\n=== SMU Statistics ===\n");
45 seq_printf(s, "Table Version: %d\n", table.table_version);
46 @@ -503,11 +505,12 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)
47 if (rc)
48 return rc;
49 }
50 -
51 if (dev->major > 56 || (dev->major >= 55 && dev->minor >= 37)) {
52 +#if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS)
53 rc = amd_pmc_idlemask_read(dev, NULL, s);
54 if (rc)
55 return rc;
56 +#endif
57 } else {
58 seq_puts(s, "Unsupported SMU version for Idlemask\n");
59 }
60 --
61 2.34.1
62
63