@@ -846,45 +846,40 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on)
846
846
*/
847
847
int irq_set_irq_wake (unsigned int irq , unsigned int on )
848
848
{
849
- unsigned long flags ;
850
- struct irq_desc * desc = irq_get_desc_buslock (irq , & flags , IRQ_GET_DESC_CHECK_GLOBAL );
851
- int ret = 0 ;
852
-
853
- if (!desc )
854
- return - EINVAL ;
849
+ scoped_irqdesc_get_and_lock (irq , IRQ_GET_DESC_CHECK_GLOBAL ) {
850
+ struct irq_desc * desc = scoped_irqdesc ;
851
+ int ret = 0 ;
855
852
856
- /* Don't use NMIs as wake up interrupts please */
857
- if (irq_is_nmi (desc )) {
858
- ret = - EINVAL ;
859
- goto out_unlock ;
860
- }
853
+ /* Don't use NMIs as wake up interrupts please */
854
+ if (irq_is_nmi (desc ))
855
+ return - EINVAL ;
861
856
862
- /* wakeup-capable irqs can be shared between drivers that
863
- * don't need to have the same sleep mode behaviors.
864
- */
865
- if (on ) {
866
- if (desc -> wake_depth ++ == 0 ) {
867
- ret = set_irq_wake_real (irq , on );
868
- if (ret )
869
- desc -> wake_depth = 0 ;
870
- else
871
- irqd_set (& desc -> irq_data , IRQD_WAKEUP_STATE );
872
- }
873
- } else {
874
- if (desc -> wake_depth == 0 ) {
875
- WARN (1 , "Unbalanced IRQ %d wake disable\n" , irq );
876
- } else if (-- desc -> wake_depth == 0 ) {
877
- ret = set_irq_wake_real (irq , on );
878
- if (ret )
879
- desc -> wake_depth = 1 ;
880
- else
881
- irqd_clear (& desc -> irq_data , IRQD_WAKEUP_STATE );
857
+ /*
858
+ * wakeup-capable irqs can be shared between drivers that
859
+ * don't need to have the same sleep mode behaviors.
860
+ */
861
+ if (on ) {
862
+ if (desc -> wake_depth ++ == 0 ) {
863
+ ret = set_irq_wake_real (irq , on );
864
+ if (ret )
865
+ desc -> wake_depth = 0 ;
866
+ else
867
+ irqd_set (& desc -> irq_data , IRQD_WAKEUP_STATE );
868
+ }
869
+ } else {
870
+ if (desc -> wake_depth == 0 ) {
871
+ WARN (1 , "Unbalanced IRQ %d wake disable\n" , irq );
872
+ } else if (-- desc -> wake_depth == 0 ) {
873
+ ret = set_irq_wake_real (irq , on );
874
+ if (ret )
875
+ desc -> wake_depth = 1 ;
876
+ else
877
+ irqd_clear (& desc -> irq_data , IRQD_WAKEUP_STATE );
878
+ }
882
879
}
880
+ return ret ;
883
881
}
884
-
885
- out_unlock :
886
- irq_put_desc_busunlock (desc , flags );
887
- return ret ;
882
+ return - EINVAL ;
888
883
}
889
884
EXPORT_SYMBOL (irq_set_irq_wake );
890
885
0 commit comments