On Mon, Apr 11, 2016 at 01:50:51PM +0200, Andrew Jones wrote: > On Mon, Apr 11, 2016 at 01:04:16PM +0200, Alexander Gordeev wrote: > > Cc: Thomas Huth <thuth@xxxxxxxxxx> > > Cc: Andrew Jones <drjones@xxxxxxxxxx> > > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx> > > --- > > lib/pci.c | 36 ++++++++++++++++++------------------ > > lib/pci.h | 2 +- > > 2 files changed, 19 insertions(+), 19 deletions(-) > > > > diff --git a/lib/pci.c b/lib/pci.c > > index 0058d70c888d..9295c35da43d 100644 > > --- a/lib/pci.c > > +++ b/lib/pci.c > > @@ -10,34 +10,34 @@ > > /* 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) > > { > > - unsigned dev; > > - for (dev = 0; dev < 256; ++dev) { > > - uint32_t id = pci_config_read(dev, 0); > > - if ((id & 0xFFFF) == vendor_id && (id >> 16) == device_id) { > > - return dev; > > - } > > - } > > - return PCIDEVADDR_INVALID; > > + unsigned dev; > > While at it add an empty line here. This and likely following such suggestions are addressed in a following rework patch. Both patches seem good to me for fixing the style - just let me know whichever you prefer ;) > > + for (dev = 0; dev < 256; ++dev) { > > + uint32_t id = pci_config_read(dev, 0); > > + if ((id & 0xFFFF) == vendor_id && (id >> 16) == device_id) { > > + return dev; > > + } > > Can drop these {} > > > + } > > + return PCIDEVADDR_INVALID; > > } > > > > unsigned long pci_bar_addr(pcidevaddr_t dev, int bar_num) > > { > > - uint32_t bar = pci_config_read(dev, PCI_BASE_ADDRESS_0 + bar_num * 4); > > - if (bar & PCI_BASE_ADDRESS_SPACE_IO) { > > - return bar & PCI_BASE_ADDRESS_IO_MASK; > > - } else { > > - return bar & PCI_BASE_ADDRESS_MEM_MASK; > > - } > > + uint32_t bar = pci_config_read(dev, PCI_BASE_ADDRESS_0 + bar_num * 4); > > Need empty line here. > > > + if (bar & PCI_BASE_ADDRESS_SPACE_IO) { > > + return bar & PCI_BASE_ADDRESS_IO_MASK; > > + } else { > > + return bar & PCI_BASE_ADDRESS_MEM_MASK; > > + } > > Can drop the {} in the if and else here too. > > > } > > > > bool pci_bar_is_memory(pcidevaddr_t dev, int bar_num) > > { > > - uint32_t bar = pci_config_read(dev, PCI_BASE_ADDRESS_0 + bar_num * 4); > > - return !(bar & PCI_BASE_ADDRESS_SPACE_IO); > > + uint32_t bar = pci_config_read(dev, PCI_BASE_ADDRESS_0 + bar_num * 4); > > + return !(bar & PCI_BASE_ADDRESS_SPACE_IO); > > } > > > > bool pci_bar_is_valid(pcidevaddr_t dev, int bar_num) > > { > > - uint32_t bar = pci_config_read(dev, PCI_BASE_ADDRESS_0 + bar_num * 4); > > - return bar; > > + uint32_t bar = pci_config_read(dev, PCI_BASE_ADDRESS_0 + bar_num * 4); > > + return bar; > > } > > diff --git a/lib/pci.h b/lib/pci.h > > index 9160cfb5950d..88dc47c1f48d 100644 > > --- a/lib/pci.h > > +++ b/lib/pci.h > > @@ -12,7 +12,7 @@ > > > > typedef uint16_t pcidevaddr_t; > > enum { > > - PCIDEVADDR_INVALID = 0xffff, > > + PCIDEVADDR_INVALID = 0xffff, > > }; > > pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id); > > unsigned long pci_bar_addr(pcidevaddr_t dev, int bar_num); > > -- > > 1.8.3.1 > > > > -- > > 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 -- 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