|
@@ -124,7 +124,6 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset)
|
|
struct pci_sriov *iov = dev->sriov;
|
|
struct pci_sriov *iov = dev->sriov;
|
|
struct pci_bus *bus;
|
|
struct pci_bus *bus;
|
|
|
|
|
|
- mutex_lock(&iov->dev->sriov->lock);
|
|
|
|
bus = virtfn_add_bus(dev->bus, pci_iov_virtfn_bus(dev, id));
|
|
bus = virtfn_add_bus(dev->bus, pci_iov_virtfn_bus(dev, id));
|
|
if (!bus)
|
|
if (!bus)
|
|
goto failed;
|
|
goto failed;
|
|
@@ -162,7 +161,6 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset)
|
|
__pci_reset_function(virtfn);
|
|
__pci_reset_function(virtfn);
|
|
|
|
|
|
pci_device_add(virtfn, virtfn->bus);
|
|
pci_device_add(virtfn, virtfn->bus);
|
|
- mutex_unlock(&iov->dev->sriov->lock);
|
|
|
|
|
|
|
|
pci_bus_add_device(virtfn);
|
|
pci_bus_add_device(virtfn);
|
|
sprintf(buf, "virtfn%u", id);
|
|
sprintf(buf, "virtfn%u", id);
|
|
@@ -181,12 +179,10 @@ failed2:
|
|
sysfs_remove_link(&dev->dev.kobj, buf);
|
|
sysfs_remove_link(&dev->dev.kobj, buf);
|
|
failed1:
|
|
failed1:
|
|
pci_dev_put(dev);
|
|
pci_dev_put(dev);
|
|
- mutex_lock(&iov->dev->sriov->lock);
|
|
|
|
pci_stop_and_remove_bus_device(virtfn);
|
|
pci_stop_and_remove_bus_device(virtfn);
|
|
failed0:
|
|
failed0:
|
|
virtfn_remove_bus(dev->bus, bus);
|
|
virtfn_remove_bus(dev->bus, bus);
|
|
failed:
|
|
failed:
|
|
- mutex_unlock(&iov->dev->sriov->lock);
|
|
|
|
|
|
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
@@ -195,7 +191,6 @@ void pci_iov_remove_virtfn(struct pci_dev *dev, int id, int reset)
|
|
{
|
|
{
|
|
char buf[VIRTFN_ID_LEN];
|
|
char buf[VIRTFN_ID_LEN];
|
|
struct pci_dev *virtfn;
|
|
struct pci_dev *virtfn;
|
|
- struct pci_sriov *iov = dev->sriov;
|
|
|
|
|
|
|
|
virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus),
|
|
virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus),
|
|
pci_iov_virtfn_bus(dev, id),
|
|
pci_iov_virtfn_bus(dev, id),
|
|
@@ -218,10 +213,8 @@ void pci_iov_remove_virtfn(struct pci_dev *dev, int id, int reset)
|
|
if (virtfn->dev.kobj.sd)
|
|
if (virtfn->dev.kobj.sd)
|
|
sysfs_remove_link(&virtfn->dev.kobj, "physfn");
|
|
sysfs_remove_link(&virtfn->dev.kobj, "physfn");
|
|
|
|
|
|
- mutex_lock(&iov->dev->sriov->lock);
|
|
|
|
pci_stop_and_remove_bus_device(virtfn);
|
|
pci_stop_and_remove_bus_device(virtfn);
|
|
virtfn_remove_bus(dev->bus, virtfn->bus);
|
|
virtfn_remove_bus(dev->bus, virtfn->bus);
|
|
- mutex_unlock(&iov->dev->sriov->lock);
|
|
|
|
|
|
|
|
/* balance pci_get_domain_bus_and_slot() */
|
|
/* balance pci_get_domain_bus_and_slot() */
|
|
pci_dev_put(virtfn);
|
|
pci_dev_put(virtfn);
|