Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irq_domain: Remove references to old irq_host names

No functional changes. Replaces non-exported references to 'host' with domain.
Does not change any symbol names referenced by other .c files.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
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>

+108 -111
+108 -111
kernel/irq/irqdomain.c
··· 19 19 #ifdef CONFIG_PPC 20 20 static DEFINE_MUTEX(revmap_trees_mutex); 21 21 static unsigned int irq_virq_count = NR_IRQS; 22 - static struct irq_domain *irq_default_host; 22 + static struct irq_domain *irq_default_domain; 23 23 24 - static int default_irq_host_match(struct irq_domain *h, struct device_node *np) 24 + static int default_irq_domain_match(struct irq_domain *d, struct device_node *np) 25 25 { 26 - return h->of_node != NULL && h->of_node == np; 26 + return d->of_node != NULL && d->of_node == np; 27 27 } 28 28 29 29 /** ··· 31 31 * @of_node: optional device-tree node of the interrupt controller 32 32 * @revmap_type: type of reverse mapping to use 33 33 * @revmap_arg: for IRQ_DOMAIN_MAP_LINEAR linear only: size of the map 34 - * @ops: map/unmap host callbacks 35 - * @inval_irq: provide a hw number in that host space that is always invalid 34 + * @ops: map/unmap domain callbacks 35 + * @inval_irq: provide a hw number in that domain space that is always invalid 36 36 * 37 37 * Allocates and initialize and irq_domain structure. Note that in the case of 38 38 * IRQ_DOMAIN_MAP_LEGACY, the map() callback will be called before this returns ··· 48 48 struct irq_domain_ops *ops, 49 49 irq_hw_number_t inval_irq) 50 50 { 51 - struct irq_domain *host, *h; 51 + struct irq_domain *domain, *h; 52 52 unsigned int size = sizeof(struct irq_domain); 53 53 unsigned int i; 54 54 unsigned int *rmap; ··· 56 56 /* Allocate structure and revmap table if using linear mapping */ 57 57 if (revmap_type == IRQ_DOMAIN_MAP_LINEAR) 58 58 size += revmap_arg * sizeof(unsigned int); 59 - host = kzalloc(size, GFP_KERNEL); 60 - if (host == NULL) 59 + domain = kzalloc(size, GFP_KERNEL); 60 + if (domain == NULL) 61 61 return NULL; 62 62 63 63 /* Fill structure */ 64 - host->revmap_type = revmap_type; 65 - host->inval_irq = inval_irq; 66 - host->ops = ops; 67 - host->of_node = of_node_get(of_node); 64 + domain->revmap_type = revmap_type; 65 + domain->inval_irq = inval_irq; 66 + domain->ops = ops; 67 + domain->of_node = of_node_get(of_node); 68 68 69 - if (host->ops->match == NULL) 70 - host->ops->match = default_irq_host_match; 69 + if (domain->ops->match == NULL) 70 + domain->ops->match = default_irq_domain_match; 71 71 72 72 mutex_lock(&irq_domain_mutex); 73 73 /* Make sure only one legacy controller can be created */ ··· 75 75 list_for_each_entry(h, &irq_domain_list, link) { 76 76 if (WARN_ON(h->revmap_type == IRQ_DOMAIN_MAP_LEGACY)) { 77 77 mutex_unlock(&irq_domain_mutex); 78 - of_node_put(host->of_node); 79 - kfree(host); 78 + of_node_put(domain->of_node); 79 + kfree(domain); 80 80 return NULL; 81 81 } 82 82 } 83 83 } 84 - list_add(&host->link, &irq_domain_list); 84 + list_add(&domain->link, &irq_domain_list); 85 85 mutex_unlock(&irq_domain_mutex); 86 86 87 87 /* Additional setups per revmap type */ 88 88 switch(revmap_type) { 89 89 case IRQ_DOMAIN_MAP_LEGACY: 90 90 /* 0 is always the invalid number for legacy */ 91 - host->inval_irq = 0; 92 - /* setup us as the host for all legacy interrupts */ 91 + domain->inval_irq = 0; 92 + /* setup us as the domain for all legacy interrupts */ 93 93 for (i = 1; i < NUM_ISA_INTERRUPTS; i++) { 94 94 struct irq_data *irq_data = irq_get_irq_data(i); 95 95 irq_data->hwirq = i; 96 - irq_data->domain = host; 96 + irq_data->domain = domain; 97 97 98 98 /* Legacy flags are left to default at this point, 99 99 * one can then use irq_create_mapping() to 100 100 * explicitly change them 101 101 */ 102 - ops->map(host, i, i); 102 + ops->map(domain, i, i); 103 103 104 104 /* Clear norequest flags */ 105 105 irq_clear_status_flags(i, IRQ_NOREQUEST); 106 106 } 107 107 break; 108 108 case IRQ_DOMAIN_MAP_LINEAR: 109 - rmap = (unsigned int *)(host + 1); 109 + rmap = (unsigned int *)(domain + 1); 110 110 for (i = 0; i < revmap_arg; i++) 111 111 rmap[i] = 0; 112 - host->revmap_data.linear.size = revmap_arg; 113 - host->revmap_data.linear.revmap = rmap; 112 + domain->revmap_data.linear.size = revmap_arg; 113 + domain->revmap_data.linear.revmap = rmap; 114 114 break; 115 115 case IRQ_DOMAIN_MAP_TREE: 116 - INIT_RADIX_TREE(&host->revmap_data.tree, GFP_KERNEL); 116 + INIT_RADIX_TREE(&domain->revmap_data.tree, GFP_KERNEL); 117 117 break; 118 118 default: 119 119 break; 120 120 } 121 121 122 - pr_debug("irq: Allocated host of type %d @0x%p\n", revmap_type, host); 122 + pr_debug("irq: Allocated domain of type %d @0x%p\n", revmap_type, domain); 123 123 124 - return host; 124 + return domain; 125 125 } 126 126 127 127 /** ··· 150 150 151 151 /** 152 152 * irq_set_default_host() - Set a "default" irq domain 153 - * @host: default host pointer 153 + * @domain: default domain pointer 154 154 * 155 155 * For convenience, it's possible to set a "default" domain that will be used 156 156 * whenever NULL is passed to irq_create_mapping(). It makes life easier for 157 157 * platforms that want to manipulate a few hard coded interrupt numbers that 158 158 * aren't properly represented in the device-tree. 159 159 */ 160 - void irq_set_default_host(struct irq_domain *host) 160 + void irq_set_default_host(struct irq_domain *domain) 161 161 { 162 - pr_debug("irq: Default host set to @0x%p\n", host); 162 + pr_debug("irq: Default domain set to @0x%p\n", domain); 163 163 164 - irq_default_host = host; 164 + irq_default_domain = domain; 165 165 } 166 166 167 167 /** ··· 180 180 irq_virq_count = count; 181 181 } 182 182 183 - static int irq_setup_virq(struct irq_domain *host, unsigned int virq, 183 + static int irq_setup_virq(struct irq_domain *domain, unsigned int virq, 184 184 irq_hw_number_t hwirq) 185 185 { 186 186 struct irq_data *irq_data = irq_get_irq_data(virq); 187 187 188 188 irq_data->hwirq = hwirq; 189 - irq_data->domain = host; 190 - if (host->ops->map(host, virq, hwirq)) { 189 + irq_data->domain = domain; 190 + if (domain->ops->map(domain, virq, hwirq)) { 191 191 pr_debug("irq: -> mapping failed, freeing\n"); 192 192 irq_data->domain = NULL; 193 193 irq_data->hwirq = 0; ··· 201 201 202 202 /** 203 203 * irq_create_direct_mapping() - Allocate an irq for direct mapping 204 - * @host: domain to allocate the irq for or NULL for default host 204 + * @domain: domain to allocate the irq for or NULL for default domain 205 205 * 206 206 * This routine is used for irq controllers which can choose the hardware 207 207 * interrupt numbers they generate. In such a case it's simplest to use 208 208 * the linux irq as the hardware interrupt number. 209 209 */ 210 - unsigned int irq_create_direct_mapping(struct irq_domain *host) 210 + unsigned int irq_create_direct_mapping(struct irq_domain *domain) 211 211 { 212 212 unsigned int virq; 213 213 214 - if (host == NULL) 215 - host = irq_default_host; 214 + if (domain == NULL) 215 + domain = irq_default_domain; 216 216 217 - BUG_ON(host == NULL); 218 - WARN_ON(host->revmap_type != IRQ_DOMAIN_MAP_NOMAP); 217 + BUG_ON(domain == NULL); 218 + WARN_ON(domain->revmap_type != IRQ_DOMAIN_MAP_NOMAP); 219 219 220 220 virq = irq_alloc_desc_from(1, 0); 221 221 if (!virq) { ··· 231 231 232 232 pr_debug("irq: create_direct obtained virq %d\n", virq); 233 233 234 - if (irq_setup_virq(host, virq, virq)) { 234 + if (irq_setup_virq(domain, virq, virq)) { 235 235 irq_free_desc(virq); 236 236 return 0; 237 237 } ··· 241 241 242 242 /** 243 243 * irq_create_mapping() - Map a hardware interrupt into linux irq space 244 - * @host: host owning this hardware interrupt or NULL for default host 245 - * @hwirq: hardware irq number in that host space 244 + * @domain: domain owning this hardware interrupt or NULL for default domain 245 + * @hwirq: hardware irq number in that domain space 246 246 * 247 247 * Only one mapping per hardware interrupt is permitted. Returns a linux 248 248 * irq number. 249 249 * If the sense/trigger is to be specified, set_irq_type() should be called 250 250 * on the number returned from that call. 251 251 */ 252 - unsigned int irq_create_mapping(struct irq_domain *host, 252 + unsigned int irq_create_mapping(struct irq_domain *domain, 253 253 irq_hw_number_t hwirq) 254 254 { 255 255 unsigned int virq, hint; 256 256 257 - pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", host, hwirq); 257 + pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq); 258 258 259 - /* Look for default host if nececssary */ 260 - if (host == NULL) 261 - host = irq_default_host; 262 - if (host == NULL) { 259 + /* Look for default domain if nececssary */ 260 + if (domain == NULL) 261 + domain = irq_default_domain; 262 + if (domain == NULL) { 263 263 printk(KERN_WARNING "irq_create_mapping called for" 264 - " NULL host, hwirq=%lx\n", hwirq); 264 + " NULL domain, hwirq=%lx\n", hwirq); 265 265 WARN_ON(1); 266 266 return 0; 267 267 } 268 - pr_debug("irq: -> using host @%p\n", host); 268 + pr_debug("irq: -> using domain @%p\n", domain); 269 269 270 270 /* Check if mapping already exists */ 271 - virq = irq_find_mapping(host, hwirq); 271 + virq = irq_find_mapping(domain, hwirq); 272 272 if (virq) { 273 273 pr_debug("irq: -> existing mapping on virq %d\n", virq); 274 274 return virq; 275 275 } 276 276 277 277 /* Get a virtual interrupt number */ 278 - if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY) { 278 + if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) { 279 279 /* Handle legacy */ 280 280 virq = (unsigned int)hwirq; 281 281 if (virq == 0 || virq >= NUM_ISA_INTERRUPTS) ··· 295 295 } 296 296 } 297 297 298 - if (irq_setup_virq(host, virq, hwirq)) { 299 - if (host->revmap_type != IRQ_DOMAIN_MAP_LEGACY) 298 + if (irq_setup_virq(domain, virq, hwirq)) { 299 + if (domain->revmap_type != IRQ_DOMAIN_MAP_LEGACY) 300 300 irq_free_desc(virq); 301 301 return 0; 302 302 } 303 303 304 - pr_debug("irq: irq %lu on host %s mapped to virtual irq %u\n", 305 - hwirq, host->of_node ? host->of_node->full_name : "null", virq); 304 + pr_debug("irq: irq %lu on domain %s mapped to virtual irq %u\n", 305 + hwirq, domain->of_node ? domain->of_node->full_name : "null", virq); 306 306 307 307 return virq; 308 308 } ··· 311 311 unsigned int irq_create_of_mapping(struct device_node *controller, 312 312 const u32 *intspec, unsigned int intsize) 313 313 { 314 - struct irq_domain *host; 314 + struct irq_domain *domain; 315 315 irq_hw_number_t hwirq; 316 316 unsigned int type = IRQ_TYPE_NONE; 317 317 unsigned int virq; 318 318 319 - if (controller == NULL) 320 - host = irq_default_host; 321 - else 322 - host = irq_find_host(controller); 323 - if (host == NULL) { 324 - printk(KERN_WARNING "irq: no irq host found for %s !\n", 319 + domain = controller ? irq_find_host(controller) : irq_default_domain; 320 + if (!domain) { 321 + printk(KERN_WARNING "irq: no irq domain found for %s !\n", 325 322 controller->full_name); 326 323 return 0; 327 324 } 328 325 329 - /* If host has no translation, then we assume interrupt line */ 330 - if (host->ops->xlate == NULL) 326 + /* If domain has no translation, then we assume interrupt line */ 327 + if (domain->ops->xlate == NULL) 331 328 hwirq = intspec[0]; 332 329 else { 333 - if (host->ops->xlate(host, controller, intspec, intsize, 330 + if (domain->ops->xlate(domain, controller, intspec, intsize, 334 331 &hwirq, &type)) 335 332 return 0; 336 333 } 337 334 338 335 /* Create mapping */ 339 - virq = irq_create_mapping(host, hwirq); 336 + virq = irq_create_mapping(domain, hwirq); 340 337 if (!virq) 341 338 return virq; 342 339 ··· 352 355 void irq_dispose_mapping(unsigned int virq) 353 356 { 354 357 struct irq_data *irq_data = irq_get_irq_data(virq); 355 - struct irq_domain *host; 358 + struct irq_domain *domain; 356 359 irq_hw_number_t hwirq; 357 360 358 361 if (!virq || !irq_data) 359 362 return; 360 363 361 - host = irq_data->domain; 362 - if (WARN_ON(host == NULL)) 364 + domain = irq_data->domain; 365 + if (WARN_ON(domain == NULL)) 363 366 return; 364 367 365 368 /* Never unmap legacy interrupts */ 366 - if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY) 369 + if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) 367 370 return; 368 371 369 372 irq_set_status_flags(virq, IRQ_NOREQUEST); ··· 375 378 synchronize_irq(virq); 376 379 377 380 /* Tell the PIC about it */ 378 - if (host->ops->unmap) 379 - host->ops->unmap(host, virq); 381 + if (domain->ops->unmap) 382 + domain->ops->unmap(domain, virq); 380 383 smp_mb(); 381 384 382 385 /* Clear reverse map */ 383 386 hwirq = irq_data->hwirq; 384 - switch(host->revmap_type) { 387 + switch(domain->revmap_type) { 385 388 case IRQ_DOMAIN_MAP_LINEAR: 386 - if (hwirq < host->revmap_data.linear.size) 387 - host->revmap_data.linear.revmap[hwirq] = 0; 389 + if (hwirq < domain->revmap_data.linear.size) 390 + domain->revmap_data.linear.revmap[hwirq] = 0; 388 391 break; 389 392 case IRQ_DOMAIN_MAP_TREE: 390 393 mutex_lock(&revmap_trees_mutex); 391 - radix_tree_delete(&host->revmap_data.tree, hwirq); 394 + radix_tree_delete(&domain->revmap_data.tree, hwirq); 392 395 mutex_unlock(&revmap_trees_mutex); 393 396 break; 394 397 } 395 398 396 399 /* Destroy map */ 397 - irq_data->hwirq = host->inval_irq; 400 + irq_data->hwirq = domain->inval_irq; 398 401 399 402 irq_free_desc(virq); 400 403 } ··· 402 405 403 406 /** 404 407 * irq_find_mapping() - Find a linux irq from an hw irq number. 405 - * @host: domain owning this hardware interrupt 406 - * @hwirq: hardware irq number in that host space 408 + * @domain: domain owning this hardware interrupt 409 + * @hwirq: hardware irq number in that domain space 407 410 * 408 411 * This is a slow path, for use by generic code. It's expected that an 409 412 * irq controller implementation directly calls the appropriate low level 410 413 * mapping function. 411 414 */ 412 - unsigned int irq_find_mapping(struct irq_domain *host, 415 + unsigned int irq_find_mapping(struct irq_domain *domain, 413 416 irq_hw_number_t hwirq) 414 417 { 415 418 unsigned int i; 416 419 unsigned int hint = hwirq % irq_virq_count; 417 420 418 - /* Look for default host if nececssary */ 419 - if (host == NULL) 420 - host = irq_default_host; 421 - if (host == NULL) 421 + /* Look for default domain if nececssary */ 422 + if (domain == NULL) 423 + domain = irq_default_domain; 424 + if (domain == NULL) 422 425 return 0; 423 426 424 427 /* legacy -> bail early */ 425 - if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY) 428 + if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) 426 429 return hwirq; 427 430 428 431 /* Slow path does a linear search of the map */ ··· 431 434 i = hint; 432 435 do { 433 436 struct irq_data *data = irq_get_irq_data(i); 434 - if (data && (data->domain == host) && (data->hwirq == hwirq)) 437 + if (data && (data->domain == domain) && (data->hwirq == hwirq)) 435 438 return i; 436 439 i++; 437 440 if (i >= irq_virq_count) ··· 443 446 444 447 /** 445 448 * irq_radix_revmap_lookup() - Find a linux irq from a hw irq number. 446 - * @host: host owning this hardware interrupt 447 - * @hwirq: hardware irq number in that host space 449 + * @domain: domain owning this hardware interrupt 450 + * @hwirq: hardware irq number in that domain space 448 451 * 449 452 * This is a fast path, for use by irq controller code that uses radix tree 450 453 * revmaps 451 454 */ 452 - unsigned int irq_radix_revmap_lookup(struct irq_domain *host, 455 + unsigned int irq_radix_revmap_lookup(struct irq_domain *domain, 453 456 irq_hw_number_t hwirq) 454 457 { 455 458 struct irq_data *irq_data; 456 459 457 - if (WARN_ON_ONCE(host->revmap_type != IRQ_DOMAIN_MAP_TREE)) 458 - return irq_find_mapping(host, hwirq); 460 + if (WARN_ON_ONCE(domain->revmap_type != IRQ_DOMAIN_MAP_TREE)) 461 + return irq_find_mapping(domain, hwirq); 459 462 460 463 /* 461 464 * Freeing an irq can delete nodes along the path to 462 465 * do the lookup via call_rcu. 463 466 */ 464 467 rcu_read_lock(); 465 - irq_data = radix_tree_lookup(&host->revmap_data.tree, hwirq); 468 + irq_data = radix_tree_lookup(&domain->revmap_data.tree, hwirq); 466 469 rcu_read_unlock(); 467 470 468 471 /* ··· 470 473 * Else fallback to linear lookup - this should not happen in practice 471 474 * as it means that we failed to insert the node in the radix tree. 472 475 */ 473 - return irq_data ? irq_data->irq : irq_find_mapping(host, hwirq); 476 + return irq_data ? irq_data->irq : irq_find_mapping(domain, hwirq); 474 477 } 475 478 476 479 /** 477 480 * irq_radix_revmap_insert() - Insert a hw irq to linux irq number mapping. 478 - * @host: host owning this hardware interrupt 481 + * @domain: domain owning this hardware interrupt 479 482 * @virq: linux irq number 480 - * @hwirq: hardware irq number in that host space 483 + * @hwirq: hardware irq number in that domain space 481 484 * 482 485 * This is for use by irq controllers that use a radix tree reverse 483 486 * mapping for fast lookup. 484 487 */ 485 - void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, 488 + void irq_radix_revmap_insert(struct irq_domain *domain, unsigned int virq, 486 489 irq_hw_number_t hwirq) 487 490 { 488 491 struct irq_data *irq_data = irq_get_irq_data(virq); 489 492 490 - if (WARN_ON(host->revmap_type != IRQ_DOMAIN_MAP_TREE)) 493 + if (WARN_ON(domain->revmap_type != IRQ_DOMAIN_MAP_TREE)) 491 494 return; 492 495 493 496 if (virq) { 494 497 mutex_lock(&revmap_trees_mutex); 495 - radix_tree_insert(&host->revmap_data.tree, hwirq, irq_data); 498 + radix_tree_insert(&domain->revmap_data.tree, hwirq, irq_data); 496 499 mutex_unlock(&revmap_trees_mutex); 497 500 } 498 501 } 499 502 500 503 /** 501 504 * irq_linear_revmap() - Find a linux irq from a hw irq number. 502 - * @host: host owning this hardware interrupt 503 - * @hwirq: hardware irq number in that host space 505 + * @domain: domain owning this hardware interrupt 506 + * @hwirq: hardware irq number in that domain space 504 507 * 505 508 * This is a fast path, for use by irq controller code that uses linear 506 509 * revmaps. It does fallback to the slow path if the revmap doesn't exist 507 510 * yet and will create the revmap entry with appropriate locking 508 511 */ 509 - unsigned int irq_linear_revmap(struct irq_domain *host, 512 + unsigned int irq_linear_revmap(struct irq_domain *domain, 510 513 irq_hw_number_t hwirq) 511 514 { 512 515 unsigned int *revmap; 513 516 514 - if (WARN_ON_ONCE(host->revmap_type != IRQ_DOMAIN_MAP_LINEAR)) 515 - return irq_find_mapping(host, hwirq); 517 + if (WARN_ON_ONCE(domain->revmap_type != IRQ_DOMAIN_MAP_LINEAR)) 518 + return irq_find_mapping(domain, hwirq); 516 519 517 520 /* Check revmap bounds */ 518 - if (unlikely(hwirq >= host->revmap_data.linear.size)) 519 - return irq_find_mapping(host, hwirq); 521 + if (unlikely(hwirq >= domain->revmap_data.linear.size)) 522 + return irq_find_mapping(domain, hwirq); 520 523 521 524 /* Check if revmap was allocated */ 522 - revmap = host->revmap_data.linear.revmap; 525 + revmap = domain->revmap_data.linear.revmap; 523 526 if (unlikely(revmap == NULL)) 524 - return irq_find_mapping(host, hwirq); 527 + return irq_find_mapping(domain, hwirq); 525 528 526 529 /* Fill up revmap with slow path if no mapping found */ 527 530 if (unlikely(!revmap[hwirq])) 528 - revmap[hwirq] = irq_find_mapping(host, hwirq); 531 + revmap[hwirq] = irq_find_mapping(domain, hwirq); 529 532 530 533 return revmap[hwirq]; 531 534 } ··· 541 544 int i; 542 545 543 546 seq_printf(m, "%-5s %-7s %-15s %-18s %s\n", "virq", "hwirq", 544 - "chip name", "chip data", "host name"); 547 + "chip name", "chip data", "domain name"); 545 548 546 549 for (i = 1; i < nr_irqs; i++) { 547 550 desc = irq_to_desc(i);