Commit 0e6b139d authored by Juergen Gross's avatar Juergen Gross

xen/pcifront: use xenbus_setup_ring() and xenbus_teardown_ring()

Simplify pcifront's shared page creation and removal via
xenbus_setup_ring() and xenbus_teardown_ring().
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
parent ae19265c
...@@ -709,9 +709,8 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev) ...@@ -709,9 +709,8 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev)
if (pdev == NULL) if (pdev == NULL)
goto out; goto out;
pdev->sh_info = if (xenbus_setup_ring(xdev, GFP_KERNEL, (void **)&pdev->sh_info, 1,
(struct xen_pci_sharedinfo *)__get_free_page(GFP_KERNEL); &pdev->gnt_ref)) {
if (pdev->sh_info == NULL) {
kfree(pdev); kfree(pdev);
pdev = NULL; pdev = NULL;
goto out; goto out;
...@@ -729,7 +728,6 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev) ...@@ -729,7 +728,6 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev)
spin_lock_init(&pdev->sh_info_lock); spin_lock_init(&pdev->sh_info_lock);
pdev->evtchn = INVALID_EVTCHN; pdev->evtchn = INVALID_EVTCHN;
pdev->gnt_ref = INVALID_GRANT_REF;
pdev->irq = -1; pdev->irq = -1;
INIT_WORK(&pdev->op_work, pcifront_do_aer); INIT_WORK(&pdev->op_work, pcifront_do_aer);
...@@ -754,11 +752,7 @@ static void free_pdev(struct pcifront_device *pdev) ...@@ -754,11 +752,7 @@ static void free_pdev(struct pcifront_device *pdev)
if (pdev->evtchn != INVALID_EVTCHN) if (pdev->evtchn != INVALID_EVTCHN)
xenbus_free_evtchn(pdev->xdev, pdev->evtchn); xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
if (pdev->gnt_ref != INVALID_GRANT_REF) xenbus_teardown_ring((void **)&pdev->sh_info, 1, &pdev->gnt_ref);
gnttab_end_foreign_access(pdev->gnt_ref,
(unsigned long)pdev->sh_info);
else
free_page((unsigned long)pdev->sh_info);
dev_set_drvdata(&pdev->xdev->dev, NULL); dev_set_drvdata(&pdev->xdev->dev, NULL);
...@@ -769,13 +763,6 @@ static int pcifront_publish_info(struct pcifront_device *pdev) ...@@ -769,13 +763,6 @@ static int pcifront_publish_info(struct pcifront_device *pdev)
{ {
int err = 0; int err = 0;
struct xenbus_transaction trans; struct xenbus_transaction trans;
grant_ref_t gref;
err = xenbus_grant_ring(pdev->xdev, pdev->sh_info, 1, &gref);
if (err < 0)
goto out;
pdev->gnt_ref = gref;
err = xenbus_alloc_evtchn(pdev->xdev, &pdev->evtchn); err = xenbus_alloc_evtchn(pdev->xdev, &pdev->evtchn);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment