On Tue, Nov 08, 2016 at 02:43:53PM +0100, Alexander Gordeev wrote: [...] > > > @@ -386,20 +385,14 @@ int main(int ac, char **av) > > > pm_tmr_blk = fadt->pm_tmr_blk; > > > printf("PM timer port is %x\n", pm_tmr_blk); > > > > > > - ret = pci_find_dev(&pcidev, PCI_VENDOR_ID_REDHAT, > > > - PCI_DEVICE_ID_REDHAT_TEST); > > > - if (ret == 0) { > > > - for (i = 0; i < PCI_TESTDEV_NUM_BARS; i++) { > > > - if (!pci_bar_is_valid(&pcidev, i)) { > > > - continue; > > > - } > > > - if (pci_bar_is_memory(&pcidev, i)) { > > > - membar = pci_bar_get_addr(&pcidev, i); > > > - pci_test.memaddr = ioremap(membar, PAGE_SIZE); > > > - } else { > > > - pci_test.iobar = pci_bar_get_addr(&pcidev, i); > > > - } > > > - } > > > + if (!pci_find_dev(&pcidev, PCI_VENDOR_ID_REDHAT, > > > + PCI_DEVICE_ID_REDHAT_TEST)) { > > > + pci_scan_bars(&pcidev); > > I think if you attempt to cache all viable information in a pci_dev > structure then pci_scan_bars() should be mandatory to call when the > pci_dev is initilized. IOW, it needs to be called in pci_dev_init(). Yeah, I can put it into pci_dev_init(). Anyway, it's only a caching operation. But I also like Drew's idea about pci_enable_defaults() and to make sure pci_dev_init() the minimum. Then, the caller will decide what to do. Again I think it's a matter of taste, and both work for me. :-) Thanks, -- peterx -- 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