genirq: Provide and use __irq_can_set_affinity()
authorJiang Liu <jiang.liu@linux.intel.com>
Tue, 23 Jun 2015 18:29:34 +0000 (20:29 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 11 Jul 2015 21:14:25 +0000 (23:14 +0200)
Provide a irq_desc based variant of irq_can_set_affinity() to avoid a
redundant lookup for the core code users.

[ tglx: Split out from combo patch ]

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/irq/manage.c

index d526ac1eb0d13c2de1d69123914619c2f61ce768..f5b7742237782e06a540948e136b9d7e057e5a3f 100644 (file)
@@ -115,6 +115,14 @@ EXPORT_SYMBOL(synchronize_irq);
 #ifdef CONFIG_SMP
 cpumask_var_t irq_default_affinity;
 
+static int __irq_can_set_affinity(struct irq_desc *desc)
+{
+       if (!desc || !irqd_can_balance(&desc->irq_data) ||
+           !desc->irq_data.chip || !desc->irq_data.chip->irq_set_affinity)
+               return 0;
+       return 1;
+}
+
 /**
  *     irq_can_set_affinity - Check if the affinity of a given irq can be set
  *     @irq:           Interrupt to check
@@ -122,13 +130,7 @@ cpumask_var_t irq_default_affinity;
  */
 int irq_can_set_affinity(unsigned int irq)
 {
-       struct irq_desc *desc = irq_to_desc(irq);
-
-       if (!desc || !irqd_can_balance(&desc->irq_data) ||
-           !desc->irq_data.chip || !desc->irq_data.chip->irq_set_affinity)
-               return 0;
-
-       return 1;
+       return __irq_can_set_affinity(irq_to_desc(irq));
 }
 
 /**
@@ -366,7 +368,7 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask)
        int node = irq_desc_get_node(desc);
 
        /* Excludes PER_CPU and NO_BALANCE interrupts */
-       if (!irq_can_set_affinity(irq))
+       if (!__irq_can_set_affinity(desc))
                return 0;
 
        /*