/* Look at global flags, the device itself, and its parent busses to determine if MSI/-X are supported for the device. If MSI/-X is supported return 0, else return an error code.  */
static int pci_msi_check_device(struct pci_dev *dev, int nvec, int type)
/* Look at global flags, the device itself, and its parent busses to determine if MSI/-X are supported for the device. If MSI/-X is supported return 0, else return an error code.  */
static int pci_msi_check_device(struct pci_dev *dev, int nvec, int type)
{
	struct pci_bus *bus;
	int ret;
	if (!pci_msi_enable || !dev || dev->no_msi)
		return -EINVAL;
	if (nvec < 1)
		return -ERANGE;
	for (bus = dev->bus; bus; bus = bus->parent)
		if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
			return -EINVAL;
	ret = arch_msi_check_device(dev, nvec, type);
	if (ret)
		return ret;
	if (!pci_find_capability(dev, type))
		return -EINVAL;
	return 0;
}