chained_irq.h 931 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Chained IRQ handlers support.
  4. *
  5. * Copyright (C) 2011 ARM Ltd.
  6. */
  7. #ifndef __IRQCHIP_CHAINED_IRQ_H
  8. #define __IRQCHIP_CHAINED_IRQ_H
  9. #include <linux/irq.h>
  10. /*
  11. * Entry/exit functions for chained handlers where the primary IRQ chip
  12. * may implement either fasteoi or level-trigger flow control.
  13. */
  14. static inline void chained_irq_enter(struct irq_chip *chip,
  15. struct irq_desc *desc)
  16. {
  17. /* FastEOI controllers require no action on entry. */
  18. if (chip->irq_eoi)
  19. return;
  20. if (chip->irq_mask_ack) {
  21. chip->irq_mask_ack(&desc->irq_data);
  22. } else {
  23. chip->irq_mask(&desc->irq_data);
  24. if (chip->irq_ack)
  25. chip->irq_ack(&desc->irq_data);
  26. }
  27. }
  28. static inline void chained_irq_exit(struct irq_chip *chip,
  29. struct irq_desc *desc)
  30. {
  31. if (chip->irq_eoi)
  32. chip->irq_eoi(&desc->irq_data);
  33. else
  34. chip->irq_unmask(&desc->irq_data);
  35. }
  36. #endif /* __IRQCHIP_CHAINED_IRQ_H */