.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * drivers/irq/irq-nvic.c |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2008 ARM Limited, All Rights Reserved. |
---|
5 | 6 | * Copyright (C) 2013 Pengutronix |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify |
---|
8 | | - * it under the terms of the GNU General Public License version 2 as |
---|
9 | | - * published by the Free Software Foundation. |
---|
10 | 7 | * |
---|
11 | 8 | * Support for the Nested Vectored Interrupt Controller found on the |
---|
12 | 9 | * ARMv7-M CPUs (Cortex-M3/M4) |
---|
.. | .. |
---|
48 | 45 | handle_IRQ(irq, regs); |
---|
49 | 46 | } |
---|
50 | 47 | |
---|
51 | | -static int nvic_irq_domain_translate(struct irq_domain *d, |
---|
52 | | - struct irq_fwspec *fwspec, |
---|
53 | | - unsigned long *hwirq, unsigned int *type) |
---|
54 | | -{ |
---|
55 | | - if (WARN_ON(fwspec->param_count < 1)) |
---|
56 | | - return -EINVAL; |
---|
57 | | - *hwirq = fwspec->param[0]; |
---|
58 | | - *type = IRQ_TYPE_NONE; |
---|
59 | | - return 0; |
---|
60 | | -} |
---|
61 | | - |
---|
62 | 48 | static int nvic_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, |
---|
63 | 49 | unsigned int nr_irqs, void *arg) |
---|
64 | 50 | { |
---|
.. | .. |
---|
67 | 53 | unsigned int type = IRQ_TYPE_NONE; |
---|
68 | 54 | struct irq_fwspec *fwspec = arg; |
---|
69 | 55 | |
---|
70 | | - ret = nvic_irq_domain_translate(domain, fwspec, &hwirq, &type); |
---|
| 56 | + ret = irq_domain_translate_onecell(domain, fwspec, &hwirq, &type); |
---|
71 | 57 | if (ret) |
---|
72 | 58 | return ret; |
---|
73 | 59 | |
---|
.. | .. |
---|
78 | 64 | } |
---|
79 | 65 | |
---|
80 | 66 | static const struct irq_domain_ops nvic_irq_domain_ops = { |
---|
81 | | - .translate = nvic_irq_domain_translate, |
---|
| 67 | + .translate = irq_domain_translate_onecell, |
---|
82 | 68 | .alloc = nvic_irq_domain_alloc, |
---|
83 | 69 | .free = irq_domain_free_irqs_top, |
---|
84 | 70 | }; |
---|
.. | .. |
---|
108 | 94 | |
---|
109 | 95 | if (!nvic_irq_domain) { |
---|
110 | 96 | pr_warn("Failed to allocate irq domain\n"); |
---|
| 97 | + iounmap(nvic_base); |
---|
111 | 98 | return -ENOMEM; |
---|
112 | 99 | } |
---|
113 | 100 | |
---|
.. | .. |
---|
117 | 104 | if (ret) { |
---|
118 | 105 | pr_warn("Failed to allocate irq chips\n"); |
---|
119 | 106 | irq_domain_remove(nvic_irq_domain); |
---|
| 107 | + iounmap(nvic_base); |
---|
120 | 108 | return ret; |
---|
121 | 109 | } |
---|
122 | 110 | |
---|