On Wed, Nov 09, 2016 at 10:10:18AM -0500, Peter Xu wrote: > Provide a function to do most of the common PCI init work. > > Suggested-by: Andrew Jones <drjones@xxxxxxxxxx> > Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> > --- > lib/pci.c | 8 ++++++++ > lib/pci.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/lib/pci.c b/lib/pci.c > index fd17ea5..971f02e 100644 > --- a/lib/pci.c > +++ b/lib/pci.c > @@ -249,3 +249,11 @@ void pci_scan_bars(struct pci_dev *dev) > dev->bar[i] = pci_bar_get_addr(dev, i); > } > } > + > +int pci_enable_defaults(struct pci_dev *dev) > +{ > + pci_scan_bars(dev); > + /* Enable device DMA operations */ > + pci_cmd_set_clr(dev, PCI_COMMAND_MASTER, 0); > + return 0; Shouldn't this be a void function that just asserts on any errors it detects? I'm not sure why we're [currently unconditionally] returning zero. > +} > diff --git a/lib/pci.h b/lib/pci.h > index de15086..63f8a0a 100644 > --- a/lib/pci.h > +++ b/lib/pci.h > @@ -26,6 +26,7 @@ struct pci_dev { > void pci_dev_init(struct pci_dev *dev, pcidevaddr_t bdf); > void pci_scan_bars(struct pci_dev *dev); > void pci_cmd_set_clr(struct pci_dev *dev, uint16_t set, uint16_t clr); > +int pci_enable_defaults(struct pci_dev *dev); > > extern bool pci_probe(void); > extern void pci_print(void); > -- > 2.7.4 > 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