| 666 | } |
| 667 | |
| 668 | void |
| 669 | taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, |
| 670 | void *uniq, device_t dev, struct resource *irq, const char *name) |
| 671 | { |
| 672 | int cpu, qid, error; |
| 673 | |
| 674 | KASSERT(qgroup->tqg_cnt > 0, |
| 675 | ("qgroup %s has no queues", qgroup->tqg_name)); |
| 676 | |
| 677 | gtask->gt_uniq = uniq; |
| 678 | snprintf(gtask->gt_name, GROUPTASK_NAMELEN, "%s", name ? name : "grouptask"); |
| 679 | gtask->gt_dev = dev; |
| 680 | gtask->gt_irq = irq; |
| 681 | gtask->gt_cpu = -1; |
| 682 | mtx_lock(&qgroup->tqg_lock); |
| 683 | qid = taskqgroup_find(qgroup, uniq); |
| 684 | qgroup->tqg_queue[qid].tgc_cnt++; |
| 685 | LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); |
| 686 | gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; |
| 687 | if (dev != NULL && irq != NULL) { |
| 688 | cpu = qgroup->tqg_queue[qid].tgc_cpu; |
| 689 | gtask->gt_cpu = cpu; |
| 690 | mtx_unlock(&qgroup->tqg_lock); |
| 691 | error = bus_bind_intr(dev, irq, cpu); |
| 692 | if (error) |
| 693 | printf("%s: binding interrupt failed for %s: %d\n", |
| 694 | __func__, gtask->gt_name, error); |
| 695 | } else |
| 696 | mtx_unlock(&qgroup->tqg_lock); |
| 697 | } |
| 698 | |
| 699 | int |
| 700 | taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, |
no test coverage detected