Re: [PATCH 20/24] thunderbolt: Do not touch the hardware if the NHI is gone on resume

From: Mika Westerberg
Date: Thu May 25 2017 - 03:12:45 EST


On Wed, May 24, 2017 at 04:43:10PM +0200, Lukas Wunner wrote:
> On Thu, May 18, 2017 at 05:39:10PM +0300, Mika Westerberg wrote:
> > @@ -655,6 +659,16 @@ static int nhi_resume_noirq(struct device *dev)
> > {
> > struct pci_dev *pdev = to_pci_dev(dev);
> > struct tb *tb = pci_get_drvdata(pdev);
> > + u32 vid;
> > +
> > + /*
> > + * Check that the device is still there. It may be that the user
> > + * unplugged last device which causes the host controller to go
> > + * away on PCs.
> > + */
> > + pci_read_config_dword(pdev, PCI_VENDOR_ID, &vid);
> > + if (vid == ~0)
> > + tb->nhi->going_away = true;
>
> if (!pci_device_is_present(pdev))

Sure.