Re: [PATCH 2/3] Split off sysfs id retrieval

Chris Wright
2009-12-15T19:57:48Z

* Michael S. Tsirkin (mst@redhat.com) wrote:
> On Tue, Dec 15, 2009 at 07:30:27PM +0100, Alexander Graf wrote:
> > To retreive device and vendor ID from a PCI device, we need to read a
> > sysfs file. That code is currently hand written at least two times,
> > the later patch introducing two more calls.
> >
> > So let's move that out to a function.
> >
> > Signed-off-by: Alexander Graf <agraf@suse.de>
>
> Shouldn't we be using libpci, as we already do
> in other places?

The main issue is making sure we get the cooked value of vendor and
device id (they are invalid in config space for VFs). I looked at
this before (w/ the same intention) and concluded it wasn't a benefit
(of course, I can't recall why now...re-reading libpci, as long as we
force PCI_ACCESS_SYS_BUS_PCI it does the right read).

Anyway, this is a simple, nice cleanup.

Acked-by: Chris Wright <chrisw@redhat.com>