genirq: Introduce helper function irq_data_get_node()
authorJiang Liu <jiang.liu@linux.intel.com>
Mon, 1 Jun 2015 08:05:13 +0000 (16:05 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 12 Jun 2015 14:54:21 +0000 (16:54 +0200)
Introduce helper function irq_data_get_node() and variants thereof to
hide struct irq_data implementation details.

Convert the core code to use them.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Link: http://lkml.kernel.org/r/1433145945-789-5-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/irq.h
kernel/irq/internals.h
kernel/irq/irqdesc.c
kernel/irq/irqdomain.c
kernel/irq/manage.c
kernel/irq/proc.c

index 3c7fbe44edaec2c906608f84c6d835d4198c49cc..b3b82a5344c88a912dd2de1ea71ba246afa2d880 100644 (file)
@@ -640,6 +640,11 @@ static inline u32 irq_get_trigger_type(unsigned int irq)
        return d ? irqd_get_trigger_type(d) : 0;
 }
 
+static inline int irq_data_get_node(struct irq_data *d)
+{
+       return d->node;
+}
+
 unsigned int arch_dynirq_lower_bound(unsigned int from);
 
 int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
index a1ed80d11800d83a5a387a902ba5b3c0f897917d..4834ee828c41e8ee9dd8e8e4fb15e03e66c037e1 100644 (file)
@@ -197,6 +197,11 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq, struct irq_desc *d
        __this_cpu_inc(kstat.irqs_sum);
 }
 
+static inline int irq_desc_get_node(struct irq_desc *desc)
+{
+       return irq_data_get_node(&desc->irq_data);
+}
+
 #ifdef CONFIG_PM_SLEEP
 bool irq_pm_check_wakeup(struct irq_desc *desc);
 void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action);
index eac1aac906eac77253279cf5cfc27930d4ef0a78..b18d3f1d73d9ed21baac0806f238b62c75adb078 100644 (file)
@@ -59,16 +59,10 @@ static void desc_smp_init(struct irq_desc *desc, int node)
 #endif
 }
 
-static inline int desc_node(struct irq_desc *desc)
-{
-       return desc->irq_data.node;
-}
-
 #else
 static inline int
 alloc_masks(struct irq_desc *desc, gfp_t gfp, int node) { return 0; }
 static inline void desc_smp_init(struct irq_desc *desc, int node) { }
-static inline int desc_node(struct irq_desc *desc) { return 0; }
 #endif
 
 static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,
@@ -300,7 +294,7 @@ static void free_desc(unsigned int irq)
        unsigned long flags;
 
        raw_spin_lock_irqsave(&desc->lock, flags);
-       desc_set_defaults(irq, desc, desc_node(desc), NULL);
+       desc_set_defaults(irq, desc, irq_desc_get_node(desc), NULL);
        raw_spin_unlock_irqrestore(&desc->lock, flags);
 }
 
index 3552b8750efd888940d873c707d9543884bc69d9..1b06dfed4574ec605cd0edee5d8f8f67574cf94e 100644 (file)
@@ -830,7 +830,8 @@ static struct irq_data *irq_domain_insert_irq_data(struct irq_domain *domain,
 {
        struct irq_data *irq_data;
 
-       irq_data = kzalloc_node(sizeof(*irq_data), GFP_KERNEL, child->node);
+       irq_data = kzalloc_node(sizeof(*irq_data), GFP_KERNEL,
+                               irq_data_get_node(child));
        if (irq_data) {
                child->parent_data = irq_data;
                irq_data->irq = child->irq;
index b1c7e8f46bfb2f1019f90846448aeda5628df10f..f9744853b656976bc4fdc49e006464a08a7d5395 100644 (file)
@@ -363,7 +363,7 @@ static int
 setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask)
 {
        struct cpumask *set = irq_default_affinity;
-       int node = desc->irq_data.node;
+       int node = irq_desc_get_node(desc);
 
        /* Excludes PER_CPU and NO_BALANCE interrupts */
        if (!irq_can_set_affinity(irq))
index df2f4642d1e7bd3892bcc4e5ecc29153a7f132af..0e97c142ce402b0492c876b909c40ac10d40c779 100644 (file)
@@ -241,7 +241,7 @@ static int irq_node_proc_show(struct seq_file *m, void *v)
 {
        struct irq_desc *desc = irq_to_desc((long) m->private);
 
-       seq_printf(m, "%d\n", desc->irq_data.node);
+       seq_printf(m, "%d\n", irq_desc_get_node(desc));
        return 0;
 }