Skip to content

Commit

Permalink
Update submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
liaocj committed Nov 22, 2024
1 parent d78ed17 commit 05d1bc0
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions linux/内核-驱动/中断/硬中断--中断号映射.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,53 @@ unsigned int irq_create_mapping_affinity(struct irq_domain *domain,
return virq;
}
EXPORT_SYMBOL_GPL(irq_create_mapping_affinity);

int irq_domain_associate(struct irq_domain *domain, unsigned int virq,
irq_hw_number_t hwirq)
{
struct irq_data *irq_data = irq_get_irq_data(virq);
int ret;

if (WARN(hwirq >= domain->hwirq_max,
"error: hwirq 0x%x is too large for %s\n", (int)hwirq, domain->name))
return -EINVAL;
if (WARN(!irq_data, "error: virq%i is not allocated", virq))
return -EINVAL;
if (WARN(irq_data->domain, "error: virq%i is already associated", virq))
return -EINVAL;

mutex_lock(&irq_domain_mutex);
irq_data->hwirq = hwirq;
irq_data->domain = domain;
if (domain->ops->map) {
ret = domain->ops->map(domain, virq, hwirq);
if (ret != 0) {
/*
* If map() returns -EPERM, this interrupt is protected
* by the firmware or some other service and shall not
* be mapped. Don't bother telling the user about it.
*/
if (ret != -EPERM) {
pr_info("%s didn't like hwirq-0x%lx to VIRQ%i mapping (rc=%d)\n",
domain->name, hwirq, virq, ret);
}
irq_data->domain = NULL;
irq_data->hwirq = 0;
mutex_unlock(&irq_domain_mutex);
return ret;
}

/* If not already assigned, give the domain the chip's name */
if (!domain->name && irq_data->chip)
domain->name = irq_data->chip->name;
}

domain->mapcount++;
irq_domain_set_mapping(domain, hwirq, irq_data);
mutex_unlock(&irq_domain_mutex);

irq_clear_status_flags(virq, IRQ_NOREQUEST);

return 0;
}
```

0 comments on commit 05d1bc0

Please sign in to comment.