Re: [PATCH] PCI: Stop waiting for link status after config read failure
From: Yury M.
Date: Mon Sep 21 2026 - 13:11:29 EST
On 9/5/26 11:06, Lukas Wunner wrote:
It's repetitive because pcie_capability_read_word() already checks
internally for pci_dev_is_disconnected():
pcie_capability_read_word()
pci_read_config_word()
pci_dev_is_disconnected()
I just thought that since you specifically want to bail out in the
hot-removal case, it might be clearer to check pci_dev_is_disconnected()
in pcie_wait_for_link_status() before performing the config space read.
But I don't feel strongly either way and checking the return value of
pcie_capability_read_word() is a viable approach as well.
I've sent v3 of the patch, returning to validating the |pcie_capability_read_word()| return value.
Reasoning:
1.
I don't see any benefit to using |pci_dev_is_disconnected()|, other
than your point that it makes the code clearer or more readable.
2.
I checked how we set |pci_dev_is_disconnected()| now, and it looks
like failed reads don't guarantee that the device will immediately
be marked as disconnected. I assume that eventually we will receive
a link-status-changed interrupt and the device will then be marked
as disconnected.
3.
On the other hand, |pcie_capability_read_word()| internally performs
a |pci_dev_is_disconnected()| check. So in our context, validating
the |pcie_capability_read_word()| return value is more robust,
allowing us to react to device disappearance (for any reason) faster
and more reliably.
Thanks