On Wed, Sep 05, 2018 at 09:38:16AM +0200, Lukas Wunner wrote: > On Wed, Sep 05, 2018 at 11:45:45AM +0530, Sreekanth Reddy wrote: > > On Tue, Sep 4, 2018 at 3:12 PM, Lukas Wunner <lukas@xxxxxxxxx> wrote: > > > Many scsi drivers call pci_channel_offline() to detect inaccessibility > > > of the device due to a PCI error: > > > https://elixir.bootlin.com/linux/v4.19-rc2/ident/pci_channel_offline > > > > > > A patch is pending such that surprise removal can also be queried > > > with that same function: > > > https://www.spinics.net/lists/linux-pci/msg75722.html > > > > Lukas, thanks for pointing to this pci_dev_is_disconnected() API. So > > we can use this API directly instead of reading the vendor Id and > > checking for all one's once this patch get accepted? > > Yes, except pci_dev_is_disconnected() is private to the PCI core, > but dev->error_state and pci_channel_offline() is public. The exported function to call is pci_device_is_present().