diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-07-29 10:27:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-09-13 05:12:15 -0400 |
commit | 289b4e7a48d91fbef7af819020d826ad9f49f568 (patch) | |
tree | c3155c141dc976c5c2d404e4cc4c99c278cce58f /drivers/dma | |
parent | bd31b85960a7fcb2d7ede216460b8da71a88411c (diff) |
locking, dma, ipu: Annotate bank_lock as raw
The bank_lock can be taken in atomic context (irq handling)
and therefore cannot be preempted on -rt - annotate it.
In mainline this change documents the low level nature of
the lock - otherwise there's no functional difference. Lockdep
and Sparse checking will work as usual.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: kernel@pengutronix.de
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Link: http://lkml.kernel.org/r/1311949627-13260-1-git-send-email-u.kleine-koenig@pengutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ipu/ipu_irq.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/dma/ipu/ipu_irq.c b/drivers/dma/ipu/ipu_irq.c index ab8a4eff072a..a71f55e72be9 100644 --- a/drivers/dma/ipu/ipu_irq.c +++ b/drivers/dma/ipu/ipu_irq.c | |||
@@ -81,7 +81,7 @@ static struct ipu_irq_map irq_map[CONFIG_MX3_IPU_IRQS]; | |||
81 | /* Protects allocations from the above array of maps */ | 81 | /* Protects allocations from the above array of maps */ |
82 | static DEFINE_MUTEX(map_lock); | 82 | static DEFINE_MUTEX(map_lock); |
83 | /* Protects register accesses and individual mappings */ | 83 | /* Protects register accesses and individual mappings */ |
84 | static DEFINE_SPINLOCK(bank_lock); | 84 | static DEFINE_RAW_SPINLOCK(bank_lock); |
85 | 85 | ||
86 | static struct ipu_irq_map *src2map(unsigned int src) | 86 | static struct ipu_irq_map *src2map(unsigned int src) |
87 | { | 87 | { |
@@ -101,11 +101,11 @@ static void ipu_irq_unmask(struct irq_data *d) | |||
101 | uint32_t reg; | 101 | uint32_t reg; |
102 | unsigned long lock_flags; | 102 | unsigned long lock_flags; |
103 | 103 | ||
104 | spin_lock_irqsave(&bank_lock, lock_flags); | 104 | raw_spin_lock_irqsave(&bank_lock, lock_flags); |
105 | 105 | ||
106 | bank = map->bank; | 106 | bank = map->bank; |
107 | if (!bank) { | 107 | if (!bank) { |
108 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 108 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
109 | pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq); | 109 | pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq); |
110 | return; | 110 | return; |
111 | } | 111 | } |
@@ -114,7 +114,7 @@ static void ipu_irq_unmask(struct irq_data *d) | |||
114 | reg |= (1UL << (map->source & 31)); | 114 | reg |= (1UL << (map->source & 31)); |
115 | ipu_write_reg(bank->ipu, reg, bank->control); | 115 | ipu_write_reg(bank->ipu, reg, bank->control); |
116 | 116 | ||
117 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 117 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
118 | } | 118 | } |
119 | 119 | ||
120 | static void ipu_irq_mask(struct irq_data *d) | 120 | static void ipu_irq_mask(struct irq_data *d) |
@@ -124,11 +124,11 @@ static void ipu_irq_mask(struct irq_data *d) | |||
124 | uint32_t reg; | 124 | uint32_t reg; |
125 | unsigned long lock_flags; | 125 | unsigned long lock_flags; |
126 | 126 | ||
127 | spin_lock_irqsave(&bank_lock, lock_flags); | 127 | raw_spin_lock_irqsave(&bank_lock, lock_flags); |
128 | 128 | ||
129 | bank = map->bank; | 129 | bank = map->bank; |
130 | if (!bank) { | 130 | if (!bank) { |
131 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 131 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
132 | pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq); | 132 | pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq); |
133 | return; | 133 | return; |
134 | } | 134 | } |
@@ -137,7 +137,7 @@ static void ipu_irq_mask(struct irq_data *d) | |||
137 | reg &= ~(1UL << (map->source & 31)); | 137 | reg &= ~(1UL << (map->source & 31)); |
138 | ipu_write_reg(bank->ipu, reg, bank->control); | 138 | ipu_write_reg(bank->ipu, reg, bank->control); |
139 | 139 | ||
140 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 140 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
141 | } | 141 | } |
142 | 142 | ||
143 | static void ipu_irq_ack(struct irq_data *d) | 143 | static void ipu_irq_ack(struct irq_data *d) |
@@ -146,17 +146,17 @@ static void ipu_irq_ack(struct irq_data *d) | |||
146 | struct ipu_irq_bank *bank; | 146 | struct ipu_irq_bank *bank; |
147 | unsigned long lock_flags; | 147 | unsigned long lock_flags; |
148 | 148 | ||
149 | spin_lock_irqsave(&bank_lock, lock_flags); | 149 | raw_spin_lock_irqsave(&bank_lock, lock_flags); |
150 | 150 | ||
151 | bank = map->bank; | 151 | bank = map->bank; |
152 | if (!bank) { | 152 | if (!bank) { |
153 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 153 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
154 | pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq); | 154 | pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq); |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | 157 | ||
158 | ipu_write_reg(bank->ipu, 1UL << (map->source & 31), bank->status); | 158 | ipu_write_reg(bank->ipu, 1UL << (map->source & 31), bank->status); |
159 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 159 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
160 | } | 160 | } |
161 | 161 | ||
162 | /** | 162 | /** |
@@ -172,11 +172,11 @@ bool ipu_irq_status(unsigned int irq) | |||
172 | unsigned long lock_flags; | 172 | unsigned long lock_flags; |
173 | bool ret; | 173 | bool ret; |
174 | 174 | ||
175 | spin_lock_irqsave(&bank_lock, lock_flags); | 175 | raw_spin_lock_irqsave(&bank_lock, lock_flags); |
176 | bank = map->bank; | 176 | bank = map->bank; |
177 | ret = bank && ipu_read_reg(bank->ipu, bank->status) & | 177 | ret = bank && ipu_read_reg(bank->ipu, bank->status) & |
178 | (1UL << (map->source & 31)); | 178 | (1UL << (map->source & 31)); |
179 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 179 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
180 | 180 | ||
181 | return ret; | 181 | return ret; |
182 | } | 182 | } |
@@ -213,10 +213,10 @@ int ipu_irq_map(unsigned int source) | |||
213 | if (irq_map[i].source < 0) { | 213 | if (irq_map[i].source < 0) { |
214 | unsigned long lock_flags; | 214 | unsigned long lock_flags; |
215 | 215 | ||
216 | spin_lock_irqsave(&bank_lock, lock_flags); | 216 | raw_spin_lock_irqsave(&bank_lock, lock_flags); |
217 | irq_map[i].source = source; | 217 | irq_map[i].source = source; |
218 | irq_map[i].bank = irq_bank + source / 32; | 218 | irq_map[i].bank = irq_bank + source / 32; |
219 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 219 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
220 | 220 | ||
221 | ret = irq_map[i].irq; | 221 | ret = irq_map[i].irq; |
222 | pr_debug("IPU: mapped source %u to IRQ %u\n", | 222 | pr_debug("IPU: mapped source %u to IRQ %u\n", |
@@ -252,10 +252,10 @@ int ipu_irq_unmap(unsigned int source) | |||
252 | pr_debug("IPU: unmapped source %u from IRQ %u\n", | 252 | pr_debug("IPU: unmapped source %u from IRQ %u\n", |
253 | source, irq_map[i].irq); | 253 | source, irq_map[i].irq); |
254 | 254 | ||
255 | spin_lock_irqsave(&bank_lock, lock_flags); | 255 | raw_spin_lock_irqsave(&bank_lock, lock_flags); |
256 | irq_map[i].source = -EINVAL; | 256 | irq_map[i].source = -EINVAL; |
257 | irq_map[i].bank = NULL; | 257 | irq_map[i].bank = NULL; |
258 | spin_unlock_irqrestore(&bank_lock, lock_flags); | 258 | raw_spin_unlock_irqrestore(&bank_lock, lock_flags); |
259 | 259 | ||
260 | ret = 0; | 260 | ret = 0; |
261 | break; | 261 | break; |
@@ -276,7 +276,7 @@ static void ipu_irq_err(unsigned int irq, struct irq_desc *desc) | |||
276 | for (i = IPU_IRQ_NR_FN_BANKS; i < IPU_IRQ_NR_BANKS; i++) { | 276 | for (i = IPU_IRQ_NR_FN_BANKS; i < IPU_IRQ_NR_BANKS; i++) { |
277 | struct ipu_irq_bank *bank = irq_bank + i; | 277 | struct ipu_irq_bank *bank = irq_bank + i; |
278 | 278 | ||
279 | spin_lock(&bank_lock); | 279 | raw_spin_lock(&bank_lock); |
280 | status = ipu_read_reg(ipu, bank->status); | 280 | status = ipu_read_reg(ipu, bank->status); |
281 | /* | 281 | /* |
282 | * Don't think we have to clear all interrupts here, they will | 282 | * Don't think we have to clear all interrupts here, they will |
@@ -284,18 +284,18 @@ static void ipu_irq_err(unsigned int irq, struct irq_desc *desc) | |||
284 | * might want to clear unhandled interrupts after the loop... | 284 | * might want to clear unhandled interrupts after the loop... |
285 | */ | 285 | */ |
286 | status &= ipu_read_reg(ipu, bank->control); | 286 | status &= ipu_read_reg(ipu, bank->control); |
287 | spin_unlock(&bank_lock); | 287 | raw_spin_unlock(&bank_lock); |
288 | while ((line = ffs(status))) { | 288 | while ((line = ffs(status))) { |
289 | struct ipu_irq_map *map; | 289 | struct ipu_irq_map *map; |
290 | 290 | ||
291 | line--; | 291 | line--; |
292 | status &= ~(1UL << line); | 292 | status &= ~(1UL << line); |
293 | 293 | ||
294 | spin_lock(&bank_lock); | 294 | raw_spin_lock(&bank_lock); |
295 | map = src2map(32 * i + line); | 295 | map = src2map(32 * i + line); |
296 | if (map) | 296 | if (map) |
297 | irq = map->irq; | 297 | irq = map->irq; |
298 | spin_unlock(&bank_lock); | 298 | raw_spin_unlock(&bank_lock); |
299 | 299 | ||
300 | if (!map) { | 300 | if (!map) { |
301 | pr_err("IPU: Interrupt on unmapped source %u bank %d\n", | 301 | pr_err("IPU: Interrupt on unmapped source %u bank %d\n", |
@@ -317,22 +317,22 @@ static void ipu_irq_fn(unsigned int irq, struct irq_desc *desc) | |||
317 | for (i = 0; i < IPU_IRQ_NR_FN_BANKS; i++) { | 317 | for (i = 0; i < IPU_IRQ_NR_FN_BANKS; i++) { |
318 | struct ipu_irq_bank *bank = irq_bank + i; | 318 | struct ipu_irq_bank *bank = irq_bank + i; |
319 | 319 | ||
320 | spin_lock(&bank_lock); | 320 | raw_spin_lock(&bank_lock); |
321 | status = ipu_read_reg(ipu, bank->status); | 321 | status = ipu_read_reg(ipu, bank->status); |
322 | /* Not clearing all interrupts, see above */ | 322 | /* Not clearing all interrupts, see above */ |
323 | status &= ipu_read_reg(ipu, bank->control); | 323 | status &= ipu_read_reg(ipu, bank->control); |
324 | spin_unlock(&bank_lock); | 324 | raw_spin_unlock(&bank_lock); |
325 | while ((line = ffs(status))) { | 325 | while ((line = ffs(status))) { |
326 | struct ipu_irq_map *map; | 326 | struct ipu_irq_map *map; |
327 | 327 | ||
328 | line--; | 328 | line--; |
329 | status &= ~(1UL << line); | 329 | status &= ~(1UL << line); |
330 | 330 | ||
331 | spin_lock(&bank_lock); | 331 | raw_spin_lock(&bank_lock); |
332 | map = src2map(32 * i + line); | 332 | map = src2map(32 * i + line); |
333 | if (map) | 333 | if (map) |
334 | irq = map->irq; | 334 | irq = map->irq; |
335 | spin_unlock(&bank_lock); | 335 | raw_spin_unlock(&bank_lock); |
336 | 336 | ||
337 | if (!map) { | 337 | if (!map) { |
338 | pr_err("IPU: Interrupt on unmapped source %u bank %d\n", | 338 | pr_err("IPU: Interrupt on unmapped source %u bank %d\n", |