Re: [PATCH] PCI: pciehp: Report degraded links via link bandwidth notification

From: Mika Westerberg
Date: Thu Nov 29 2018 - 14:30:21 EST


On Thu, Nov 29, 2018 at 07:00:58PM +0000, Alex_Gagniuc@xxxxxxxxxxxx wrote:
> >> + if (link_status & PCI_EXP_LNKSTA_LBMS) {
> >> + if (pdev->subordinate && pdev->subordinate->self)
> >> + endpoint = pdev->subordinate->self;
> >
> > Hmm, I thought pdev->subordinate->self == pdev, no?
>
> That makes no sense, but I think you're right. I'm trying to get to the
> other end of the PCIe link. Is there a simple way to do that? (other
> than convoluted logic that all leads to the same mistake)

AFAIK you should be able to find the other end by looking at the
pdev->subordinate->devices list. Not sure if there is a simpler way,
though.