WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 04/12] xen: events: return irq from xen_allocate_pirq

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH 04/12] xen: events: return irq from xen_allocate_pirq_msi
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 18 Feb 2011 16:43:29 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Ian Campbell <ian.campbell@xxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 18 Feb 2011 08:48:42 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1298047386.16356.3620.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1298047386.16356.3620.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
consistent with other similar functions.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 arch/x86/pci/xen.c   |   12 ++++++------
 drivers/xen/events.c |   19 +++++++++++--------
 include/xen/events.h |    2 +-
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index d1b72be..75a43a9 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -100,8 +100,8 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int 
nvec, int type)
                pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
                        ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff);
                if (xen_irq_from_pirq(pirq) >= 0 && msg.data == 
XEN_PIRQ_MSI_DATA) {
-                       xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
-                                       "msi-x" : "msi", &irq, &pirq, 0);
+                       irq = xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
+                                                   "msi-x" : "msi", &pirq, 0);
                        if (irq < 0)
                                goto error;
                        ret = set_irq_msi(irq, msidesc);
@@ -111,8 +111,8 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int 
nvec, int type)
                                        " pirq=%d\n", irq, pirq);
                        return 0;
                }
-               xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
-                               "msi-x" : "msi", &irq, &pirq, 1);
+               irq = xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
+                                           "msi-x" : "msi", &pirq, 1);
                if (irq < 0 || pirq < 0)
                        goto error;
                printk(KERN_DEBUG "xen: msi --> irq=%d, pirq=%d\n", irq, pirq);
@@ -157,10 +157,10 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int 
nvec, int type)
                goto error;
        i = 0;
        list_for_each_entry(msidesc, &dev->msi_list, list) {
-               xen_allocate_pirq_msi(
+               irq = xen_allocate_pirq_msi(
                        (type == PCI_CAP_ID_MSIX) ?
                        "pcifront-msi-x" : "pcifront-msi",
-                       &irq, &v[i], 0);
+                       &v[i], 0);
                if (irq < 0) {
                        ret = -1;
                        goto free;
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index e7c6c59..71d40bf 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -654,31 +654,34 @@ static int find_unbound_pirq(int type)
        return -1;
 }
 
-void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_pirq)
+int xen_allocate_pirq_msi(char *name, int *pirq, int alloc_pirq)
 {
+       int irq;
+
        spin_lock(&irq_mapping_update_lock);
 
-       *irq = xen_allocate_irq_dynamic();
-       if (*irq == -1)
+       irq = xen_allocate_irq_dynamic();
+       if (irq == -1)
                goto out;
 
        if (alloc_pirq) {
                *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI);
                if (*pirq == -1) {
-                       xen_free_irq(*irq);
-                       *irq = -1;
+                       xen_free_irq(irq);
+                       irq = -1;
                        goto out;
                }
        }
 
-       set_irq_chip_and_handler_name(*irq, &xen_pirq_chip,
+       set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
                                      handle_level_irq, name);
 
-       irq_info[*irq] = mk_pirq_info(0, *pirq, 0, 0);
-       pirq_to_irq[*pirq] = *irq;
+       irq_info[irq] = mk_pirq_info(0, *pirq, 0, 0);
+       pirq_to_irq[*pirq] = irq;
 
 out:
        spin_unlock(&irq_mapping_update_lock);
+       return irq;
 }
 
 int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
diff --git a/include/xen/events.h b/include/xen/events.h
index 88c738c..6c0360a 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -81,7 +81,7 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char 
*name);
 int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name);
 
 #ifdef CONFIG_PCI_MSI
-void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_pirq);
+int xen_allocate_pirq_msi(char *name, int *pirq, int alloc_pirq);
 int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int 
type);
 #endif
 
-- 
1.5.6.5


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

<Prev in Thread] Current Thread [Next in Thread>