Re: [PATCH] PCI/sysfs: Check IORESOURCE_DISABLED in resource mmap handler

From: Ravi Kumar Bandi

Date: Wed May 13 2026 - 02:50:15 EST


On Wed, May 13, 2026 at 14:07:02 +0900, Krzysztof Wilczyński wrote:
> There also exists pci_device_is_present() which would attempt an actual
> read of a vendor/device IDs, so if this succeeds, then you have a more
> solid assurance that the device should be working. However, this adds
> latency, and there might be side-effects, potentially...

Yeah, exactly - it adds latency and will be more profound if applications
mmap the resources periodically.

> I wonder, if for you, you could forfeit setting any flags on a resource,
> which drivers don't customarily do, such that we would only rely on
> checking pci_dev_is_disconnected() on our side, so to speak.
>
> We won't be setting any precedent here, as the helpers such as
> pci_read_config_byte(), perform this check internally already.
>
> Bjorn and Ilpo might have different take on this, though.

Thank you for the suggestion. Yes, we can forfeit setting
IORESOURCE_DISABLED and rely solely on pci_dev_is_disconnected()
check in pci_mmap_resource(). I have submitted v2 patch, please
review.

Thank you.
Ravi Kumar Bandi