linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: set correct value for iov device before device
@ 2013-05-30  5:45 Xudong Hao
  2013-05-30  6:03 ` Yijing Wang
  2013-05-30  6:04 ` Yinghai Lu
  0 siblings, 2 replies; 8+ messages in thread
From: Xudong Hao @ 2013-05-30  5:45 UTC (permalink / raw)
  To: bhelgaas; +Cc: yinghai, linux-pci, linux-kernel, Xudong Hao

Since device registering is put into pci_device_add(), it must set value of
Virtual Function device's member before the pci_dev is put to device tree. Or
some relevant subsystem of driver model such as xen will report a incorrect
IOV device to Xen hypervior.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
---
 drivers/pci/iov.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index c93071d..43d3de9 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -110,12 +110,12 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
 	if (reset)
 		__pci_reset_function(virtfn);
 
-	pci_device_add(virtfn, virtfn->bus);
-	mutex_unlock(&iov->dev->sriov->lock);
-
 	virtfn->physfn = pci_dev_get(dev);
 	virtfn->is_virtfn = 1;
 
+	pci_device_add(virtfn, virtfn->bus);
+	mutex_unlock(&iov->dev->sriov->lock);
+
 	rc = pci_bus_add_device(virtfn);
 	sprintf(buf, "virtfn%u", id);
 	rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
-- 
1.7.12.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-31  1:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30  5:45 [PATCH] PCI: set correct value for iov device before device Xudong Hao
2013-05-30  6:03 ` Yijing Wang
2013-05-30  6:04 ` Yinghai Lu
2013-05-30  6:26   ` Hao, Xudong
2013-05-30 20:27   ` Yinghai Lu
2013-05-30 23:22     ` Bjorn Helgaas
2013-05-31  0:54       ` Yinghai Lu
2013-05-31  1:29         ` Jiang Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).