chained_irq.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Chained IRQ handlers support.
  3. *
  4. * Copyright (C) 2011 ARM Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __IRQCHIP_CHAINED_IRQ_H
  19. #define __IRQCHIP_CHAINED_IRQ_H
  20. #include <linux/irq.h>
  21. /*
  22. * Entry/exit functions for chained handlers where the primary IRQ chip
  23. * may implement either fasteoi or level-trigger flow control.
  24. */
  25. static inline void chained_irq_enter(struct irq_chip *chip,
  26. struct irq_desc *desc)
  27. {
  28. /* FastEOI controllers require no action on entry. */
  29. if (chip->irq_eoi)
  30. return;
  31. if (chip->irq_mask_ack) {
  32. chip->irq_mask_ack(&desc->irq_data);
  33. } else {
  34. chip->irq_mask(&desc->irq_data);
  35. if (chip->irq_ack)
  36. chip->irq_ack(&desc->irq_data);
  37. }
  38. }
  39. static inline void chained_irq_exit(struct irq_chip *chip,
  40. struct irq_desc *desc)
  41. {
  42. if (chip->irq_eoi)
  43. chip->irq_eoi(&desc->irq_data);
  44. else
  45. chip->irq_unmask(&desc->irq_data);
  46. }
  47. #endif /* __IRQCHIP_CHAINED_IRQ_H */