Function report |
Source Code:kernel\irq\manage.c |
Create Date:2022-07-28 10:09:50 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:register an interrupt
Proto:static int __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
unsigned int | irq | |
struct irq_desc * | desc | >request_mutex Provides serialization against a concurrent free_irq() |
struct irqaction * | new |
1276 | thread_mask = 0 |
1277 | shared = 0 |
1279 | If Not >request_mutex Provides serialization against a concurrent free_irq() Then Return -EINVAL |
1282 | If chip == Generic no controller implementation Then Return -ENOSYS |
1284 | If Not try_module_get(owner) Then Return -ENODEV |
1293 | If Not (flags & IRQF_TRIGGER_MASK) Then flags |= irqd_get_trigger_type( & irq_data) |
1300 | nested = irq_settings_is_nested_thread(>request_mutex Provides serialization against a concurrent free_irq()) |
1301 | If nested Then |
1302 | If Not thread_fn Then |
1312 | Else |
1314 | ret = irq_setup_forced_threading(new) |
1326 | ret = setup_irq_thread(new, irq, false) |
1329 | If secondary Then |
1330 | ret = setup_irq_thread(secondary, irq, true) |
1331 | If ret Then Go to out_thread |
1345 | If flags & IRQCHIP_ONESHOT_SAFE Then flags &= ~Interrupt is not reenabled after the hardirq handler finished |
1355 | mutex_lock( & request_mutex) |
1365 | If Not IRQ action list Then |
1366 | ret = irq_request_resources(>request_mutex Provides serialization against a concurrent free_irq()) |
1367 | If ret Then |
1368 | pr_err("Failed to request resources for %s (irq %d) on irqchip %s\n", name, irq, interrupt' name) |
1370 | Go to out_bus_unlock |
1380 | raw_spin_lock_irqsave( & lock, flags) |
1381 | old_ptr = IRQ action list |
1383 | If old Then |
1395 | pr_err("Invalid attempt to share NMI for %s (irq %d) on irqchip %s.\n", name, irq, interrupt' name) |
1398 | Go to out_unlock |
1405 | If irqd_trigger_type_was_set( & irq_data) Then |
1406 | oldtype = irqd_get_trigger_type( & irq_data) |
1407 | Else |
1408 | oldtype = flags & IRQF_TRIGGER_MASK |
1412 | If Not ( flags & flags & allow sharing the irq among several devices) || oldtype != (flags & IRQF_TRIGGER_MASK) || (flags ^ flags) & Interrupt is not reenabled after the hardirq handler finished Then Go to mismatch |
1418 | If (flags & Interrupt is per cpu) != (flags & Interrupt is per cpu) Then Go to mismatch |
1423 | Do |
1433 | shared = 1 |
1446 | If thread_mask == ~0UL Then |
1448 | Go to out_unlock |
1472 | Else if handler == Default primary interrupt handler for threaded interrupts && Not (flags & IRQCHIP_ONESHOT_SAFE) Then |
1492 | Go to out_unlock |
1495 | If Not shared Then |
1496 | init_waitqueue_head( & wait_for_threads) |
1499 | If flags & IRQF_TRIGGER_MASK Then |
1500 | ret = __irq_set_trigger(>request_mutex Provides serialization against a concurrent free_irq(), flags & IRQF_TRIGGER_MASK) |
1503 | If ret Then Go to out_unlock |
1519 | If ret Then Go to out_unlock |
1523 | istate &= ~( IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | IRQS_ONESHOT | IRQS_WAITING) |
1524 | irqd_clear( & irq_data, IRQD_IRQ_INPROGRESS) |
1526 | If flags & Interrupt is per cpu Then |
1527 | irqd_set( & irq_data, IRQD_PER_CPU) |
1531 | If flags & Interrupt is not reenabled after the hardirq handler finished Then istate |= IRQS_ONESHOT |
1535 | If flags & Flag to exclude this interrupt from irq balancing Then |
1536 | irq_settings_set_no_balancing(>request_mutex Provides serialization against a concurrent free_irq()) |
1537 | irqd_set( & irq_data, IRQD_NO_BALANCING) |
1542 | Else |
1551 | nested irq disables = 1 |
1554 | Else if flags & IRQF_TRIGGER_MASK Then |
1555 | nmsk = flags & IRQF_TRIGGER_MASK |
1556 | omsk = irqd_get_trigger_type( & irq_data) |
1566 | irq_pm_install_action(>request_mutex Provides serialization against a concurrent free_irq(), new) |
1569 | For detecting broken IRQs = 0 |
1570 | irqs_unhandled = 0 |
1576 | If shared && istate & IRQS_SPURIOUS_DISABLED Then |
1577 | istate &= ~IRQS_SPURIOUS_DISABLED |
1581 | raw_spin_unlock_irqrestore( & lock, flags) |
1597 | dir = NULL |
1598 | register_handler_proc(irq, new) |
1599 | Return 0 |
1601 | mismatch : |
1602 | If Not (flags & set by callers when they expect sharing mismatches to occur) Then |
1611 | out_unlock : |
1612 | raw_spin_unlock_irqrestore( & lock, flags) |
1614 | If Not IRQ action list Then irq_release_resources(>request_mutex Provides serialization against a concurrent free_irq()) |
1616 | out_bus_unlock : |
1620 | out_thread : |
1621 | If thread Then |
1635 | out_mput : |
1636 | module_put(owner) |
1637 | Return ret |
Name | Describe |
---|---|
setup_irq | setup_irq - setup an interrupt*@irq: Interrupt line to setup*@act: irqaction for the interrupt* Used to statically setup interrupts in the early boot process. |
request_threaded_irq | quest_threaded_irq - allocate an interrupt line*@irq: Interrupt line to allocate*@handler: Function to be called when the IRQ occurs |
request_nmi | quest_nmi - allocate an interrupt line for NMI delivery*@irq: Interrupt line to allocate*@handler: Function to be called when the IRQ occurs |
setup_percpu_irq | setup_percpu_irq - setup a per-cpu interrupt*@irq: Interrupt line to setup*@act: irqaction for the interrupt* Used to statically setup per-cpu interrupts in the early boot process. |
__request_percpu_irq | __request_percpu_irq - allocate a percpu interrupt line*@irq: Interrupt line to allocate*@handler: Function to be called when the IRQ occurs |
request_percpu_nmi | quest_percpu_nmi - allocate a percpu interrupt line for NMI delivery*@irq: Interrupt line to allocate*@handler: Function to be called when the IRQ occurs |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |