aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c2
-rw-r--r--include/linux/irqdomain.h14
-rw-r--r--kernel/irq/irqdomain.c31
3 files changed, 23 insertions, 24 deletions
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index 00395f40fb5d..0622aa91b18a 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -32,7 +32,7 @@ void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq)
32static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic) 32static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
33{ 33{
34 irq_hw_number_t hwirq; 34 irq_hw_number_t hwirq;
35 struct irq_domain_ops *ops = mpic->irqhost->ops; 35 const struct irq_domain_ops *ops = mpic->irqhost->ops;
36 struct device_node *np; 36 struct device_node *np;
37 int flags, index, i; 37 int flags, index, i;
38 struct of_irq oirq; 38 struct of_irq oirq;
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index ea58f36688a0..52454881938a 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -106,7 +106,7 @@ struct irq_domain {
106 } linear; 106 } linear;
107 struct radix_tree_root tree; 107 struct radix_tree_root tree;
108 } revmap_data; 108 } revmap_data;
109 struct irq_domain_ops *ops; 109 const struct irq_domain_ops *ops;
110 void *host_data; 110 void *host_data;
111 irq_hw_number_t inval_irq; 111 irq_hw_number_t inval_irq;
112 112
@@ -119,17 +119,17 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
119 unsigned int size, 119 unsigned int size,
120 unsigned int first_irq, 120 unsigned int first_irq,
121 irq_hw_number_t first_hwirq, 121 irq_hw_number_t first_hwirq,
122 struct irq_domain_ops *ops, 122 const struct irq_domain_ops *ops,
123 void *host_data); 123 void *host_data);
124struct irq_domain *irq_domain_add_linear(struct device_node *of_node, 124struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
125 unsigned int size, 125 unsigned int size,
126 struct irq_domain_ops *ops, 126 const struct irq_domain_ops *ops,
127 void *host_data); 127 void *host_data);
128struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, 128struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
129 struct irq_domain_ops *ops, 129 const struct irq_domain_ops *ops,
130 void *host_data); 130 void *host_data);
131struct irq_domain *irq_domain_add_tree(struct device_node *of_node, 131struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
132 struct irq_domain_ops *ops, 132 const struct irq_domain_ops *ops,
133 void *host_data); 133 void *host_data);
134 134
135extern struct irq_domain *irq_find_host(struct device_node *node); 135extern struct irq_domain *irq_find_host(struct device_node *node);
@@ -138,7 +138,7 @@ extern void irq_set_virq_count(unsigned int count);
138 138
139static inline struct irq_domain *irq_domain_add_legacy_isa( 139static inline struct irq_domain *irq_domain_add_legacy_isa(
140 struct device_node *of_node, 140 struct device_node *of_node,
141 struct irq_domain_ops *ops, 141 const struct irq_domain_ops *ops,
142 void *host_data) 142 void *host_data)
143{ 143{
144 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, 144 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
@@ -162,7 +162,7 @@ extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host,
162extern unsigned int irq_linear_revmap(struct irq_domain *host, 162extern unsigned int irq_linear_revmap(struct irq_domain *host,
163 irq_hw_number_t hwirq); 163 irq_hw_number_t hwirq);
164 164
165extern struct irq_domain_ops irq_domain_simple_ops; 165extern const struct irq_domain_ops irq_domain_simple_ops;
166 166
167/* stock xlate functions */ 167/* stock xlate functions */
168int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, 168int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr,
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 456e3fc8387f..25a498eb98a3 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -26,11 +26,6 @@ static DEFINE_MUTEX(revmap_trees_mutex);
26static unsigned int irq_virq_count = NR_IRQS; 26static unsigned int irq_virq_count = NR_IRQS;
27static struct irq_domain *irq_default_domain; 27static struct irq_domain *irq_default_domain;
28 28
29static int default_irq_domain_match(struct irq_domain *d, struct device_node *np)
30{
31 return d->of_node != NULL && d->of_node == np;
32}
33
34/** 29/**
35 * irq_domain_alloc() - Allocate a new irq_domain data structure 30 * irq_domain_alloc() - Allocate a new irq_domain data structure
36 * @of_node: optional device-tree node of the interrupt controller 31 * @of_node: optional device-tree node of the interrupt controller
@@ -44,7 +39,7 @@ static int default_irq_domain_match(struct irq_domain *d, struct device_node *np
44 */ 39 */
45static struct irq_domain *irq_domain_alloc(struct device_node *of_node, 40static struct irq_domain *irq_domain_alloc(struct device_node *of_node,
46 unsigned int revmap_type, 41 unsigned int revmap_type,
47 struct irq_domain_ops *ops, 42 const struct irq_domain_ops *ops,
48 void *host_data) 43 void *host_data)
49{ 44{
50 struct irq_domain *domain; 45 struct irq_domain *domain;
@@ -59,9 +54,6 @@ static struct irq_domain *irq_domain_alloc(struct device_node *of_node,
59 domain->host_data = host_data; 54 domain->host_data = host_data;
60 domain->of_node = of_node_get(of_node); 55 domain->of_node = of_node_get(of_node);
61 56
62 if (domain->ops->match == NULL)
63 domain->ops->match = default_irq_domain_match;
64
65 return domain; 57 return domain;
66} 58}
67 59
@@ -104,7 +96,7 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
104 unsigned int size, 96 unsigned int size,
105 unsigned int first_irq, 97 unsigned int first_irq,
106 irq_hw_number_t first_hwirq, 98 irq_hw_number_t first_hwirq,
107 struct irq_domain_ops *ops, 99 const struct irq_domain_ops *ops,
108 void *host_data) 100 void *host_data)
109{ 101{
110 struct irq_domain *domain; 102 struct irq_domain *domain;
@@ -170,7 +162,7 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
170 */ 162 */
171struct irq_domain *irq_domain_add_linear(struct device_node *of_node, 163struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
172 unsigned int size, 164 unsigned int size,
173 struct irq_domain_ops *ops, 165 const struct irq_domain_ops *ops,
174 void *host_data) 166 void *host_data)
175{ 167{
176 struct irq_domain *domain; 168 struct irq_domain *domain;
@@ -192,7 +184,7 @@ struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
192} 184}
193 185
194struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, 186struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
195 struct irq_domain_ops *ops, 187 const struct irq_domain_ops *ops,
196 void *host_data) 188 void *host_data)
197{ 189{
198 struct irq_domain *domain = irq_domain_alloc(of_node, 190 struct irq_domain *domain = irq_domain_alloc(of_node,
@@ -211,7 +203,7 @@ struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
211 * (the reverse mapping will use the slow path until that happens). 203 * (the reverse mapping will use the slow path until that happens).
212 */ 204 */
213struct irq_domain *irq_domain_add_tree(struct device_node *of_node, 205struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
214 struct irq_domain_ops *ops, 206 const struct irq_domain_ops *ops,
215 void *host_data) 207 void *host_data)
216{ 208{
217 struct irq_domain *domain = irq_domain_alloc(of_node, 209 struct irq_domain *domain = irq_domain_alloc(of_node,
@@ -230,6 +222,7 @@ struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
230struct irq_domain *irq_find_host(struct device_node *node) 222struct irq_domain *irq_find_host(struct device_node *node)
231{ 223{
232 struct irq_domain *h, *found = NULL; 224 struct irq_domain *h, *found = NULL;
225 int rc;
233 226
234 /* We might want to match the legacy controller last since 227 /* We might want to match the legacy controller last since
235 * it might potentially be set to match all interrupts in 228 * it might potentially be set to match all interrupts in
@@ -237,11 +230,17 @@ struct irq_domain *irq_find_host(struct device_node *node)
237 * yet though... 230 * yet though...
238 */ 231 */
239 mutex_lock(&irq_domain_mutex); 232 mutex_lock(&irq_domain_mutex);
240 list_for_each_entry(h, &irq_domain_list, link) 233 list_for_each_entry(h, &irq_domain_list, link) {
241 if (h->ops->match(h, node)) { 234 if (h->ops->match)
235 rc = h->ops->match(h, node);
236 else
237 rc = (h->of_node != NULL) && (h->of_node == node);
238
239 if (rc) {
242 found = h; 240 found = h;
243 break; 241 break;
244 } 242 }
243 }
245 mutex_unlock(&irq_domain_mutex); 244 mutex_unlock(&irq_domain_mutex);
246 return found; 245 return found;
247} 246}
@@ -760,7 +759,7 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d,
760} 759}
761EXPORT_SYMBOL_GPL(irq_domain_xlate_onetwocell); 760EXPORT_SYMBOL_GPL(irq_domain_xlate_onetwocell);
762 761
763struct irq_domain_ops irq_domain_simple_ops = { 762const struct irq_domain_ops irq_domain_simple_ops = {
764 .map = irq_domain_simple_map, 763 .map = irq_domain_simple_map,
765 .xlate = irq_domain_xlate_onetwocell, 764 .xlate = irq_domain_xlate_onetwocell,
766}; 765};