diff options
author | Paul Mundt <lethal@linux-sh.org> | 2012-03-28 00:55:00 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2012-03-28 00:55:00 -0400 |
commit | 92072452f417f744cf73b2f991e4d28b75ace9d9 (patch) | |
tree | 98b840192c111546fd17b7d6a5e0e2ef1a1f64c4 /drivers | |
parent | d1000edd5d64cc316d3f45c8d00797b778cf7e41 (diff) | |
parent | b59f9f9775e643435bba76e30e59e47c19c56dee (diff) |
Merge branch 'common/intc-extension' into sh-latest
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/sh/intc/chip.c | 37 | ||||
-rw-r--r-- | drivers/sh/intc/core.c | 11 | ||||
-rw-r--r-- | drivers/sh/intc/internals.h | 9 |
3 files changed, 25 insertions, 32 deletions
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index 7b246efa94ea..012df2676a26 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c | |||
@@ -2,13 +2,14 @@ | |||
2 | * IRQ chip definitions for INTC IRQs. | 2 | * IRQ chip definitions for INTC IRQs. |
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Magnus Damm | 4 | * Copyright (C) 2007, 2008 Magnus Damm |
5 | * Copyright (C) 2009, 2010 Paul Mundt | 5 | * Copyright (C) 2009 - 2012 Paul Mundt |
6 | * | 6 | * |
7 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
8 | * License. See the file "COPYING" in the main directory of this archive | 8 | * License. See the file "COPYING" in the main directory of this archive |
9 | * for more details. | 9 | * for more details. |
10 | */ | 10 | */ |
11 | #include <linux/cpumask.h> | 11 | #include <linux/cpumask.h> |
12 | #include <linux/bsearch.h> | ||
12 | #include <linux/io.h> | 13 | #include <linux/io.h> |
13 | #include "internals.h" | 14 | #include "internals.h" |
14 | 15 | ||
@@ -58,11 +59,6 @@ static void intc_disable(struct irq_data *data) | |||
58 | } | 59 | } |
59 | } | 60 | } |
60 | 61 | ||
61 | static int intc_set_wake(struct irq_data *data, unsigned int on) | ||
62 | { | ||
63 | return 0; /* allow wakeup, but setup hardware in intc_suspend() */ | ||
64 | } | ||
65 | |||
66 | #ifdef CONFIG_SMP | 62 | #ifdef CONFIG_SMP |
67 | /* | 63 | /* |
68 | * This is held with the irq desc lock held, so we don't require any | 64 | * This is held with the irq desc lock held, so we don't require any |
@@ -78,7 +74,7 @@ static int intc_set_affinity(struct irq_data *data, | |||
78 | 74 | ||
79 | cpumask_copy(data->affinity, cpumask); | 75 | cpumask_copy(data->affinity, cpumask); |
80 | 76 | ||
81 | return 0; | 77 | return IRQ_SET_MASK_OK_NOCOPY; |
82 | } | 78 | } |
83 | #endif | 79 | #endif |
84 | 80 | ||
@@ -122,28 +118,12 @@ static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp, | |||
122 | unsigned int nr_hp, | 118 | unsigned int nr_hp, |
123 | unsigned int irq) | 119 | unsigned int irq) |
124 | { | 120 | { |
125 | int i; | 121 | struct intc_handle_int key; |
126 | |||
127 | /* | ||
128 | * this doesn't scale well, but... | ||
129 | * | ||
130 | * this function should only be used for cerain uncommon | ||
131 | * operations such as intc_set_priority() and intc_set_type() | ||
132 | * and in those rare cases performance doesn't matter that much. | ||
133 | * keeping the memory footprint low is more important. | ||
134 | * | ||
135 | * one rather simple way to speed this up and still keep the | ||
136 | * memory footprint down is to make sure the array is sorted | ||
137 | * and then perform a bisect to lookup the irq. | ||
138 | */ | ||
139 | for (i = 0; i < nr_hp; i++) { | ||
140 | if ((hp + i)->irq != irq) | ||
141 | continue; | ||
142 | 122 | ||
143 | return hp + i; | 123 | key.irq = irq; |
144 | } | 124 | key.handle = 0; |
145 | 125 | ||
146 | return NULL; | 126 | return bsearch(&key, hp, nr_hp, sizeof(*hp), intc_handle_int_cmp); |
147 | } | 127 | } |
148 | 128 | ||
149 | int intc_set_priority(unsigned int irq, unsigned int prio) | 129 | int intc_set_priority(unsigned int irq, unsigned int prio) |
@@ -223,10 +203,9 @@ struct irq_chip intc_irq_chip = { | |||
223 | .irq_mask_ack = intc_mask_ack, | 203 | .irq_mask_ack = intc_mask_ack, |
224 | .irq_enable = intc_enable, | 204 | .irq_enable = intc_enable, |
225 | .irq_disable = intc_disable, | 205 | .irq_disable = intc_disable, |
226 | .irq_shutdown = intc_disable, | ||
227 | .irq_set_type = intc_set_type, | 206 | .irq_set_type = intc_set_type, |
228 | .irq_set_wake = intc_set_wake, | ||
229 | #ifdef CONFIG_SMP | 207 | #ifdef CONFIG_SMP |
230 | .irq_set_affinity = intc_set_affinity, | 208 | .irq_set_affinity = intc_set_affinity, |
231 | #endif | 209 | #endif |
210 | .flags = IRQCHIP_SKIP_SET_WAKE, | ||
232 | }; | 211 | }; |
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index e53e449b4eca..8e1fcd5e5f0d 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Shared interrupt handling code for IPR and INTC2 types of IRQs. | 2 | * Shared interrupt handling code for IPR and INTC2 types of IRQs. |
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Magnus Damm | 4 | * Copyright (C) 2007, 2008 Magnus Damm |
5 | * Copyright (C) 2009, 2010 Paul Mundt | 5 | * Copyright (C) 2009 - 2012 Paul Mundt |
6 | * | 6 | * |
7 | * Based on intc2.c and ipr.c | 7 | * Based on intc2.c and ipr.c |
8 | * | 8 | * |
@@ -31,11 +31,12 @@ | |||
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <linux/radix-tree.h> | 32 | #include <linux/radix-tree.h> |
33 | #include <linux/export.h> | 33 | #include <linux/export.h> |
34 | #include <linux/sort.h> | ||
34 | #include "internals.h" | 35 | #include "internals.h" |
35 | 36 | ||
36 | LIST_HEAD(intc_list); | 37 | LIST_HEAD(intc_list); |
37 | DEFINE_RAW_SPINLOCK(intc_big_lock); | 38 | DEFINE_RAW_SPINLOCK(intc_big_lock); |
38 | unsigned int nr_intc_controllers; | 39 | static unsigned int nr_intc_controllers; |
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Default priority level | 42 | * Default priority level |
@@ -267,6 +268,9 @@ int __init register_intc_controller(struct intc_desc *desc) | |||
267 | k += save_reg(d, k, hw->prio_regs[i].set_reg, smp); | 268 | k += save_reg(d, k, hw->prio_regs[i].set_reg, smp); |
268 | k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp); | 269 | k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp); |
269 | } | 270 | } |
271 | |||
272 | sort(d->prio, hw->nr_prio_regs, sizeof(*d->prio), | ||
273 | intc_handle_int_cmp, NULL); | ||
270 | } | 274 | } |
271 | 275 | ||
272 | if (hw->sense_regs) { | 276 | if (hw->sense_regs) { |
@@ -277,6 +281,9 @@ int __init register_intc_controller(struct intc_desc *desc) | |||
277 | 281 | ||
278 | for (i = 0; i < hw->nr_sense_regs; i++) | 282 | for (i = 0; i < hw->nr_sense_regs; i++) |
279 | k += save_reg(d, k, hw->sense_regs[i].reg, 0); | 283 | k += save_reg(d, k, hw->sense_regs[i].reg, 0); |
284 | |||
285 | sort(d->sense, hw->nr_sense_regs, sizeof(*d->sense), | ||
286 | intc_handle_int_cmp, NULL); | ||
280 | } | 287 | } |
281 | 288 | ||
282 | if (hw->subgroups) | 289 | if (hw->subgroups) |
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h index b0e9155ff739..f034a979a16f 100644 --- a/drivers/sh/intc/internals.h +++ b/drivers/sh/intc/internals.h | |||
@@ -108,6 +108,14 @@ static inline void activate_irq(int irq) | |||
108 | #endif | 108 | #endif |
109 | } | 109 | } |
110 | 110 | ||
111 | static inline int intc_handle_int_cmp(const void *a, const void *b) | ||
112 | { | ||
113 | const struct intc_handle_int *_a = a; | ||
114 | const struct intc_handle_int *_b = b; | ||
115 | |||
116 | return _a->irq - _b->irq; | ||
117 | } | ||
118 | |||
111 | /* access.c */ | 119 | /* access.c */ |
112 | extern unsigned long | 120 | extern unsigned long |
113 | (*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data); | 121 | (*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data); |
@@ -157,7 +165,6 @@ void _intc_enable(struct irq_data *data, unsigned long handle); | |||
157 | /* core.c */ | 165 | /* core.c */ |
158 | extern struct list_head intc_list; | 166 | extern struct list_head intc_list; |
159 | extern raw_spinlock_t intc_big_lock; | 167 | extern raw_spinlock_t intc_big_lock; |
160 | extern unsigned int nr_intc_controllers; | ||
161 | extern struct bus_type intc_subsys; | 168 | extern struct bus_type intc_subsys; |
162 | 169 | ||
163 | unsigned int intc_get_dfl_prio_level(void); | 170 | unsigned int intc_get_dfl_prio_level(void); |