aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xen-pciback/xenbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen/xen-pciback/xenbus.c')
-rw-r--r--drivers/xen/xen-pciback/xenbus.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 075525945e36..8e1c44d8ab46 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -241,11 +241,10 @@ static int xen_pcibk_export_device(struct xen_pcibk_device *pdev,
241 goto out; 241 goto out;
242 242
243 dev_dbg(&dev->dev, "registering for %d\n", pdev->xdev->otherend_id); 243 dev_dbg(&dev->dev, "registering for %d\n", pdev->xdev->otherend_id);
244 dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
245 if (xen_register_device_domain_owner(dev, 244 if (xen_register_device_domain_owner(dev,
246 pdev->xdev->otherend_id) != 0) { 245 pdev->xdev->otherend_id) != 0) {
247 dev_err(&dev->dev, "device has been assigned to another " \ 246 dev_err(&dev->dev, "Stealing ownership from dom%d.\n",
248 "domain! Over-writting the ownership, but beware.\n"); 247 xen_find_device_domain_owner(dev));
249 xen_unregister_device_domain_owner(dev); 248 xen_unregister_device_domain_owner(dev);
250 xen_register_device_domain_owner(dev, pdev->xdev->otherend_id); 249 xen_register_device_domain_owner(dev, pdev->xdev->otherend_id);
251 } 250 }
@@ -281,7 +280,6 @@ static int xen_pcibk_remove_device(struct xen_pcibk_device *pdev,
281 } 280 }
282 281
283 dev_dbg(&dev->dev, "unregistering for %d\n", pdev->xdev->otherend_id); 282 dev_dbg(&dev->dev, "unregistering for %d\n", pdev->xdev->otherend_id);
284 dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
285 xen_unregister_device_domain_owner(dev); 283 xen_unregister_device_domain_owner(dev);
286 284
287 xen_pcibk_release_pci_dev(pdev, dev); 285 xen_pcibk_release_pci_dev(pdev, dev);
@@ -707,19 +705,16 @@ static int xen_pcibk_xenbus_remove(struct xenbus_device *dev)
707 return 0; 705 return 0;
708} 706}
709 707
710static const struct xenbus_device_id xenpci_ids[] = { 708static const struct xenbus_device_id xen_pcibk_ids[] = {
711 {"pci"}, 709 {"pci"},
712 {""}, 710 {""},
713}; 711};
714 712
715static struct xenbus_driver xenbus_xen_pcibk_driver = { 713static DEFINE_XENBUS_DRIVER(xen_pcibk, DRV_NAME,
716 .name = DRV_NAME,
717 .owner = THIS_MODULE,
718 .ids = xenpci_ids,
719 .probe = xen_pcibk_xenbus_probe, 714 .probe = xen_pcibk_xenbus_probe,
720 .remove = xen_pcibk_xenbus_remove, 715 .remove = xen_pcibk_xenbus_remove,
721 .otherend_changed = xen_pcibk_frontend_changed, 716 .otherend_changed = xen_pcibk_frontend_changed,
722}; 717);
723 718
724const struct xen_pcibk_backend *__read_mostly xen_pcibk_backend; 719const struct xen_pcibk_backend *__read_mostly xen_pcibk_backend;
725 720
@@ -735,11 +730,11 @@ int __init xen_pcibk_xenbus_register(void)
735 if (passthrough) 730 if (passthrough)
736 xen_pcibk_backend = &xen_pcibk_passthrough_backend; 731 xen_pcibk_backend = &xen_pcibk_passthrough_backend;
737 pr_info(DRV_NAME ": backend is %s\n", xen_pcibk_backend->name); 732 pr_info(DRV_NAME ": backend is %s\n", xen_pcibk_backend->name);
738 return xenbus_register_backend(&xenbus_xen_pcibk_driver); 733 return xenbus_register_backend(&xen_pcibk_driver);
739} 734}
740 735
741void __exit xen_pcibk_xenbus_unregister(void) 736void __exit xen_pcibk_xenbus_unregister(void)
742{ 737{
743 destroy_workqueue(xen_pcibk_wq); 738 destroy_workqueue(xen_pcibk_wq);
744 xenbus_unregister_driver(&xenbus_xen_pcibk_driver); 739 xenbus_unregister_driver(&xen_pcibk_driver);
745} 740}