aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-10 06:29:27 -0400
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 10:53:41 -0400
commit349d67673c08cbc299a69086b0f5447cf1094e9b (patch)
tree6598e36307508626d8c8e6661787f6b9e842cdaf /drivers
parent423f085952fd7253407cb92984cc2d495a564481 (diff)
intr_remap: Use irq_2_iommu in struct irq_cfg
Switch the intr_remapping code to use the irq_2_iommu struct in irg_cfg. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu> Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/intr_remapping.c39
1 files changed, 3 insertions, 36 deletions
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index 0f4691c5fab3..ea46935422ff 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -46,54 +46,21 @@ static __init int setup_intremap(char *str)
46} 46}
47early_param("intremap", setup_intremap); 47early_param("intremap", setup_intremap);
48 48
49#ifdef CONFIG_GENERIC_HARDIRQS
50static struct irq_2_iommu *irq_2_iommu(unsigned int irq) 49static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
51{ 50{
52 return get_irq_iommu(irq); 51 struct irq_cfg *cfg = get_irq_chip_data(irq);
52 return cfg ? &cfg->irq_2_iommu : NULL;
53} 53}
54 54
55static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq) 55static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
56{ 56{
57 struct irq_data *data = irq_get_irq_data(irq); 57 return irq_2_iommu(irq);
58
59 if (WARN_ONCE(data->irq_2_iommu,
60 KERN_DEBUG "irq_2_iommu!=NULL irq %u\n", irq))
61 return data->irq_2_iommu;
62
63 data->irq_2_iommu = kzalloc_node(sizeof(*data->irq_2_iommu),
64 GFP_ATOMIC, data->node);
65 return data->irq_2_iommu;
66} 58}
67 59
68static void irq_2_iommu_free(unsigned int irq) 60static void irq_2_iommu_free(unsigned int irq)
69{ 61{
70 struct irq_data *d = irq_get_irq_data(irq);
71 struct irq_2_iommu *p = d->irq_2_iommu;
72
73 d->irq_2_iommu = NULL;
74 kfree(p);
75} 62}
76 63
77#else /* !CONFIG_SPARSE_IRQ */
78
79static struct irq_2_iommu irq_2_iommuX[NR_IRQS];
80
81static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
82{
83 if (irq < nr_irqs)
84 return &irq_2_iommuX[irq];
85
86 return NULL;
87}
88static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
89{
90 return irq_2_iommu(irq);
91}
92
93static void irq_2_iommu_free(unsigned int irq) { }
94
95#endif
96
97static DEFINE_SPINLOCK(irq_2_ir_lock); 64static DEFINE_SPINLOCK(irq_2_ir_lock);
98 65
99static struct irq_2_iommu *valid_irq_2_iommu(unsigned int irq) 66static struct irq_2_iommu *valid_irq_2_iommu(unsigned int irq)