Subject: Re: linux-next: build failure after merge of the pci tree

From: Mario Limonciello <[email-masked]>
Date: Thu, 5 Oct 2023 20:23:44 -0500

On 10/5/2023 19:56, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the pci tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
> 
> arch/x86/pci/fixup.c: In function 'amd_rp_pme_suspend':
> arch/x86/pci/fixup.c:929:13: error: 'pm_suspend_target_state' undeclared (first use in this function)
>    929 |         if (pm_suspend_target_state == PM_SUSPEND_ON)
>        |             ^~~~~~~~~~~~~~~~~~~~~~~
> arch/x86/pci/fixup.c:929:13: note: each undeclared identifier is reported only once for each function it appears in
> arch/x86/pci/fixup.c:929:40: error: 'PM_SUSPEND_ON' undeclared (first use in this function); did you mean 'RPM_SUSPENDING'?
>    929 |         if (pm_suspend_target_state == PM_SUSPEND_ON)
>        |                                        ^~~~~~~~~~~~~
>        |                                        RPM_SUSPENDING
> arch/x86/pci/fixup.c: In function 'amd_rp_pme_resume':
> arch/x86/pci/fixup.c:951:27: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
>    951 |         rp->pme_support = FIELD_GET(PCI_PM_CAP_PME_MASK, pmc);
>        |                           ^~~~~~~~~
> 
> Caused by commit
> 
>    624306d2c241 ("x86/PCI: Avoid PME from D3hot/D3cold for AMD Rembrandt and Phoenix USB4")
> 
> I have used the pci tree from next-20231005 for today.
> 

It happened because of a last minute decision to move to 
arch/x86/pci/fixup.c from drivers/pci/quirks.c when Bjorn committed it.

Here's the fix for it:

diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index ee0509eb8674..f347c20247d3 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -3,9 +3,11 @@
   * Exceptions for specific devices. Usually work-arounds for fatal 
design flaws.
   */

+#include <linux/bitfield.h>
  #include <linux/delay.h>
  #include <linux/dmi.h>
  #include <linux/pci.h>
+#include <linux/suspend.h>
  #include <linux/vgaarb.h>
  #include <asm/amd_nb.h>
  #include <asm/hpet.h>