]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
arm/irq: Add helper function for setting interrupt type
authorParth Dixit <parth.dixit@linaro.org>
Wed, 2 Mar 2016 07:37:00 +0000 (08:37 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 15 Mar 2016 16:32:33 +0000 (16:32 +0000)
Add a helper function to set edge/level type information for an
interrupt.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
xen/arch/arm/irq.c
xen/include/asm-arm/irq.h

index 0ff5cbc0476492c1ec0019e13f9bcc6003a24b8a..2f8af7277037f4226beaf8421c782fb4e86a9236 100644 (file)
@@ -655,27 +655,32 @@ unlock:
     return ret;
 }
 
+int irq_set_type(unsigned int irq, unsigned int type)
+{
+    int res;
+
+    /* Setup the IRQ type */
+    if ( irq < NR_LOCAL_IRQS )
+        res = irq_local_set_type(irq, type);
+    else
+        res = irq_set_spi_type(irq, type);
+
+    return res;
+}
+
 int platform_get_irq(const struct dt_device_node *device, int index)
 {
     struct dt_irq dt_irq;
     unsigned int type, irq;
-    int res;
 
-    res = dt_device_get_irq(device, index, &dt_irq);
-    if ( res )
+    if ( dt_device_get_irq(device, index, &dt_irq) )
         return -1;
 
     irq = dt_irq.irq;
     type = dt_irq.type;
 
-    /* Setup the IRQ type */
-    if ( irq < NR_LOCAL_IRQS )
-        res = irq_local_set_type(irq, type);
-    else
-        res = irq_set_spi_type(irq, type);
-
-    if ( res )
-            return -1;
+    if ( irq_set_type(irq, type) )
+        return -1;
 
     return irq;
 }
index f33c3315acba64b3af3615274d053a87bf001e76..493773c0dd59a6a1ba171ebce580084a62b4cbb4 100644 (file)
@@ -52,6 +52,8 @@ void arch_move_irqs(struct vcpu *v);
 /* Set IRQ type for an SPI */
 int irq_set_spi_type(unsigned int spi, unsigned int type);
 
+int irq_set_type(unsigned int irq, unsigned int type);
+
 int platform_get_irq(const struct dt_device_node *device, int index);
 
 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);