Skip to content

Commit 753ee98

Browse files
superm1jwrdegoede
authored andcommitted
platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND
Since commit b1f6603 ("platform/x86: amd-pmc: Move to later in the suspend process") amd-pmc doesn't use traditional suspend resume callback anymore but relies on functions only created declared when CONFIG_SUSPEND is set. Check for CONFIG_SUSPEND and only use those functions in those circumstances. Fixes: commit b1f6603 ("platform/x86: amd-pmc: Move to later in the suspend process") Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/20220402231122.3877-1-mario.limonciello@amd.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 487532e commit 753ee98

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

drivers/platform/x86/amd-pmc.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism");
160160

161161
static struct amd_pmc_dev pmc;
162162
static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret);
163-
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
164163
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf);
164+
#ifdef CONFIG_SUSPEND
165+
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
166+
#endif
165167

166168
static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset)
167169
{
@@ -325,6 +327,7 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table
325327
return 0;
326328
}
327329

330+
#ifdef CONFIG_SUSPEND
328331
static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
329332
{
330333
struct smu_metrics table;
@@ -338,6 +341,7 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
338341
dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n",
339342
table.timein_s0i3_lastcapture);
340343
}
344+
#endif
341345

342346
#ifdef CONFIG_DEBUG_FS
343347
static int smu_fw_info_show(struct seq_file *s, void *unused)
@@ -569,6 +573,7 @@ static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg,
569573
return rc;
570574
}
571575

576+
#ifdef CONFIG_SUSPEND
572577
static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
573578
{
574579
switch (dev->cpu_id) {
@@ -694,6 +699,7 @@ static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
694699
.prepare = amd_pmc_s2idle_prepare,
695700
.restore = amd_pmc_s2idle_restore,
696701
};
702+
#endif
697703

698704
static const struct pci_device_id pmc_pci_ids[] = {
699705
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_YC) },
@@ -733,6 +739,7 @@ static int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
733739
return 0;
734740
}
735741

742+
#ifdef CONFIG_SUSPEND
736743
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
737744
{
738745
int err;
@@ -753,6 +760,7 @@ static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
753760

754761
return 0;
755762
}
763+
#endif
756764

757765
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf)
758766
{
@@ -859,9 +867,11 @@ static int amd_pmc_probe(struct platform_device *pdev)
859867

860868
amd_pmc_get_smu_version(dev);
861869
platform_set_drvdata(pdev, dev);
870+
#ifdef CONFIG_SUSPEND
862871
err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
863872
if (err)
864873
dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
874+
#endif
865875

866876
amd_pmc_dbgfs_register(dev);
867877
return 0;
@@ -875,7 +885,9 @@ static int amd_pmc_remove(struct platform_device *pdev)
875885
{
876886
struct amd_pmc_dev *dev = platform_get_drvdata(pdev);
877887

888+
#ifdef CONFIG_SUSPEND
878889
acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
890+
#endif
879891
amd_pmc_dbgfs_unregister(dev);
880892
pci_dev_put(dev->rdev);
881893
mutex_destroy(&dev->lock);

0 commit comments

Comments
 (0)