[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230314160514.GA1648498@bhelgaas>
Date: Tue, 14 Mar 2023 11:05:14 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Niklas Schnelle <schnelle@...ux.ibm.com>
Cc: Arnd Bergmann <arnd@...db.de>, Bjorn Helgaas <bhelgaas@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Alan Stern <stern@...land.harvard.edu>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
linux-pci@...r.kernel.org, Arnd Bergmann <arnd@...nel.org>
Subject: Re: [PATCH v3 23/38] PCI/sysfs: Make I/O resource depend on
HAS_IOPORT
On Tue, Mar 14, 2023 at 01:12:01PM +0100, Niklas Schnelle wrote:
> 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 <arnd@...nel.org>
> Signed-off-by: Niklas Schnelle <schnelle@...ux.ibm.com>
Acked-by: Bjorn Helgaas <bhelgaas@...gle.com>
> ---
> drivers/pci/pci-sysfs.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index dd0d9d9bc509..11e92d106761 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,
> --
> 2.37.2
>
Powered by blists - more mailing lists