/* Returns max number of buses (exclude current one) used by Virtual Functions.  */
int pci_iov_bus_range(struct pci_bus *bus)
/* Returns max number of buses (exclude current one) used by Virtual Functions.  */
int pci_iov_bus_range(struct pci_bus *bus)
{
	int max = 0;
	u8 busnr;
	struct pci_dev *dev;
	list_for_each_entry(dev, &bus->devices, bus_list) {
		if (!dev->is_physfn)
			continue;
		busnr = virtfn_bus(dev, dev->sriov->total - 1);
		if (busnr > max)
			max = busnr;
	}
	return max ? max - bus->number : 0;
}