From: Konrad Rzeszutek Wilk Subject: [PATCH 15/31] Improper assumption that event channel == IRQ number. Date: Thu, 5 Nov 2009 16:33:23 -0500 Message-ID: <1257456819-782-16-git-send-email-konrad.wilk@oracle.com> References: <1257456819-782-1-git-send-email-konrad.wilk@oracle.com> <1257456819-782-2-git-send-email-konrad.wilk@oracle.com> <1257456819-782-3-git-send-email-konrad.wilk@oracle.com> <1257456819-782-4-git-send-email-konrad.wilk@oracle.com> <1257456819-782-5-git-send-email-konrad.wilk@oracle.com> <1257456819-782-6-git-send-email-konrad.wilk@oracle.com> <1257456819-782-7-git-send-email-konrad.wilk@oracle.com> <1257456819-782-8-git-send-email-konrad.wilk@oracle.com> <1257456819-782-9-git-send-email-konrad.wilk@oracle.com> <1257456819-782-10-git-send-email-konrad.wilk@oracle.com> <1257456819-782-11-git-send-email-konrad.wilk@oracle.com> <1257456819-782-12-git-send-email-konrad.wilk@oracle.com> <1257456819-782-13-git-send-email-konrad.wilk@oracle.com> <1257456819-782-14-git-send-email-konrad.wilk@oracle.com> <1257456819-782-15-git-send-email-konrad.wilk@oracle.com> Return-path: In-Reply-To: <1257456819-782-15-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Jeremy Fitzhardinge , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org 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 --- 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