aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-02-05 01:55:01 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-02-17 12:22:03 -0500
commit09cedbef4428580a09b342a7a92a262cfb5cbf25 (patch)
tree5ad0b8879ae0a3ef1cff5e5e82da4932ef1216e7 /drivers/pci
parentad71c96213a68dfe6d761e3ff7ac7ac267fd612a (diff)
PCI: Fix /sys warning when sriov enabled and card is hot removed
sysfs is a bit stricter now and emits warnings in more cases. For SRIOV hotplug, we are calling pci_stop_dev() for each VF first (after we update pci_stop_bus_devices) which remove each VF subdir. So double check the VF dir in /sys before trying to remove the physfn link. Signed-of-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/iov.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 0dab5ecf61b..687b3c8e8e3 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -173,7 +173,13 @@ static void virtfn_remove(struct pci_dev *dev, int id, int reset)
173 173
174 sprintf(buf, "virtfn%u", id); 174 sprintf(buf, "virtfn%u", id);
175 sysfs_remove_link(&dev->dev.kobj, buf); 175 sysfs_remove_link(&dev->dev.kobj, buf);
176 sysfs_remove_link(&virtfn->dev.kobj, "physfn"); 176 /*
177 * pci_stop_dev() could have been called for this virtfn already,
178 * so the directory for the virtfn may have been removed before.
179 * Double check to avoid spurious sysfs warnings.
180 */
181 if (virtfn->dev.kobj.sd)
182 sysfs_remove_link(&virtfn->dev.kobj, "physfn");
177 183
178 mutex_lock(&iov->dev->sriov->lock); 184 mutex_lock(&iov->dev->sriov->lock);
179 pci_remove_bus_device(virtfn); 185 pci_remove_bus_device(virtfn);