aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intr_remapping.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/intr_remapping.c')
-rw-r--r--drivers/pci/intr_remapping.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index 87ec390e10df..cb6252988546 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -54,45 +54,22 @@ struct irq_2_iommu {
54}; 54};
55 55
56#ifdef CONFIG_GENERIC_HARDIRQS 56#ifdef CONFIG_GENERIC_HARDIRQS
57static struct irq_2_iommu *get_one_free_irq_2_iommu(int node)
58{
59 struct irq_2_iommu *iommu;
60
61 iommu = kzalloc_node(sizeof(*iommu), GFP_ATOMIC, node);
62 printk(KERN_DEBUG "alloc irq_2_iommu on node %d\n", node);
63
64 return iommu;
65}
66
67static struct irq_2_iommu *irq_2_iommu(unsigned int irq) 57static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
68{ 58{
69 struct irq_desc *desc; 59 return get_irq_iommu(irq);
70
71 desc = irq_to_desc(irq);
72
73 if (WARN_ON_ONCE(!desc))
74 return NULL;
75
76 return desc->irq_2_iommu;
77} 60}
78 61
79static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq) 62static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
80{ 63{
81 struct irq_desc *desc; 64 struct irq_data *data = irq_get_irq_data(irq);
82 struct irq_2_iommu *irq_iommu;
83 65
84 desc = irq_to_desc(irq); 66 if (WARN_ONCE(data->irq_2_iommu,
85 if (!desc) { 67 KERN_DEBUG "irq_2_iommu!=NULL irq %u\n", irq))
86 printk(KERN_INFO "can not get irq_desc for %d\n", irq); 68 return data->irq_2_iommu;
87 return NULL;
88 }
89
90 irq_iommu = desc->irq_2_iommu;
91
92 if (!irq_iommu)
93 desc->irq_2_iommu = get_one_free_irq_2_iommu(irq_node(irq));
94 69
95 return desc->irq_2_iommu; 70 data->irq_2_iommu = kzalloc_node(sizeof(*data->irq_2_iommu),
71 GFP_ATOMIC, data->node);
72 return data->irq_2_iommu;
96} 73}
97 74
98static void irq_2_iommu_free(unsigned int irq) 75static void irq_2_iommu_free(unsigned int irq)