On Mon, Jun 06, 2016 at 02:46:36PM +0200, Alexander Gordeev wrote: > Cc: Thomas Huth <thuth@xxxxxxxxxx> > Cc: Andrew Jones <drjones@xxxxxxxxxx> > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx> > --- > lib/pci.c | 6 ++++++ > lib/pci.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/lib/pci.c b/lib/pci.c > index c9b2daa6a4ce..5c107e7b4f4e 100644 > --- a/lib/pci.c > +++ b/lib/pci.c > @@ -7,6 +7,12 @@ > #include "pci.h" > #include "asm/pci.h" > > +bool pci_dev_exists(pcidevaddr_t dev) > +{ > + return (pci_config_readw(dev, PCI_VENDOR_ID) != (uint16_t)~0 && > + pci_config_readw(dev, PCI_DEVICE_ID) != (uint16_t)~0); I'd prefer 0xffff, it's even 6 less characters :-) > +} > + > /* Scan bus look for a specific device. Only bus 0 scanned for now. */ > pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id) > { > diff --git a/lib/pci.h b/lib/pci.h > index a51d2ff52cec..db8296b2dfa7 100644 > --- a/lib/pci.h > +++ b/lib/pci.h > @@ -14,6 +14,7 @@ typedef uint16_t pcidevaddr_t; > enum { > PCIDEVADDR_INVALID = 0xffff, > }; a blank line here would be nice > +bool pci_dev_exists(pcidevaddr_t dev); > pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id); > > /* > -- > 1.8.3.1 Otherwise, Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html