]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen/smp: Coalesce the free_irq calls in one function.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 4 Jun 2013 20:31:34 +0000 (16:31 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 7 Jun 2013 17:32:04 +0000 (13:32 -0400)
There are two functions that do a bunch of 'free_irq' on
the per_cpu IRQ. Instead of having duplicate code just move
it to one function.

This is just code movement.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/xen/smp.c

index d99cae8147d1243b84faa111bcd74b447e5ff7ec..85efd049787ade419b9f2e4de32bee4e1b277b79 100644 (file)
@@ -99,6 +99,23 @@ static void __cpuinit cpu_bringup_and_idle(void)
        cpu_startup_entry(CPUHP_ONLINE);
 }
 
+static void xen_smp_intr_free(unsigned int cpu)
+{
+       if (per_cpu(xen_resched_irq, cpu) >= 0)
+               unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
+       if (per_cpu(xen_callfunc_irq, cpu) >= 0)
+               unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
+       if (per_cpu(xen_debug_irq, cpu) >= 0)
+               unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
+       if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
+               unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu),
+                                      NULL);
+       if (xen_hvm_domain())
+               return;
+
+       if (per_cpu(xen_irq_work, cpu) >= 0)
+               unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
+};
 static int xen_smp_intr_init(unsigned int cpu)
 {
        int rc;
@@ -166,21 +183,7 @@ static int xen_smp_intr_init(unsigned int cpu)
        return 0;
 
  fail:
-       if (per_cpu(xen_resched_irq, cpu) >= 0)
-               unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
-       if (per_cpu(xen_callfunc_irq, cpu) >= 0)
-               unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
-       if (per_cpu(xen_debug_irq, cpu) >= 0)
-               unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
-       if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
-               unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu),
-                                      NULL);
-       if (xen_hvm_domain())
-               return rc;
-
-       if (per_cpu(xen_irq_work, cpu) >= 0)
-               unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
-
+       xen_smp_intr_free(cpu);
        return rc;
 }
 
@@ -433,12 +436,7 @@ static void xen_cpu_die(unsigned int cpu)
                current->state = TASK_UNINTERRUPTIBLE;
                schedule_timeout(HZ/10);
        }
-       unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
-       unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
-       unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
-       unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
-       if (!xen_hvm_domain())
-               unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
+       xen_smp_intr_free(cpu);
        xen_uninit_lock_cpu(cpu);
        xen_teardown_timer(cpu);
 }