From: Niklas Schnelle Date: Mon, 3 Jul 2023 13:52:55 +0000 (+0200) Subject: PCI/sysfs: Make I/O resource depend on HAS_IOPORT X-Git-Tag: v6.6.7~2039^2~23^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5da1b58868a620cb58ad9ab31632ce9304c9f4f4;p=platform%2Fkernel%2Flinux-starfive.git PCI/sysfs: Make I/O resource depend on HAS_IOPORT If legacy I/O spaces are not supported simply return an error when trying to access them via pci_resource_io(). This allows inb() and friends to become undefined when they are known at compile time to be non-functional in a later patch. Co-developed-by: Arnd Bergmann Link: https://lore.kernel.org/r/20230703135255.2202721-3-schnelle@linux.ibm.com Signed-off-by: Arnd Bergmann Signed-off-by: Niklas Schnelle Signed-off-by: Bjorn Helgaas --- diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index ab32a91..d9eede2 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1083,6 +1083,7 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count, bool write) { +#ifdef CONFIG_HAS_IOPORT struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); int bar = (unsigned long)attr->private; unsigned long port = off; @@ -1116,6 +1117,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, return 4; } return -EINVAL; +#else + return -ENXIO; +#endif } static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,