[lkml]   [2012]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 2/9] PCI: Fix /sys warning when sriov enabled card is hot removed
During recent strick checking about sysfs_remove from Eric.
it will spit more bitter warning.

For SRIOV hotplug, we are calling pci_stop_dev() for VF at first.
(after we update pci_stop_bus_devices).

that pci_stop_dev will calling device_unregiste for that VF, so that directory
in VF is removed already.

We double checking if that VF dir in /sys is there, before try removing that
physfn link.

Signed-of-by: Yinghai Lu <>
drivers/pci/iov.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 0321fa3..dfc7d65 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -173,7 +173,12 @@ static void virtfn_remove(struct pci_dev *dev, int id, int reset)

sprintf(buf, "virtfn%u", id);
sysfs_remove_link(&dev->dev.kobj, buf);
- sysfs_remove_link(&virtfn->dev.kobj, "physfn");
+ /*
+ * pci_stop_dev() could be called for this virtfn before already
+ * so directory for the virtfn is removed before.
+ */
+ if (virtfn->
+ sysfs_remove_link(&virtfn->dev.kobj, "physfn");


 \ /
  Last update: 2012-02-05 07:59    [W:0.097 / U:8.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site