irq.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Derived from arch/i386/kernel/irq.c
  3. * Copyright (C) 1992 Linus Torvalds
  4. * Adapted from arch/i386 by Gary Thomas
  5. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  6. * Updated and modified by Cort Dougan <cort@fsmlabs.com>
  7. * Copyright (C) 1996-2001 Cort Dougan
  8. * Adapted for Power Macintosh by Paul Mackerras
  9. * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version
  14. * 2 of the License, or (at your option) any later version.
  15. *
  16. * This file contains the code used to make IRQ descriptions in the
  17. * device tree to actual irq numbers on an interrupt controller
  18. * driver.
  19. */
  20. #include <linux/errno.h>
  21. #include <linux/module.h>
  22. #include <linux/of.h>
  23. #include <linux/of_irq.h>
  24. #include <linux/string.h>
  25. /**
  26. * irq_of_parse_and_map - Parse and map an interrupt into linux virq space
  27. * @device: Device node of the device whose interrupt is to be mapped
  28. * @index: Index of the interrupt to map
  29. *
  30. * This function is a wrapper that chains of_irq_map_one() and
  31. * irq_create_of_mapping() to make things easier to callers
  32. */
  33. unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
  34. {
  35. struct of_irq oirq;
  36. if (of_irq_map_one(dev, index, &oirq))
  37. return NO_IRQ;
  38. return irq_create_of_mapping(oirq.controller, oirq.specifier,
  39. oirq.size);
  40. }
  41. EXPORT_SYMBOL_GPL(irq_of_parse_and_map);