Skip to content

Commit

Permalink
xen/pciback: Move the PCI_DEV_FLAGS_ASSIGNED ops to the "[un|]bind"
Browse files Browse the repository at this point in the history
operation instead of doing it per guest creation/disconnection. Without
this we could have potentially unloaded the vf driver from the
xen pciback control even if the driver was binded to the xen-pciback.
This will hold on to it until the user "unbind"s the PCI device using
SysFS.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Konrad Rzeszutek Wilk committed Jan 8, 2012
1 parent a800651 commit 97309d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions drivers/xen/xen-pciback/pci_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static void pcistub_device_release(struct kref *kref)
kfree(pci_get_drvdata(psdev->dev));
pci_set_drvdata(psdev->dev, NULL);

psdev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
pci_dev_put(psdev->dev);

kfree(psdev);
Expand Down Expand Up @@ -331,6 +332,7 @@ static int __devinit pcistub_init_device(struct pci_dev *dev)
dev_dbg(&dev->dev, "reset device\n");
xen_pcibk_reset_device(dev);

dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
return 0;

config_release:
Expand Down
2 changes: 0 additions & 2 deletions drivers/xen/xen-pciback/xenbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ static int xen_pcibk_export_device(struct xen_pcibk_device *pdev,
goto out;

dev_dbg(&dev->dev, "registering for %d\n", pdev->xdev->otherend_id);
dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
if (xen_register_device_domain_owner(dev,
pdev->xdev->otherend_id) != 0) {
dev_err(&dev->dev, "device has been assigned to another " \
Expand Down Expand Up @@ -281,7 +280,6 @@ static int xen_pcibk_remove_device(struct xen_pcibk_device *pdev,
}

dev_dbg(&dev->dev, "unregistering for %d\n", pdev->xdev->otherend_id);
dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
xen_unregister_device_domain_owner(dev);

xen_pcibk_release_pci_dev(pdev, dev);
Expand Down

0 comments on commit 97309d3

Please sign in to comment.