xen: events: push set_irq_msi down into xen_create_msi_irq
authorIan Campbell <ian.campbell@citrix.com>
Fri, 18 Feb 2011 16:43:35 +0000 (16:43 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 10 Mar 2011 19:44:43 +0000 (14:44 -0500)
Makes the tail end of this function look even more like
xen_bind_pirq_msi_to_irq.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/pci/xen.c
drivers/xen/events.c

index 93e42152d8d09e9a4331b3acb2fb680165c461f0..15fd981d35f11e4b08c5b24fa93eef88c3ec6f88 100644 (file)
@@ -185,23 +185,15 @@ static void xen_teardown_msi_irq(unsigned int irq)
 #ifdef CONFIG_XEN_DOM0
 static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
-       int irq, ret;
+       int irq;
        struct msi_desc *msidesc;
 
        list_for_each_entry(msidesc, &dev->msi_list, list) {
                irq = xen_create_msi_irq(dev, msidesc, type);
                if (irq < 0)
                        return -1;
-
-               ret = set_irq_msi(irq, msidesc);
-               if (ret)
-                       goto error;
        }
        return 0;
-
-error:
-       xen_destroy_irq(irq);
-       return ret;
 }
 #endif
 #endif
index 721b393fd8aa26391dd2f652c90449c899633544..77ede77a9ee9f28741313f1ddfdc034bcba38cad 100644 (file)
@@ -691,7 +691,7 @@ error_irq:
 
 int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
 {
-       int irq = -1;
+       int ret, irq = -1;
        struct physdev_map_pirq map_irq;
        int rc;
        int pos;
@@ -736,9 +736,17 @@ int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
                        handle_level_irq,
                        (type == PCI_CAP_ID_MSIX) ? "msi-x":"msi");
 
+       ret = set_irq_msi(irq, msidesc);
+       if (ret)
+               goto out_irq;
+
 out:
        spin_unlock(&irq_mapping_update_lock);
        return irq;
+out_irq:
+       spin_unlock(&irq_mapping_update_lock);
+       xen_free_irq(irq);
+       return -1;
 }
 #endif