Re: [PATCH 2/3] PCI: Allow specifying devices using a base bus and path of devfns

From: Logan Gunthorpe
Date: Wed May 30 2018 - 13:36:47 EST




On 30/05/18 10:23 AM, Alex Williamson wrote:
> I like the idea, but can't we improve the implementation? It seems
> that we shouldn't need to allocate more than a working copy of the
> original path string. We can use strrchr() to find the last path
> divider ('/'), match the slot.fn after that to the current devfn, set
> that path divider to null, step to the next upstream device and
> repeat.

Ok, I'll give it a shot. I thought this would be a bit more tricky, but
perhaps not.

> Also, since we're working from a downstream device up, I
> suspect we don't need to get and put references at each step, the
> downstream device probably already holds a reference to the upstream
> device for each step along the way.

That makes sense to me. I think it's something I added in similar p2pdma
code from somebody's review. But sounds like I can probably strip it out
there too and just put a comment noting this.

Thanks,

Logan