mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND
Since commitb1f66033cd
("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: commitb1f66033cd
("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>
This commit is contained in:
parent
487532ec20
commit
753ee989f7
@ -160,8 +160,10 @@ MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism");
|
|||||||
|
|
||||||
static struct amd_pmc_dev pmc;
|
static struct amd_pmc_dev pmc;
|
||||||
static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret);
|
static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret);
|
||||||
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
|
|
||||||
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf);
|
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf);
|
||||||
|
#ifdef CONFIG_SUSPEND
|
||||||
|
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset)
|
static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset)
|
||||||
{
|
{
|
||||||
@ -325,6 +327,7 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SUSPEND
|
||||||
static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
|
static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
|
||||||
{
|
{
|
||||||
struct smu_metrics table;
|
struct smu_metrics table;
|
||||||
@ -338,6 +341,7 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
|
|||||||
dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n",
|
dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n",
|
||||||
table.timein_s0i3_lastcapture);
|
table.timein_s0i3_lastcapture);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
static int smu_fw_info_show(struct seq_file *s, void *unused)
|
static int smu_fw_info_show(struct seq_file *s, void *unused)
|
||||||
@ -569,6 +573,7 @@ out_unlock:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SUSPEND
|
||||||
static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
|
static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
|
||||||
{
|
{
|
||||||
switch (dev->cpu_id) {
|
switch (dev->cpu_id) {
|
||||||
@ -694,6 +699,7 @@ static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
|
|||||||
.prepare = amd_pmc_s2idle_prepare,
|
.prepare = amd_pmc_s2idle_prepare,
|
||||||
.restore = amd_pmc_s2idle_restore,
|
.restore = amd_pmc_s2idle_restore,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct pci_device_id pmc_pci_ids[] = {
|
static const struct pci_device_id pmc_pci_ids[] = {
|
||||||
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_YC) },
|
{ 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)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SUSPEND
|
||||||
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
|
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -753,6 +760,7 @@ static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf)
|
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf)
|
||||||
{
|
{
|
||||||
@ -859,9 +867,11 @@ static int amd_pmc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
amd_pmc_get_smu_version(dev);
|
amd_pmc_get_smu_version(dev);
|
||||||
platform_set_drvdata(pdev, dev);
|
platform_set_drvdata(pdev, dev);
|
||||||
|
#ifdef CONFIG_SUSPEND
|
||||||
err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
|
err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
|
||||||
if (err)
|
if (err)
|
||||||
dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
|
dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
amd_pmc_dbgfs_register(dev);
|
amd_pmc_dbgfs_register(dev);
|
||||||
return 0;
|
return 0;
|
||||||
@ -875,7 +885,9 @@ static int amd_pmc_remove(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct amd_pmc_dev *dev = platform_get_drvdata(pdev);
|
struct amd_pmc_dev *dev = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SUSPEND
|
||||||
acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
|
acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
|
||||||
|
#endif
|
||||||
amd_pmc_dbgfs_unregister(dev);
|
amd_pmc_dbgfs_unregister(dev);
|
||||||
pci_dev_put(dev->rdev);
|
pci_dev_put(dev->rdev);
|
||||||
mutex_destroy(&dev->lock);
|
mutex_destroy(&dev->lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user