[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 15/31] Improper assumption that event channel == IRQ number.



We save now the IRQ number returned from bind_evtchn_to_irqhandler.
That value is now used by 'unbind_from_irqhandler' instead of
improper event channel number.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 drivers/xen/pcifront/pcifront.h |    2 ++
 drivers/xen/pcifront/xenbus.c   |   12 ++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/pcifront/pcifront.h b/drivers/xen/pcifront/pcifront.h
index 82364c4..909726b 100644
--- a/drivers/xen/pcifront/pcifront.h
+++ b/drivers/xen/pcifront/pcifront.h
@@ -31,6 +31,8 @@ struct pcifront_device {
        int evtchn;
        int gnt_ref;
 
+       int irq;
+
        /* Lock this when doing any operations in sh_info */
        spinlock_t sh_info_lock;
        struct xen_pci_sharedinfo *sh_info;
diff --git a/drivers/xen/pcifront/xenbus.c b/drivers/xen/pcifront/xenbus.c
index c2ef1de..8d8c2ca 100644
--- a/drivers/xen/pcifront/xenbus.c
+++ b/drivers/xen/pcifront/xenbus.c
@@ -49,6 +49,7 @@ static struct pcifront_device *alloc_pdev(struct 
xenbus_device *xdev)
 
        pdev->evtchn = INVALID_EVTCHN;
        pdev->gnt_ref = INVALID_GRANT_REF;
+       pdev->irq = -1;
 
        INIT_WORK(&pdev->op_work, pcifront_do_aer);
 
@@ -66,7 +67,7 @@ static void free_pdev(struct pcifront_device *pdev)
 
        /*For PCIE_AER error handling job*/
        flush_scheduled_work();
-       unbind_from_irqhandler(pdev->evtchn, pdev);
+       unbind_from_irqhandler(pdev->irq, pdev);
 
        if (pdev->evtchn != INVALID_EVTCHN)
                xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
@@ -95,8 +96,15 @@ static int pcifront_publish_info(struct pcifront_device 
*pdev)
        if (err)
                goto out;
 
-       bind_evtchn_to_irqhandler(pdev->evtchn, pcifront_handler_aer, 
+       err = bind_evtchn_to_irqhandler(pdev->evtchn, pcifront_handler_aer, 
                0, "pcifront", pdev); 
+       if (err < 0) {
+               xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
+               xenbus_dev_fatal(pdev->xdev, err, "Failed to bind evtchn to "
+                                "irqhandler.\n");
+               return err;
+       }
+       pdev->irq = err;
 
       do_publish:
        err = xenbus_transaction_start(&trans);
-- 
1.6.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.