Lines Matching refs:desc
38 static void __synchronize_hardirq(struct irq_desc *desc, bool sync_chip) in __synchronize_hardirq() argument
40 struct irq_data *irqd = irq_desc_get_irq_data(desc); in __synchronize_hardirq()
50 while (irqd_irq_inprogress(&desc->irq_data)) in __synchronize_hardirq()
54 raw_spin_lock_irqsave(&desc->lock, flags); in __synchronize_hardirq()
55 inprogress = irqd_irq_inprogress(&desc->irq_data); in __synchronize_hardirq()
70 raw_spin_unlock_irqrestore(&desc->lock, flags); in __synchronize_hardirq()
100 struct irq_desc *desc = irq_to_desc(irq); in synchronize_hardirq() local
102 if (desc) { in synchronize_hardirq()
103 __synchronize_hardirq(desc, false); in synchronize_hardirq()
104 return !atomic_read(&desc->threads_active); in synchronize_hardirq()
128 struct irq_desc *desc = irq_to_desc(irq); in synchronize_irq() local
130 if (desc) { in synchronize_irq()
131 __synchronize_hardirq(desc, true); in synchronize_irq()
137 wait_event(desc->wait_for_threads, in synchronize_irq()
138 !atomic_read(&desc->threads_active)); in synchronize_irq()
146 static bool __irq_can_set_affinity(struct irq_desc *desc) in __irq_can_set_affinity() argument
148 if (!desc || !irqd_can_balance(&desc->irq_data) || in __irq_can_set_affinity()
149 !desc->irq_data.chip || !desc->irq_data.chip->irq_set_affinity) in __irq_can_set_affinity()
173 struct irq_desc *desc = irq_to_desc(irq); in irq_can_set_affinity_usr() local
175 return __irq_can_set_affinity(desc) && in irq_can_set_affinity_usr()
176 !irqd_affinity_is_managed(&desc->irq_data); in irq_can_set_affinity_usr()
188 void irq_set_thread_affinity(struct irq_desc *desc) in irq_set_thread_affinity() argument
192 for_each_action_of_desc(desc, action) in irq_set_thread_affinity()
223 struct irq_desc *desc = irq_data_to_desc(data); in irq_do_set_affinity() local
287 cpumask_copy(desc->irq_common_data.affinity, mask); in irq_do_set_affinity()
291 irq_set_thread_affinity(desc); in irq_do_set_affinity()
302 struct irq_desc *desc = irq_data_to_desc(data); in irq_set_affinity_pending() local
305 irq_copy_pending(desc, dest); in irq_set_affinity_pending()
334 struct irq_desc *desc = irq_data_to_desc(data); in irq_set_affinity_deactivated() local
349 cpumask_copy(desc->irq_common_data.affinity, mask); in irq_set_affinity_deactivated()
359 struct irq_desc *desc = irq_data_to_desc(data); in irq_set_affinity_locked() local
372 irq_copy_pending(desc, mask); in irq_set_affinity_locked()
375 if (desc->affinity_notify) { in irq_set_affinity_locked()
376 kref_get(&desc->affinity_notify->kref); in irq_set_affinity_locked()
377 if (!schedule_work(&desc->affinity_notify->work)) { in irq_set_affinity_locked()
379 kref_put(&desc->affinity_notify->kref, in irq_set_affinity_locked()
380 desc->affinity_notify->release); in irq_set_affinity_locked()
406 struct irq_desc *desc; in irq_update_affinity_desc() local
418 desc = irq_get_desc_buslock(irq, &flags, 0); in irq_update_affinity_desc()
419 if (!desc) in irq_update_affinity_desc()
423 if (irqd_is_started(&desc->irq_data)) { in irq_update_affinity_desc()
429 if (irqd_affinity_is_managed(&desc->irq_data)) { in irq_update_affinity_desc()
438 activated = irqd_is_activated(&desc->irq_data); in irq_update_affinity_desc()
440 irq_domain_deactivate_irq(&desc->irq_data); in irq_update_affinity_desc()
443 irqd_set(&desc->irq_data, IRQD_AFFINITY_MANAGED); in irq_update_affinity_desc()
444 irqd_set(&desc->irq_data, IRQD_MANAGED_SHUTDOWN); in irq_update_affinity_desc()
447 cpumask_copy(desc->irq_common_data.affinity, &affinity->mask); in irq_update_affinity_desc()
451 irq_domain_activate_irq(&desc->irq_data, false); in irq_update_affinity_desc()
454 irq_put_desc_busunlock(desc, flags); in irq_update_affinity_desc()
461 struct irq_desc *desc = irq_to_desc(irq); in __irq_set_affinity() local
465 if (!desc) in __irq_set_affinity()
468 raw_spin_lock_irqsave(&desc->lock, flags); in __irq_set_affinity()
469 ret = irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask, force); in __irq_set_affinity()
470 raw_spin_unlock_irqrestore(&desc->lock, flags); in __irq_set_affinity()
508 struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); in __irq_apply_affinity_hint() local
510 if (!desc) in __irq_apply_affinity_hint()
512 desc->affinity_hint = m; in __irq_apply_affinity_hint()
513 irq_put_desc_unlock(desc, flags); in __irq_apply_affinity_hint()
524 struct irq_desc *desc = irq_to_desc(notify->irq); in irq_affinity_notify() local
528 if (!desc || !alloc_cpumask_var(&cpumask, GFP_KERNEL)) in irq_affinity_notify()
531 raw_spin_lock_irqsave(&desc->lock, flags); in irq_affinity_notify()
532 if (irq_move_pending(&desc->irq_data)) in irq_affinity_notify()
533 irq_get_pending(cpumask, desc); in irq_affinity_notify()
535 cpumask_copy(cpumask, desc->irq_common_data.affinity); in irq_affinity_notify()
536 raw_spin_unlock_irqrestore(&desc->lock, flags); in irq_affinity_notify()
559 struct irq_desc *desc = irq_to_desc(irq); in irq_set_affinity_notifier() local
566 if (!desc || desc->istate & IRQS_NMI) in irq_set_affinity_notifier()
576 raw_spin_lock_irqsave(&desc->lock, flags); in irq_set_affinity_notifier()
577 old_notify = desc->affinity_notify; in irq_set_affinity_notifier()
578 desc->affinity_notify = notify; in irq_set_affinity_notifier()
579 raw_spin_unlock_irqrestore(&desc->lock, flags); in irq_set_affinity_notifier()
597 int irq_setup_affinity(struct irq_desc *desc) in irq_setup_affinity() argument
600 int ret, node = irq_desc_get_node(desc); in irq_setup_affinity()
605 if (!__irq_can_set_affinity(desc)) in irq_setup_affinity()
613 if (irqd_affinity_is_managed(&desc->irq_data) || in irq_setup_affinity()
614 irqd_has_set(&desc->irq_data, IRQD_AFFINITY_SET)) { in irq_setup_affinity()
615 if (cpumask_intersects(desc->irq_common_data.affinity, in irq_setup_affinity()
617 set = desc->irq_common_data.affinity; in irq_setup_affinity()
619 irqd_clear(&desc->irq_data, IRQD_AFFINITY_SET); in irq_setup_affinity()
633 ret = irq_do_set_affinity(&desc->irq_data, &mask, false); in irq_setup_affinity()
639 int irq_setup_affinity(struct irq_desc *desc) in irq_setup_affinity() argument
641 return irq_select_affinity(irq_desc_get_irq(desc)); in irq_setup_affinity()
661 struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); in irq_set_vcpu_affinity() local
666 if (!desc) in irq_set_vcpu_affinity()
669 data = irq_desc_get_irq_data(desc); in irq_set_vcpu_affinity()
683 irq_put_desc_unlock(desc, flags); in irq_set_vcpu_affinity()
689 void __disable_irq(struct irq_desc *desc) in __disable_irq() argument
691 if (!desc->depth++) in __disable_irq()
692 irq_disable(desc); in __disable_irq()
698 struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); in __disable_irq_nosync() local
700 if (!desc) in __disable_irq_nosync()
702 __disable_irq(desc); in __disable_irq_nosync()
703 irq_put_desc_busunlock(desc, flags); in __disable_irq_nosync()
784 void __enable_irq(struct irq_desc *desc) in __enable_irq() argument
786 switch (desc->depth) { in __enable_irq()
790 irq_desc_get_irq(desc)); in __enable_irq()
793 if (desc->istate & IRQS_SUSPENDED) in __enable_irq()
796 irq_settings_set_noprobe(desc); in __enable_irq()
804 irq_startup(desc, IRQ_RESEND, IRQ_START_FORCE); in __enable_irq()
808 desc->depth--; in __enable_irq()
826 struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); in enable_irq() local
828 if (!desc) in enable_irq()
830 if (WARN(!desc->irq_data.chip, in enable_irq()
834 __enable_irq(desc); in enable_irq()
836 irq_put_desc_busunlock(desc, flags); in enable_irq()
856 struct irq_desc *desc = irq_to_desc(irq); in set_irq_wake_real() local
859 if (irq_desc_get_chip(desc)->flags & IRQCHIP_SKIP_SET_WAKE) in set_irq_wake_real()
862 if (desc->irq_data.chip->irq_set_wake) in set_irq_wake_real()
863 ret = desc->irq_data.chip->irq_set_wake(&desc->irq_data, on); in set_irq_wake_real()
890 struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); in irq_set_irq_wake() local
893 if (!desc) in irq_set_irq_wake()
897 if (desc->istate & IRQS_NMI) { in irq_set_irq_wake()
906 if (desc->wake_depth++ == 0) { in irq_set_irq_wake()
909 desc->wake_depth = 0; in irq_set_irq_wake()
911 irqd_set(&desc->irq_data, IRQD_WAKEUP_STATE); in irq_set_irq_wake()
914 if (desc->wake_depth == 0) { in irq_set_irq_wake()
916 } else if (--desc->wake_depth == 0) { in irq_set_irq_wake()
919 desc->wake_depth = 1; in irq_set_irq_wake()
921 irqd_clear(&desc->irq_data, IRQD_WAKEUP_STATE); in irq_set_irq_wake()
926 irq_put_desc_busunlock(desc, flags); in irq_set_irq_wake()
939 struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); in can_request_irq() local
942 if (!desc) in can_request_irq()
945 if (irq_settings_can_request(desc)) { in can_request_irq()
946 if (!desc->action || in can_request_irq()
947 irqflags & desc->action->flags & IRQF_SHARED) in can_request_irq()
950 irq_put_desc_unlock(desc, flags); in can_request_irq()
954 int __irq_set_trigger(struct irq_desc *desc, unsigned long flags) in __irq_set_trigger() argument
956 struct irq_chip *chip = desc->irq_data.chip; in __irq_set_trigger()
965 irq_desc_get_irq(desc), in __irq_set_trigger()
971 if (!irqd_irq_masked(&desc->irq_data)) in __irq_set_trigger()
972 mask_irq(desc); in __irq_set_trigger()
973 if (!irqd_irq_disabled(&desc->irq_data)) in __irq_set_trigger()
979 ret = chip->irq_set_type(&desc->irq_data, flags); in __irq_set_trigger()
984 irqd_clear(&desc->irq_data, IRQD_TRIGGER_MASK); in __irq_set_trigger()
985 irqd_set(&desc->irq_data, flags); in __irq_set_trigger()
989 flags = irqd_get_trigger_type(&desc->irq_data); in __irq_set_trigger()
990 irq_settings_set_trigger_mask(desc, flags); in __irq_set_trigger()
991 irqd_clear(&desc->irq_data, IRQD_LEVEL); in __irq_set_trigger()
992 irq_settings_clr_level(desc); in __irq_set_trigger()
994 irq_settings_set_level(desc); in __irq_set_trigger()
995 irqd_set(&desc->irq_data, IRQD_LEVEL); in __irq_set_trigger()
1002 flags, irq_desc_get_irq(desc), chip->irq_set_type); in __irq_set_trigger()
1005 unmask_irq(desc); in __irq_set_trigger()
1013 struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); in irq_set_parent() local
1015 if (!desc) in irq_set_parent()
1018 desc->parent_irq = parent_irq; in irq_set_parent()
1020 irq_put_desc_unlock(desc, flags); in irq_set_parent()
1082 static void irq_finalize_oneshot(struct irq_desc *desc, in irq_finalize_oneshot() argument
1085 if (!(desc->istate & IRQS_ONESHOT) || in irq_finalize_oneshot()
1089 chip_bus_lock(desc); in irq_finalize_oneshot()
1090 raw_spin_lock_irq(&desc->lock); in irq_finalize_oneshot()
1106 if (unlikely(irqd_irq_inprogress(&desc->irq_data))) { in irq_finalize_oneshot()
1107 raw_spin_unlock_irq(&desc->lock); in irq_finalize_oneshot()
1108 chip_bus_sync_unlock(desc); in irq_finalize_oneshot()
1121 desc->threads_oneshot &= ~action->thread_mask; in irq_finalize_oneshot()
1123 if (!desc->threads_oneshot && !irqd_irq_disabled(&desc->irq_data) && in irq_finalize_oneshot()
1124 irqd_irq_masked(&desc->irq_data)) in irq_finalize_oneshot()
1125 unmask_threaded_irq(desc); in irq_finalize_oneshot()
1128 raw_spin_unlock_irq(&desc->lock); in irq_finalize_oneshot()
1129 chip_bus_sync_unlock(desc); in irq_finalize_oneshot()
1137 irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) in irq_thread_check_affinity() argument
1154 raw_spin_lock_irq(&desc->lock); in irq_thread_check_affinity()
1159 if (cpumask_available(desc->irq_common_data.affinity)) { in irq_thread_check_affinity()
1162 m = irq_data_get_effective_affinity_mask(&desc->irq_data); in irq_thread_check_affinity()
1167 raw_spin_unlock_irq(&desc->lock); in irq_thread_check_affinity()
1175 irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) { } in irq_thread_check_affinity() argument
1185 irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action) in irq_forced_thread_fn() argument
1194 atomic_inc(&desc->threads_handled); in irq_forced_thread_fn()
1196 irq_finalize_oneshot(desc, action); in irq_forced_thread_fn()
1208 static irqreturn_t irq_thread_fn(struct irq_desc *desc, in irq_thread_fn() argument
1215 atomic_inc(&desc->threads_handled); in irq_thread_fn()
1217 irq_finalize_oneshot(desc, action); in irq_thread_fn()
1221 static void wake_threads_waitq(struct irq_desc *desc) in wake_threads_waitq() argument
1223 if (atomic_dec_and_test(&desc->threads_active)) in wake_threads_waitq()
1224 wake_up(&desc->wait_for_threads); in wake_threads_waitq()
1230 struct irq_desc *desc; in irq_thread_dtor() local
1242 desc = irq_to_desc(action->irq); in irq_thread_dtor()
1248 wake_threads_waitq(desc); in irq_thread_dtor()
1251 irq_finalize_oneshot(desc, action); in irq_thread_dtor()
1254 static void irq_wake_secondary(struct irq_desc *desc, struct irqaction *action) in irq_wake_secondary() argument
1261 raw_spin_lock_irq(&desc->lock); in irq_wake_secondary()
1262 __irq_wake_thread(desc, secondary); in irq_wake_secondary()
1263 raw_spin_unlock_irq(&desc->lock); in irq_wake_secondary()
1269 static void irq_thread_set_ready(struct irq_desc *desc, in irq_thread_set_ready() argument
1273 wake_up(&desc->wait_for_threads); in irq_thread_set_ready()
1280 static void wake_up_and_wait_for_irq_thread_ready(struct irq_desc *desc, in wake_up_and_wait_for_irq_thread_ready() argument
1287 wait_event(desc->wait_for_threads, in wake_up_and_wait_for_irq_thread_ready()
1298 struct irq_desc *desc = irq_to_desc(action->irq); in irq_thread() local
1299 irqreturn_t (*handler_fn)(struct irq_desc *desc, in irq_thread()
1302 irq_thread_set_ready(desc, action); in irq_thread()
1315 irq_thread_check_affinity(desc, action); in irq_thread()
1320 irq_thread_check_affinity(desc, action); in irq_thread()
1322 action_ret = handler_fn(desc, action); in irq_thread()
1324 irq_wake_secondary(desc, action); in irq_thread()
1326 wake_threads_waitq(desc); in irq_thread()
1347 struct irq_desc *desc = irq_to_desc(irq); in irq_wake_thread() local
1351 if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc))) in irq_wake_thread()
1354 raw_spin_lock_irqsave(&desc->lock, flags); in irq_wake_thread()
1355 for_each_action_of_desc(desc, action) { in irq_wake_thread()
1358 __irq_wake_thread(desc, action); in irq_wake_thread()
1362 raw_spin_unlock_irqrestore(&desc->lock, flags); in irq_wake_thread()
1405 static int irq_request_resources(struct irq_desc *desc) in irq_request_resources() argument
1407 struct irq_data *d = &desc->irq_data; in irq_request_resources()
1413 static void irq_release_resources(struct irq_desc *desc) in irq_release_resources() argument
1415 struct irq_data *d = &desc->irq_data; in irq_release_resources()
1422 static bool irq_supports_nmi(struct irq_desc *desc) in irq_supports_nmi() argument
1424 struct irq_data *d = irq_desc_get_irq_data(desc); in irq_supports_nmi()
1438 static int irq_nmi_setup(struct irq_desc *desc) in irq_nmi_setup() argument
1440 struct irq_data *d = irq_desc_get_irq_data(desc); in irq_nmi_setup()
1446 static void irq_nmi_teardown(struct irq_desc *desc) in irq_nmi_teardown() argument
1448 struct irq_data *d = irq_desc_get_irq_data(desc); in irq_nmi_teardown()
1505 __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) in __setup_irq() argument
1511 if (!desc) in __setup_irq()
1514 if (desc->irq_data.chip == &no_irq_chip) in __setup_irq()
1516 if (!try_module_get(desc->owner)) in __setup_irq()
1526 new->flags |= irqd_get_trigger_type(&desc->irq_data); in __setup_irq()
1532 nested = irq_settings_is_nested_thread(desc); in __setup_irq()
1545 if (irq_settings_can_thread(desc)) { in __setup_irq()
1577 if (desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE) in __setup_irq()
1587 mutex_lock(&desc->request_mutex); in __setup_irq()
1594 chip_bus_lock(desc); in __setup_irq()
1597 if (!desc->action) { in __setup_irq()
1598 ret = irq_request_resources(desc); in __setup_irq()
1601 new->name, irq, desc->irq_data.chip->name); in __setup_irq()
1612 raw_spin_lock_irqsave(&desc->lock, flags); in __setup_irq()
1613 old_ptr = &desc->action; in __setup_irq()
1626 if (desc->istate & IRQS_NMI) { in __setup_irq()
1628 new->name, irq, desc->irq_data.chip->name); in __setup_irq()
1637 if (irqd_trigger_type_was_set(&desc->irq_data)) { in __setup_irq()
1638 oldtype = irqd_get_trigger_type(&desc->irq_data); in __setup_irq()
1641 irqd_set_trigger_type(&desc->irq_data, oldtype); in __setup_irq()
1705 !(desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)) { in __setup_irq()
1730 ret = __irq_set_trigger(desc, in __setup_irq()
1748 ret = irq_activate(desc); in __setup_irq()
1752 desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \ in __setup_irq()
1754 irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS); in __setup_irq()
1757 irqd_set(&desc->irq_data, IRQD_PER_CPU); in __setup_irq()
1758 irq_settings_set_per_cpu(desc); in __setup_irq()
1760 irq_settings_set_no_debug(desc); in __setup_irq()
1764 irq_settings_set_no_debug(desc); in __setup_irq()
1767 desc->istate |= IRQS_ONESHOT; in __setup_irq()
1771 irq_settings_set_no_balancing(desc); in __setup_irq()
1772 irqd_set(&desc->irq_data, IRQD_NO_BALANCING); in __setup_irq()
1776 irq_settings_can_autoenable(desc)) { in __setup_irq()
1777 irq_startup(desc, IRQ_RESEND, IRQ_START_COND); in __setup_irq()
1787 desc->depth = 1; in __setup_irq()
1792 unsigned int omsk = irqd_get_trigger_type(&desc->irq_data); in __setup_irq()
1802 irq_pm_install_action(desc, new); in __setup_irq()
1805 desc->irq_count = 0; in __setup_irq()
1806 desc->irqs_unhandled = 0; in __setup_irq()
1812 if (shared && (desc->istate & IRQS_SPURIOUS_DISABLED)) { in __setup_irq()
1813 desc->istate &= ~IRQS_SPURIOUS_DISABLED; in __setup_irq()
1814 __enable_irq(desc); in __setup_irq()
1817 raw_spin_unlock_irqrestore(&desc->lock, flags); in __setup_irq()
1818 chip_bus_sync_unlock(desc); in __setup_irq()
1819 mutex_unlock(&desc->request_mutex); in __setup_irq()
1821 irq_setup_timings(desc, new); in __setup_irq()
1823 wake_up_and_wait_for_irq_thread_ready(desc, new); in __setup_irq()
1824 wake_up_and_wait_for_irq_thread_ready(desc, new->secondary); in __setup_irq()
1826 register_irq_proc(irq, desc); in __setup_irq()
1842 raw_spin_unlock_irqrestore(&desc->lock, flags); in __setup_irq()
1844 if (!desc->action) in __setup_irq()
1845 irq_release_resources(desc); in __setup_irq()
1847 chip_bus_sync_unlock(desc); in __setup_irq()
1848 mutex_unlock(&desc->request_mutex); in __setup_irq()
1866 module_put(desc->owner); in __setup_irq()
1874 static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id) in __free_irq() argument
1876 unsigned irq = desc->irq_data.irq; in __free_irq()
1882 mutex_lock(&desc->request_mutex); in __free_irq()
1883 chip_bus_lock(desc); in __free_irq()
1884 raw_spin_lock_irqsave(&desc->lock, flags); in __free_irq()
1890 action_ptr = &desc->action; in __free_irq()
1896 raw_spin_unlock_irqrestore(&desc->lock, flags); in __free_irq()
1897 chip_bus_sync_unlock(desc); in __free_irq()
1898 mutex_unlock(&desc->request_mutex); in __free_irq()
1910 irq_pm_remove_action(desc, action); in __free_irq()
1913 if (!desc->action) { in __free_irq()
1914 irq_settings_clr_disable_unlazy(desc); in __free_irq()
1916 irq_shutdown(desc); in __free_irq()
1921 if (WARN_ON_ONCE(desc->affinity_hint)) in __free_irq()
1922 desc->affinity_hint = NULL; in __free_irq()
1925 raw_spin_unlock_irqrestore(&desc->lock, flags); in __free_irq()
1940 chip_bus_sync_unlock(desc); in __free_irq()
1949 __synchronize_hardirq(desc, true); in __free_irq()
1983 if (!desc->action) { in __free_irq()
1988 chip_bus_lock(desc); in __free_irq()
1993 raw_spin_lock_irqsave(&desc->lock, flags); in __free_irq()
1994 irq_domain_deactivate_irq(&desc->irq_data); in __free_irq()
1995 raw_spin_unlock_irqrestore(&desc->lock, flags); in __free_irq()
1997 irq_release_resources(desc); in __free_irq()
1998 chip_bus_sync_unlock(desc); in __free_irq()
1999 irq_remove_timings(desc); in __free_irq()
2002 mutex_unlock(&desc->request_mutex); in __free_irq()
2004 irq_chip_pm_put(&desc->irq_data); in __free_irq()
2005 module_put(desc->owner); in __free_irq()
2028 struct irq_desc *desc = irq_to_desc(irq); in free_irq() local
2032 if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc))) in free_irq()
2036 if (WARN_ON(desc->affinity_notify)) in free_irq()
2037 desc->affinity_notify = NULL; in free_irq()
2040 action = __free_irq(desc, dev_id); in free_irq()
2052 static const void *__cleanup_nmi(unsigned int irq, struct irq_desc *desc) in __cleanup_nmi() argument
2056 desc->istate &= ~IRQS_NMI; in __cleanup_nmi()
2058 if (!WARN_ON(desc->action == NULL)) { in __cleanup_nmi()
2059 irq_pm_remove_action(desc, desc->action); in __cleanup_nmi()
2060 devname = desc->action->name; in __cleanup_nmi()
2061 unregister_handler_proc(irq, desc->action); in __cleanup_nmi()
2063 kfree(desc->action); in __cleanup_nmi()
2064 desc->action = NULL; in __cleanup_nmi()
2067 irq_settings_clr_disable_unlazy(desc); in __cleanup_nmi()
2068 irq_shutdown_and_deactivate(desc); in __cleanup_nmi()
2070 irq_release_resources(desc); in __cleanup_nmi()
2072 irq_chip_pm_put(&desc->irq_data); in __cleanup_nmi()
2073 module_put(desc->owner); in __cleanup_nmi()
2080 struct irq_desc *desc = irq_to_desc(irq); in free_nmi() local
2084 if (!desc || WARN_ON(!(desc->istate & IRQS_NMI))) in free_nmi()
2087 if (WARN_ON(irq_settings_is_per_cpu_devid(desc))) in free_nmi()
2091 if (WARN_ON(desc->depth == 0)) in free_nmi()
2094 raw_spin_lock_irqsave(&desc->lock, flags); in free_nmi()
2096 irq_nmi_teardown(desc); in free_nmi()
2097 devname = __cleanup_nmi(irq, desc); in free_nmi()
2099 raw_spin_unlock_irqrestore(&desc->lock, flags); in free_nmi()
2151 struct irq_desc *desc; in request_threaded_irq() local
2176 desc = irq_to_desc(irq); in request_threaded_irq()
2177 if (!desc) in request_threaded_irq()
2180 if (!irq_settings_can_request(desc) || in request_threaded_irq()
2181 WARN_ON(irq_settings_is_per_cpu_devid(desc))) in request_threaded_irq()
2200 retval = irq_chip_pm_get(&desc->irq_data); in request_threaded_irq()
2206 retval = __setup_irq(irq, desc, action); in request_threaded_irq()
2209 irq_chip_pm_put(&desc->irq_data); in request_threaded_irq()
2257 struct irq_desc *desc; in request_any_context_irq() local
2263 desc = irq_to_desc(irq); in request_any_context_irq()
2264 if (!desc) in request_any_context_irq()
2267 if (irq_settings_is_nested_thread(desc)) { in request_any_context_irq()
2308 struct irq_desc *desc; in request_nmi() local
2325 desc = irq_to_desc(irq); in request_nmi()
2327 if (!desc || (irq_settings_can_autoenable(desc) && in request_nmi()
2329 !irq_settings_can_request(desc) || in request_nmi()
2330 WARN_ON(irq_settings_is_per_cpu_devid(desc)) || in request_nmi()
2331 !irq_supports_nmi(desc)) in request_nmi()
2343 retval = irq_chip_pm_get(&desc->irq_data); in request_nmi()
2347 retval = __setup_irq(irq, desc, action); in request_nmi()
2351 raw_spin_lock_irqsave(&desc->lock, flags); in request_nmi()
2354 desc->istate |= IRQS_NMI; in request_nmi()
2355 retval = irq_nmi_setup(desc); in request_nmi()
2357 __cleanup_nmi(irq, desc); in request_nmi()
2358 raw_spin_unlock_irqrestore(&desc->lock, flags); in request_nmi()
2362 raw_spin_unlock_irqrestore(&desc->lock, flags); in request_nmi()
2367 irq_chip_pm_put(&desc->irq_data); in request_nmi()
2378 struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_PERCPU); in enable_percpu_irq() local
2380 if (!desc) in enable_percpu_irq()
2389 type = irqd_get_trigger_type(&desc->irq_data); in enable_percpu_irq()
2394 ret = __irq_set_trigger(desc, type); in enable_percpu_irq()
2402 irq_percpu_enable(desc, cpu); in enable_percpu_irq()
2404 irq_put_desc_unlock(desc, flags); in enable_percpu_irq()
2423 struct irq_desc *desc; in irq_percpu_is_enabled() local
2427 desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_PERCPU); in irq_percpu_is_enabled()
2428 if (!desc) in irq_percpu_is_enabled()
2431 is_enabled = cpumask_test_cpu(cpu, desc->percpu_enabled); in irq_percpu_is_enabled()
2432 irq_put_desc_unlock(desc, flags); in irq_percpu_is_enabled()
2442 struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_PERCPU); in disable_percpu_irq() local
2444 if (!desc) in disable_percpu_irq()
2447 irq_percpu_disable(desc, cpu); in disable_percpu_irq()
2448 irq_put_desc_unlock(desc, flags); in disable_percpu_irq()
2462 struct irq_desc *desc = irq_to_desc(irq); in __free_percpu_irq() local
2468 if (!desc) in __free_percpu_irq()
2471 raw_spin_lock_irqsave(&desc->lock, flags); in __free_percpu_irq()
2473 action = desc->action; in __free_percpu_irq()
2479 if (!cpumask_empty(desc->percpu_enabled)) { in __free_percpu_irq()
2481 irq, cpumask_first(desc->percpu_enabled)); in __free_percpu_irq()
2486 desc->action = NULL; in __free_percpu_irq()
2488 desc->istate &= ~IRQS_NMI; in __free_percpu_irq()
2490 raw_spin_unlock_irqrestore(&desc->lock, flags); in __free_percpu_irq()
2494 irq_chip_pm_put(&desc->irq_data); in __free_percpu_irq()
2495 module_put(desc->owner); in __free_percpu_irq()
2499 raw_spin_unlock_irqrestore(&desc->lock, flags); in __free_percpu_irq()
2512 struct irq_desc *desc = irq_to_desc(irq); in remove_percpu_irq() local
2514 if (desc && irq_settings_is_per_cpu_devid(desc)) in remove_percpu_irq()
2532 struct irq_desc *desc = irq_to_desc(irq); in free_percpu_irq() local
2534 if (!desc || !irq_settings_is_per_cpu_devid(desc)) in free_percpu_irq()
2537 chip_bus_lock(desc); in free_percpu_irq()
2539 chip_bus_sync_unlock(desc); in free_percpu_irq()
2545 struct irq_desc *desc = irq_to_desc(irq); in free_percpu_nmi() local
2547 if (!desc || !irq_settings_is_per_cpu_devid(desc)) in free_percpu_nmi()
2550 if (WARN_ON(!(desc->istate & IRQS_NMI))) in free_percpu_nmi()
2565 struct irq_desc *desc = irq_to_desc(irq); in setup_percpu_irq() local
2568 if (!desc || !irq_settings_is_per_cpu_devid(desc)) in setup_percpu_irq()
2571 retval = irq_chip_pm_get(&desc->irq_data); in setup_percpu_irq()
2575 retval = __setup_irq(irq, desc, act); in setup_percpu_irq()
2578 irq_chip_pm_put(&desc->irq_data); in setup_percpu_irq()
2605 struct irq_desc *desc; in __request_percpu_irq() local
2611 desc = irq_to_desc(irq); in __request_percpu_irq()
2612 if (!desc || !irq_settings_can_request(desc) || in __request_percpu_irq()
2613 !irq_settings_is_per_cpu_devid(desc)) in __request_percpu_irq()
2628 retval = irq_chip_pm_get(&desc->irq_data); in __request_percpu_irq()
2634 retval = __setup_irq(irq, desc, action); in __request_percpu_irq()
2637 irq_chip_pm_put(&desc->irq_data); in __request_percpu_irq()
2670 struct irq_desc *desc; in request_percpu_nmi() local
2677 desc = irq_to_desc(irq); in request_percpu_nmi()
2679 if (!desc || !irq_settings_can_request(desc) || in request_percpu_nmi()
2680 !irq_settings_is_per_cpu_devid(desc) || in request_percpu_nmi()
2681 irq_settings_can_autoenable(desc) || in request_percpu_nmi()
2682 !irq_supports_nmi(desc)) in request_percpu_nmi()
2686 if (desc->istate & IRQS_NMI) in request_percpu_nmi()
2699 retval = irq_chip_pm_get(&desc->irq_data); in request_percpu_nmi()
2703 retval = __setup_irq(irq, desc, action); in request_percpu_nmi()
2707 raw_spin_lock_irqsave(&desc->lock, flags); in request_percpu_nmi()
2708 desc->istate |= IRQS_NMI; in request_percpu_nmi()
2709 raw_spin_unlock_irqrestore(&desc->lock, flags); in request_percpu_nmi()
2714 irq_chip_pm_put(&desc->irq_data); in request_percpu_nmi()
2737 struct irq_desc *desc; in prepare_percpu_nmi() local
2742 desc = irq_get_desc_lock(irq, &flags, in prepare_percpu_nmi()
2744 if (!desc) in prepare_percpu_nmi()
2747 if (WARN(!(desc->istate & IRQS_NMI), in prepare_percpu_nmi()
2754 ret = irq_nmi_setup(desc); in prepare_percpu_nmi()
2761 irq_put_desc_unlock(desc, flags); in prepare_percpu_nmi()
2780 struct irq_desc *desc; in teardown_percpu_nmi() local
2784 desc = irq_get_desc_lock(irq, &flags, in teardown_percpu_nmi()
2786 if (!desc) in teardown_percpu_nmi()
2789 if (WARN_ON(!(desc->istate & IRQS_NMI))) in teardown_percpu_nmi()
2792 irq_nmi_teardown(desc); in teardown_percpu_nmi()
2794 irq_put_desc_unlock(desc, flags); in teardown_percpu_nmi()
2837 struct irq_desc *desc; in irq_get_irqchip_state() local
2842 desc = irq_get_desc_buslock(irq, &flags, 0); in irq_get_irqchip_state()
2843 if (!desc) in irq_get_irqchip_state()
2846 data = irq_desc_get_irq_data(desc); in irq_get_irqchip_state()
2850 irq_put_desc_busunlock(desc, flags); in irq_get_irqchip_state()
2870 struct irq_desc *desc; in irq_set_irqchip_state() local
2876 desc = irq_get_desc_buslock(irq, &flags, 0); in irq_set_irqchip_state()
2877 if (!desc) in irq_set_irqchip_state()
2880 data = irq_desc_get_irq_data(desc); in irq_set_irqchip_state()
2901 irq_put_desc_busunlock(desc, flags); in irq_set_irqchip_state()
2932 struct irq_desc *desc; in irq_check_status_bit() local
2936 desc = irq_to_desc(irq); in irq_check_status_bit()
2937 if (desc) in irq_check_status_bit()
2938 res = !!(desc->status_use_accessors & bitmask); in irq_check_status_bit()