@@ -499,7 +499,7 @@ static bool irq_check_poll(struct irq_desc *desc)
499499 return irq_wait_for_poll (desc );
500500}
501501
502- static bool irq_may_run (struct irq_desc * desc )
502+ static bool irq_can_handle_pm (struct irq_desc * desc )
503503{
504504 unsigned int mask = IRQD_IRQ_INPROGRESS | IRQD_WAKEUP_ARMED ;
505505
@@ -524,6 +524,25 @@ static bool irq_may_run(struct irq_desc *desc)
524524 return irq_check_poll (desc );
525525}
526526
527+ static inline bool irq_can_handle_actions (struct irq_desc * desc )
528+ {
529+ desc -> istate &= ~(IRQS_REPLAY | IRQS_WAITING );
530+
531+ if (unlikely (!desc -> action || irqd_irq_disabled (& desc -> irq_data ))) {
532+ desc -> istate |= IRQS_PENDING ;
533+ return false;
534+ }
535+ return true;
536+ }
537+
538+ static inline bool irq_can_handle (struct irq_desc * desc )
539+ {
540+ if (!irq_can_handle_pm (desc ))
541+ return false;
542+
543+ return irq_can_handle_actions (desc );
544+ }
545+
527546/**
528547 * handle_simple_irq - Simple and software-decoded IRQs.
529548 * @desc: the interrupt description structure for this irq
@@ -539,7 +558,7 @@ void handle_simple_irq(struct irq_desc *desc)
539558{
540559 raw_spin_lock (& desc -> lock );
541560
542- if (!irq_may_run (desc ))
561+ if (!irq_can_handle_pm (desc ))
543562 goto out_unlock ;
544563
545564 desc -> istate &= ~(IRQS_REPLAY | IRQS_WAITING );
@@ -574,7 +593,7 @@ void handle_untracked_irq(struct irq_desc *desc)
574593{
575594 raw_spin_lock (& desc -> lock );
576595
577- if (!irq_may_run (desc ))
596+ if (!irq_can_handle_pm (desc ))
578597 goto out_unlock ;
579598
580599 desc -> istate &= ~(IRQS_REPLAY | IRQS_WAITING );
@@ -630,7 +649,7 @@ void handle_level_irq(struct irq_desc *desc)
630649 raw_spin_lock (& desc -> lock );
631650 mask_ack_irq (desc );
632651
633- if (!irq_may_run (desc ))
652+ if (!irq_can_handle_pm (desc ))
634653 goto out_unlock ;
635654
636655 desc -> istate &= ~(IRQS_REPLAY | IRQS_WAITING );
@@ -695,7 +714,7 @@ void handle_fasteoi_irq(struct irq_desc *desc)
695714 * can arrive on the new CPU before the original CPU has completed
696715 * handling the previous one - it may need to be resent.
697716 */
698- if (!irq_may_run (desc )) {
717+ if (!irq_can_handle_pm (desc )) {
699718 if (irqd_needs_resend_when_in_progress (& desc -> irq_data ))
700719 desc -> istate |= IRQS_PENDING ;
701720 goto out ;
@@ -790,7 +809,7 @@ void handle_edge_irq(struct irq_desc *desc)
790809
791810 desc -> istate &= ~(IRQS_REPLAY | IRQS_WAITING );
792811
793- if (!irq_may_run (desc )) {
812+ if (!irq_can_handle_pm (desc )) {
794813 desc -> istate |= IRQS_PENDING ;
795814 mask_ack_irq (desc );
796815 goto out_unlock ;
@@ -1166,7 +1185,7 @@ void handle_fasteoi_ack_irq(struct irq_desc *desc)
11661185
11671186 raw_spin_lock (& desc -> lock );
11681187
1169- if (!irq_may_run (desc ))
1188+ if (!irq_can_handle_pm (desc ))
11701189 goto out ;
11711190
11721191 desc -> istate &= ~(IRQS_REPLAY | IRQS_WAITING );
@@ -1218,7 +1237,7 @@ void handle_fasteoi_mask_irq(struct irq_desc *desc)
12181237 raw_spin_lock (& desc -> lock );
12191238 mask_ack_irq (desc );
12201239
1221- if (!irq_may_run (desc ))
1240+ if (!irq_can_handle_pm (desc ))
12221241 goto out ;
12231242
12241243 desc -> istate &= ~(IRQS_REPLAY | IRQS_WAITING );
0 commit comments