Commit 289b4e7a48d91fbef7af819020d826ad9f49f568

Authored by Uwe Kleine-König
Committed by Ingo Molnar
1 parent bd31b85960

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>

Showing 1 changed file with 24 additions and 24 deletions Side-by-side Diff

drivers/dma/ipu/ipu_irq.c
... ... @@ -81,7 +81,7 @@
81 81 /* Protects allocations from the above array of maps */
82 82 static DEFINE_MUTEX(map_lock);
83 83 /* Protects register accesses and individual mappings */
84   -static DEFINE_SPINLOCK(bank_lock);
  84 +static DEFINE_RAW_SPINLOCK(bank_lock);
85 85  
86 86 static struct ipu_irq_map *src2map(unsigned int src)
87 87 {
88 88  
... ... @@ -101,11 +101,11 @@
101 101 uint32_t reg;
102 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 106 bank = map->bank;
107 107 if (!bank) {
108   - spin_unlock_irqrestore(&bank_lock, lock_flags);
  108 + raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
109 109 pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
110 110 return;
111 111 }
... ... @@ -114,7 +114,7 @@
114 114 reg |= (1UL << (map->source & 31));
115 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 120 static void ipu_irq_mask(struct irq_data *d)
121 121  
... ... @@ -124,11 +124,11 @@
124 124 uint32_t reg;
125 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 129 bank = map->bank;
130 130 if (!bank) {
131   - spin_unlock_irqrestore(&bank_lock, lock_flags);
  131 + raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
132 132 pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
133 133 return;
134 134 }
... ... @@ -137,7 +137,7 @@
137 137 reg &= ~(1UL << (map->source & 31));
138 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 143 static void ipu_irq_ack(struct irq_data *d)
144 144  
145 145  
... ... @@ -146,17 +146,17 @@
146 146 struct ipu_irq_bank *bank;
147 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 151 bank = map->bank;
152 152 if (!bank) {
153   - spin_unlock_irqrestore(&bank_lock, lock_flags);
  153 + raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
154 154 pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
155 155 return;
156 156 }
157 157  
158 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 /**
163 163  
... ... @@ -172,11 +172,11 @@
172 172 unsigned long lock_flags;
173 173 bool ret;
174 174  
175   - spin_lock_irqsave(&bank_lock, lock_flags);
  175 + raw_spin_lock_irqsave(&bank_lock, lock_flags);
176 176 bank = map->bank;
177 177 ret = bank && ipu_read_reg(bank->ipu, bank->status) &
178 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 181 return ret;
182 182 }
183 183  
... ... @@ -213,10 +213,10 @@
213 213 if (irq_map[i].source < 0) {
214 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 217 irq_map[i].source = source;
218 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 221 ret = irq_map[i].irq;
222 222 pr_debug("IPU: mapped source %u to IRQ %u\n",
223 223  
... ... @@ -252,10 +252,10 @@
252 252 pr_debug("IPU: unmapped source %u from IRQ %u\n",
253 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 256 irq_map[i].source = -EINVAL;
257 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 260 ret = 0;
261 261 break;
... ... @@ -276,7 +276,7 @@
276 276 for (i = IPU_IRQ_NR_FN_BANKS; i < IPU_IRQ_NR_BANKS; i++) {
277 277 struct ipu_irq_bank *bank = irq_bank + i;
278 278  
279   - spin_lock(&bank_lock);
  279 + raw_spin_lock(&bank_lock);
280 280 status = ipu_read_reg(ipu, bank->status);
281 281 /*
282 282 * Don't think we have to clear all interrupts here, they will
283 283  
284 284  
... ... @@ -284,18 +284,18 @@
284 284 * might want to clear unhandled interrupts after the loop...
285 285 */
286 286 status &= ipu_read_reg(ipu, bank->control);
287   - spin_unlock(&bank_lock);
  287 + raw_spin_unlock(&bank_lock);
288 288 while ((line = ffs(status))) {
289 289 struct ipu_irq_map *map;
290 290  
291 291 line--;
292 292 status &= ~(1UL << line);
293 293  
294   - spin_lock(&bank_lock);
  294 + raw_spin_lock(&bank_lock);
295 295 map = src2map(32 * i + line);
296 296 if (map)
297 297 irq = map->irq;
298   - spin_unlock(&bank_lock);
  298 + raw_spin_unlock(&bank_lock);
299 299  
300 300 if (!map) {
301 301 pr_err("IPU: Interrupt on unmapped source %u bank %d\n",
302 302  
303 303  
304 304  
... ... @@ -317,22 +317,22 @@
317 317 for (i = 0; i < IPU_IRQ_NR_FN_BANKS; i++) {
318 318 struct ipu_irq_bank *bank = irq_bank + i;
319 319  
320   - spin_lock(&bank_lock);
  320 + raw_spin_lock(&bank_lock);
321 321 status = ipu_read_reg(ipu, bank->status);
322 322 /* Not clearing all interrupts, see above */
323 323 status &= ipu_read_reg(ipu, bank->control);
324   - spin_unlock(&bank_lock);
  324 + raw_spin_unlock(&bank_lock);
325 325 while ((line = ffs(status))) {
326 326 struct ipu_irq_map *map;
327 327  
328 328 line--;
329 329 status &= ~(1UL << line);
330 330  
331   - spin_lock(&bank_lock);
  331 + raw_spin_lock(&bank_lock);
332 332 map = src2map(32 * i + line);
333 333 if (map)
334 334 irq = map->irq;
335   - spin_unlock(&bank_lock);
  335 + raw_spin_unlock(&bank_lock);
336 336  
337 337 if (!map) {
338 338 pr_err("IPU: Interrupt on unmapped source %u bank %d\n",