aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2012-02-14 16:06:52 -0500
committerGrant Likely <grant.likely@secretlab.ca>2012-02-16 08:11:21 -0500
commit03848373ea741caafab952fb62405ed7fc0c279c (patch)
tree7767c3044bee74b9f1b2786677763c8fd7984594 /kernel/irq
parentcc79ca691c292e9fd44f589c7940b9654e22f2f6 (diff)
irq_domain: remove NO_IRQ from irq domain code
zero always means no irq when using irq domains. Get rid of the NO_IRQ references. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Milton Miller <miltonm@bga.com> Tested-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/irqdomain.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index f551bc1d3167..8f7b91ce53c4 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -108,7 +108,7 @@ struct irq_domain *irq_alloc_host(struct device_node *of_node,
108 case IRQ_DOMAIN_MAP_LINEAR: 108 case IRQ_DOMAIN_MAP_LINEAR:
109 rmap = (unsigned int *)(host + 1); 109 rmap = (unsigned int *)(host + 1);
110 for (i = 0; i < revmap_arg; i++) 110 for (i = 0; i < revmap_arg; i++)
111 rmap[i] = NO_IRQ; 111 rmap[i] = 0;
112 host->revmap_data.linear.size = revmap_arg; 112 host->revmap_data.linear.size = revmap_arg;
113 host->revmap_data.linear.revmap = rmap; 113 host->revmap_data.linear.revmap = rmap;
114 break; 114 break;
@@ -218,9 +218,9 @@ unsigned int irq_create_direct_mapping(struct irq_domain *host)
218 WARN_ON(host->revmap_type != IRQ_DOMAIN_MAP_NOMAP); 218 WARN_ON(host->revmap_type != IRQ_DOMAIN_MAP_NOMAP);
219 219
220 virq = irq_alloc_desc_from(1, 0); 220 virq = irq_alloc_desc_from(1, 0);
221 if (virq == NO_IRQ) { 221 if (!virq) {
222 pr_debug("irq: create_direct virq allocation failed\n"); 222 pr_debug("irq: create_direct virq allocation failed\n");
223 return NO_IRQ; 223 return 0;
224 } 224 }
225 if (virq >= irq_virq_count) { 225 if (virq >= irq_virq_count) {
226 pr_err("ERROR: no free irqs available below %i maximum\n", 226 pr_err("ERROR: no free irqs available below %i maximum\n",
@@ -233,7 +233,7 @@ unsigned int irq_create_direct_mapping(struct irq_domain *host)
233 233
234 if (irq_setup_virq(host, virq, virq)) { 234 if (irq_setup_virq(host, virq, virq)) {
235 irq_free_desc(virq); 235 irq_free_desc(virq);
236 return NO_IRQ; 236 return 0;
237 } 237 }
238 238
239 return virq; 239 return virq;
@@ -263,13 +263,13 @@ unsigned int irq_create_mapping(struct irq_domain *host,
263 printk(KERN_WARNING "irq_create_mapping called for" 263 printk(KERN_WARNING "irq_create_mapping called for"
264 " NULL host, hwirq=%lx\n", hwirq); 264 " NULL host, hwirq=%lx\n", hwirq);
265 WARN_ON(1); 265 WARN_ON(1);
266 return NO_IRQ; 266 return 0;
267 } 267 }
268 pr_debug("irq: -> using host @%p\n", host); 268 pr_debug("irq: -> using host @%p\n", host);
269 269
270 /* Check if mapping already exists */ 270 /* Check if mapping already exists */
271 virq = irq_find_mapping(host, hwirq); 271 virq = irq_find_mapping(host, hwirq);
272 if (virq != NO_IRQ) { 272 if (virq) {
273 pr_debug("irq: -> existing mapping on virq %d\n", virq); 273 pr_debug("irq: -> existing mapping on virq %d\n", virq);
274 return virq; 274 return virq;
275 } 275 }
@@ -279,7 +279,7 @@ unsigned int irq_create_mapping(struct irq_domain *host,
279 /* Handle legacy */ 279 /* Handle legacy */
280 virq = (unsigned int)hwirq; 280 virq = (unsigned int)hwirq;
281 if (virq == 0 || virq >= NUM_ISA_INTERRUPTS) 281 if (virq == 0 || virq >= NUM_ISA_INTERRUPTS)
282 return NO_IRQ; 282 return 0;
283 return virq; 283 return virq;
284 } else { 284 } else {
285 /* Allocate a virtual interrupt number */ 285 /* Allocate a virtual interrupt number */
@@ -289,16 +289,16 @@ unsigned int irq_create_mapping(struct irq_domain *host,
289 virq = irq_alloc_desc_from(hint, 0); 289 virq = irq_alloc_desc_from(hint, 0);
290 if (!virq) 290 if (!virq)
291 virq = irq_alloc_desc_from(1, 0); 291 virq = irq_alloc_desc_from(1, 0);
292 if (virq == NO_IRQ) { 292 if (!virq) {
293 pr_debug("irq: -> virq allocation failed\n"); 293 pr_debug("irq: -> virq allocation failed\n");
294 return NO_IRQ; 294 return 0;
295 } 295 }
296 } 296 }
297 297
298 if (irq_setup_virq(host, virq, hwirq)) { 298 if (irq_setup_virq(host, virq, hwirq)) {
299 if (host->revmap_type != IRQ_DOMAIN_MAP_LEGACY) 299 if (host->revmap_type != IRQ_DOMAIN_MAP_LEGACY)
300 irq_free_desc(virq); 300 irq_free_desc(virq);
301 return NO_IRQ; 301 return 0;
302 } 302 }
303 303
304 pr_debug("irq: irq %lu on host %s mapped to virtual irq %u\n", 304 pr_debug("irq: irq %lu on host %s mapped to virtual irq %u\n",
@@ -323,7 +323,7 @@ unsigned int irq_create_of_mapping(struct device_node *controller,
323 if (host == NULL) { 323 if (host == NULL) {
324 printk(KERN_WARNING "irq: no irq host found for %s !\n", 324 printk(KERN_WARNING "irq: no irq host found for %s !\n",
325 controller->full_name); 325 controller->full_name);
326 return NO_IRQ; 326 return 0;
327 } 327 }
328 328
329 /* If host has no translation, then we assume interrupt line */ 329 /* If host has no translation, then we assume interrupt line */
@@ -332,12 +332,12 @@ unsigned int irq_create_of_mapping(struct device_node *controller,
332 else { 332 else {
333 if (host->ops->xlate(host, controller, intspec, intsize, 333 if (host->ops->xlate(host, controller, intspec, intsize,
334 &hwirq, &type)) 334 &hwirq, &type))
335 return NO_IRQ; 335 return 0;
336 } 336 }
337 337
338 /* Create mapping */ 338 /* Create mapping */
339 virq = irq_create_mapping(host, hwirq); 339 virq = irq_create_mapping(host, hwirq);
340 if (virq == NO_IRQ) 340 if (!virq)
341 return virq; 341 return virq;
342 342
343 /* Set type if specified and different than the current one */ 343 /* Set type if specified and different than the current one */
@@ -358,7 +358,7 @@ void irq_dispose_mapping(unsigned int virq)
358 struct irq_domain *host; 358 struct irq_domain *host;
359 irq_hw_number_t hwirq; 359 irq_hw_number_t hwirq;
360 360
361 if (virq == NO_IRQ || !irq_data) 361 if (!virq || !irq_data)
362 return; 362 return;
363 363
364 host = irq_data->domain; 364 host = irq_data->domain;
@@ -387,7 +387,7 @@ void irq_dispose_mapping(unsigned int virq)
387 switch(host->revmap_type) { 387 switch(host->revmap_type) {
388 case IRQ_DOMAIN_MAP_LINEAR: 388 case IRQ_DOMAIN_MAP_LINEAR:
389 if (hwirq < host->revmap_data.linear.size) 389 if (hwirq < host->revmap_data.linear.size)
390 host->revmap_data.linear.revmap[hwirq] = NO_IRQ; 390 host->revmap_data.linear.revmap[hwirq] = 0;
391 break; 391 break;
392 case IRQ_DOMAIN_MAP_TREE: 392 case IRQ_DOMAIN_MAP_TREE:
393 mutex_lock(&revmap_trees_mutex); 393 mutex_lock(&revmap_trees_mutex);
@@ -422,7 +422,7 @@ unsigned int irq_find_mapping(struct irq_domain *host,
422 if (host == NULL) 422 if (host == NULL)
423 host = irq_default_host; 423 host = irq_default_host;
424 if (host == NULL) 424 if (host == NULL)
425 return NO_IRQ; 425 return 0;
426 426
427 /* legacy -> bail early */ 427 /* legacy -> bail early */
428 if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY) 428 if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY)
@@ -440,7 +440,7 @@ unsigned int irq_find_mapping(struct irq_domain *host,
440 if (i >= irq_virq_count) 440 if (i >= irq_virq_count)
441 i = 1; 441 i = 1;
442 } while(i != hint); 442 } while(i != hint);
443 return NO_IRQ; 443 return 0;
444} 444}
445EXPORT_SYMBOL_GPL(irq_find_mapping); 445EXPORT_SYMBOL_GPL(irq_find_mapping);
446 446
@@ -493,7 +493,7 @@ void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq,
493 if (WARN_ON(host->revmap_type != IRQ_DOMAIN_MAP_TREE)) 493 if (WARN_ON(host->revmap_type != IRQ_DOMAIN_MAP_TREE))
494 return; 494 return;
495 495
496 if (virq != NO_IRQ) { 496 if (virq) {
497 mutex_lock(&revmap_trees_mutex); 497 mutex_lock(&revmap_trees_mutex);
498 radix_tree_insert(&host->revmap_data.tree, hwirq, irq_data); 498 radix_tree_insert(&host->revmap_data.tree, hwirq, irq_data);
499 mutex_unlock(&revmap_trees_mutex); 499 mutex_unlock(&revmap_trees_mutex);
@@ -527,7 +527,7 @@ unsigned int irq_linear_revmap(struct irq_domain *host,
527 return irq_find_mapping(host, hwirq); 527 return irq_find_mapping(host, hwirq);
528 528
529 /* Fill up revmap with slow path if no mapping found */ 529 /* Fill up revmap with slow path if no mapping found */
530 if (unlikely(revmap[hwirq] == NO_IRQ)) 530 if (unlikely(!revmap[hwirq]))
531 revmap[hwirq] = irq_find_mapping(host, hwirq); 531 revmap[hwirq] = irq_find_mapping(host, hwirq);
532 532
533 return revmap[hwirq]; 533 return revmap[hwirq];