Re: [RFC 28/32] PCI: make quirk using inw() depend on HAS_IOPORT

Bjorn Helgaas
2021-12-27T22:33:55Z

On Mon, Dec 27, 2021 at 05:43:13PM +0100, Niklas Schnelle wrote:
> In the future inw()/outw() and friends will not be compiled on
> architectures without I/O port support.

This commit log actually doesn't say what the patch does.

I'm pretty sure this particular quirk is x86 specific and could
probably be moved to arch/x86/pci/fixup.c, where the #ifdef probably
wouldn't be needed.

If we keep it in drivers/pci, please update the subject line to make
it more specific and match the convention, e.g.,

PCI: Compile quirk_tigerpoint_bm_sts() only when HAS_IOPORT set

BTW, git complains about some whitespace errors in other patches:

Applying: char: impi, tpm: depend on HAS_IOPORT
.git/rebase-apply/patch:92: trailing whitespace.
If you have a TPM security chip from Atmel say Yes and it
.git/rebase-apply/patch:93: trailing whitespace.
will be accessible from within Linux. To compile this driver
warning: 2 lines add whitespace errors.
Applying: video: handle HAS_IOPORT dependencies
.git/rebase-apply/patch:23: trailing whitespace.

warning: 1 line adds whitespace errors.

> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> drivers/pci/quirks.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 003950c738d2..8624c98c57b2 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -265,6 +265,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_1, quirk_isa_d
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_dma_hangs);
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs);
>
> +#ifdef CONFIG_HAS_IOPORT
> /*
> * Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear
> * for some HT machines to use C4 w/o hanging.
> @@ -284,6 +285,7 @@ static void quirk_tigerpoint_bm_sts(struct pci_dev *dev)
> }
> }
> DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts);
> +#endif
>
> /* Chipsets where PCI->PCI transfers vanish or hang */
> static void quirk_nopcipci(struct pci_dev *dev)
> --
> 2.32.0
>