Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd31b85

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
locking, ARM: Annotate low level hw locks as raw
Annotate the low level hardware locks which must not be preempted. 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: Thomas Gleixner <[email protected]> Cc: Russell King <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent a1741e7 commit bd31b85

File tree

18 files changed

+110
-110
lines changed

18 files changed

+110
-110
lines changed

arch/arm/common/gic.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <asm/mach/irq.h>
3434
#include <asm/hardware/gic.h>
3535

36-
static DEFINE_SPINLOCK(irq_controller_lock);
36+
static DEFINE_RAW_SPINLOCK(irq_controller_lock);
3737

3838
/* Address of GIC 0 CPU interface */
3939
void __iomem *gic_cpu_base_addr __read_mostly;
@@ -82,30 +82,30 @@ static void gic_mask_irq(struct irq_data *d)
8282
{
8383
u32 mask = 1 << (d->irq % 32);
8484

85-
spin_lock(&irq_controller_lock);
85+
raw_spin_lock(&irq_controller_lock);
8686
writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
8787
if (gic_arch_extn.irq_mask)
8888
gic_arch_extn.irq_mask(d);
89-
spin_unlock(&irq_controller_lock);
89+
raw_spin_unlock(&irq_controller_lock);
9090
}
9191

9292
static void gic_unmask_irq(struct irq_data *d)
9393
{
9494
u32 mask = 1 << (d->irq % 32);
9595

96-
spin_lock(&irq_controller_lock);
96+
raw_spin_lock(&irq_controller_lock);
9797
if (gic_arch_extn.irq_unmask)
9898
gic_arch_extn.irq_unmask(d);
9999
writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
100-
spin_unlock(&irq_controller_lock);
100+
raw_spin_unlock(&irq_controller_lock);
101101
}
102102

103103
static void gic_eoi_irq(struct irq_data *d)
104104
{
105105
if (gic_arch_extn.irq_eoi) {
106-
spin_lock(&irq_controller_lock);
106+
raw_spin_lock(&irq_controller_lock);
107107
gic_arch_extn.irq_eoi(d);
108-
spin_unlock(&irq_controller_lock);
108+
raw_spin_unlock(&irq_controller_lock);
109109
}
110110

111111
writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
@@ -129,7 +129,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
129129
if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
130130
return -EINVAL;
131131

132-
spin_lock(&irq_controller_lock);
132+
raw_spin_lock(&irq_controller_lock);
133133

134134
if (gic_arch_extn.irq_set_type)
135135
gic_arch_extn.irq_set_type(d, type);
@@ -154,7 +154,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
154154
if (enabled)
155155
writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
156156

157-
spin_unlock(&irq_controller_lock);
157+
raw_spin_unlock(&irq_controller_lock);
158158

159159
return 0;
160160
}
@@ -182,10 +182,10 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
182182
mask = 0xff << shift;
183183
bit = 1 << (cpu + shift);
184184

185-
spin_lock(&irq_controller_lock);
185+
raw_spin_lock(&irq_controller_lock);
186186
val = readl_relaxed(reg) & ~mask;
187187
writel_relaxed(val | bit, reg);
188-
spin_unlock(&irq_controller_lock);
188+
raw_spin_unlock(&irq_controller_lock);
189189

190190
return IRQ_SET_MASK_OK;
191191
}
@@ -215,9 +215,9 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
215215

216216
chained_irq_enter(chip, desc);
217217

218-
spin_lock(&irq_controller_lock);
218+
raw_spin_lock(&irq_controller_lock);
219219
status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
220-
spin_unlock(&irq_controller_lock);
220+
raw_spin_unlock(&irq_controller_lock);
221221

222222
gic_irq = (status & 0x3ff);
223223
if (gic_irq == 1023)

arch/arm/include/asm/dma.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@
3434
#define DMA_MODE_CASCADE 0xc0
3535
#define DMA_AUTOINIT 0x10
3636

37-
extern spinlock_t dma_spin_lock;
37+
extern raw_spinlock_t dma_spin_lock;
3838

3939
static inline unsigned long claim_dma_lock(void)
4040
{
4141
unsigned long flags;
42-
spin_lock_irqsave(&dma_spin_lock, flags);
42+
raw_spin_lock_irqsave(&dma_spin_lock, flags);
4343
return flags;
4444
}
4545

4646
static inline void release_dma_lock(unsigned long flags)
4747
{
48-
spin_unlock_irqrestore(&dma_spin_lock, flags);
48+
raw_spin_unlock_irqrestore(&dma_spin_lock, flags);
4949
}
5050

5151
/* Clear the 'DMA Pointer Flip Flop'.

arch/arm/include/asm/mmu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
typedef struct {
77
#ifdef CONFIG_CPU_HAS_ASID
88
unsigned int id;
9-
spinlock_t id_lock;
9+
raw_spinlock_t id_lock;
1010
#endif
1111
unsigned int kvm_seq;
1212
} mm_context_t;
@@ -16,7 +16,7 @@ typedef struct {
1616

1717
/* init_mm.context.id_lock should be initialized. */
1818
#define INIT_MM_CONTEXT(name) \
19-
.context.id_lock = __SPIN_LOCK_UNLOCKED(name.context.id_lock),
19+
.context.id_lock = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
2020
#else
2121
#define ASID(mm) (0)
2222
#endif

arch/arm/kernel/dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include <asm/mach/dma.h>
2525

26-
DEFINE_SPINLOCK(dma_spin_lock);
26+
DEFINE_RAW_SPINLOCK(dma_spin_lock);
2727
EXPORT_SYMBOL(dma_spin_lock);
2828

2929
static dma_t *dma_chan[MAX_DMA_CHANNELS];

arch/arm/kernel/smp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static void percpu_timer_stop(void)
538538
}
539539
#endif
540540

541-
static DEFINE_SPINLOCK(stop_lock);
541+
static DEFINE_RAW_SPINLOCK(stop_lock);
542542

543543
/*
544544
* ipi_cpu_stop - handle IPI from smp_send_stop()
@@ -547,10 +547,10 @@ static void ipi_cpu_stop(unsigned int cpu)
547547
{
548548
if (system_state == SYSTEM_BOOTING ||
549549
system_state == SYSTEM_RUNNING) {
550-
spin_lock(&stop_lock);
550+
raw_spin_lock(&stop_lock);
551551
printk(KERN_CRIT "CPU%u: stopping\n", cpu);
552552
dump_stack();
553-
spin_unlock(&stop_lock);
553+
raw_spin_unlock(&stop_lock);
554554
}
555555

556556
set_cpu_online(cpu, false);

arch/arm/kernel/traps.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
255255
return ret;
256256
}
257257

258-
static DEFINE_SPINLOCK(die_lock);
258+
static DEFINE_RAW_SPINLOCK(die_lock);
259259

260260
/*
261261
* This function is protected against re-entrancy.
@@ -267,7 +267,7 @@ void die(const char *str, struct pt_regs *regs, int err)
267267

268268
oops_enter();
269269

270-
spin_lock_irq(&die_lock);
270+
raw_spin_lock_irq(&die_lock);
271271
console_verbose();
272272
bust_spinlocks(1);
273273
ret = __die(str, err, thread, regs);
@@ -277,7 +277,7 @@ void die(const char *str, struct pt_regs *regs, int err)
277277

278278
bust_spinlocks(0);
279279
add_taint(TAINT_DIE);
280-
spin_unlock_irq(&die_lock);
280+
raw_spin_unlock_irq(&die_lock);
281281
oops_exit();
282282

283283
if (in_interrupt())
@@ -302,24 +302,24 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
302302
}
303303

304304
static LIST_HEAD(undef_hook);
305-
static DEFINE_SPINLOCK(undef_lock);
305+
static DEFINE_RAW_SPINLOCK(undef_lock);
306306

307307
void register_undef_hook(struct undef_hook *hook)
308308
{
309309
unsigned long flags;
310310

311-
spin_lock_irqsave(&undef_lock, flags);
311+
raw_spin_lock_irqsave(&undef_lock, flags);
312312
list_add(&hook->node, &undef_hook);
313-
spin_unlock_irqrestore(&undef_lock, flags);
313+
raw_spin_unlock_irqrestore(&undef_lock, flags);
314314
}
315315

316316
void unregister_undef_hook(struct undef_hook *hook)
317317
{
318318
unsigned long flags;
319319

320-
spin_lock_irqsave(&undef_lock, flags);
320+
raw_spin_lock_irqsave(&undef_lock, flags);
321321
list_del(&hook->node);
322-
spin_unlock_irqrestore(&undef_lock, flags);
322+
raw_spin_unlock_irqrestore(&undef_lock, flags);
323323
}
324324

325325
static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
@@ -328,12 +328,12 @@ static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
328328
unsigned long flags;
329329
int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL;
330330

331-
spin_lock_irqsave(&undef_lock, flags);
331+
raw_spin_lock_irqsave(&undef_lock, flags);
332332
list_for_each_entry(hook, &undef_hook, node)
333333
if ((instr & hook->instr_mask) == hook->instr_val &&
334334
(regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val)
335335
fn = hook->fn;
336-
spin_unlock_irqrestore(&undef_lock, flags);
336+
raw_spin_unlock_irqrestore(&undef_lock, flags);
337337

338338
return fn ? fn(regs, instr) : 1;
339339
}

arch/arm/mach-footbridge/include/mach/hardware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
#define CPLD_FLASH_WR_ENABLE 1
9494

9595
#ifndef __ASSEMBLY__
96-
extern spinlock_t nw_gpio_lock;
96+
extern raw_spinlock_t nw_gpio_lock;
9797
extern void nw_gpio_modify_op(unsigned int mask, unsigned int set);
9898
extern void nw_gpio_modify_io(unsigned int mask, unsigned int in);
9999
extern unsigned int nw_gpio_read(void);

arch/arm/mach-footbridge/netwinder-hw.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static inline void wb977_ww(int reg, int val)
6868
/*
6969
* This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
7070
*/
71-
DEFINE_SPINLOCK(nw_gpio_lock);
71+
DEFINE_RAW_SPINLOCK(nw_gpio_lock);
7272
EXPORT_SYMBOL(nw_gpio_lock);
7373

7474
static unsigned int current_gpio_op;
@@ -327,9 +327,9 @@ static inline void wb977_init_gpio(void)
327327
/*
328328
* Set Group1/Group2 outputs
329329
*/
330-
spin_lock_irqsave(&nw_gpio_lock, flags);
330+
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
331331
nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
332-
spin_unlock_irqrestore(&nw_gpio_lock, flags);
332+
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
333333
}
334334

335335
/*
@@ -390,9 +390,9 @@ static void __init cpld_init(void)
390390
{
391391
unsigned long flags;
392392

393-
spin_lock_irqsave(&nw_gpio_lock, flags);
393+
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
394394
nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
395-
spin_unlock_irqrestore(&nw_gpio_lock, flags);
395+
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
396396
}
397397

398398
static unsigned char rwa_unlock[] __initdata =
@@ -616,9 +616,9 @@ static int __init nw_hw_init(void)
616616
cpld_init();
617617
rwa010_init();
618618

619-
spin_lock_irqsave(&nw_gpio_lock, flags);
619+
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
620620
nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
621-
spin_unlock_irqrestore(&nw_gpio_lock, flags);
621+
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
622622
}
623623
return 0;
624624
}

arch/arm/mach-footbridge/netwinder-leds.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
static char led_state;
3232
static char hw_led_state;
3333

34-
static DEFINE_SPINLOCK(leds_lock);
34+
static DEFINE_RAW_SPINLOCK(leds_lock);
3535

3636
static void netwinder_leds_event(led_event_t evt)
3737
{
3838
unsigned long flags;
3939

40-
spin_lock_irqsave(&leds_lock, flags);
40+
raw_spin_lock_irqsave(&leds_lock, flags);
4141

4242
switch (evt) {
4343
case led_start:
@@ -117,12 +117,12 @@ static void netwinder_leds_event(led_event_t evt)
117117
break;
118118
}
119119

120-
spin_unlock_irqrestore(&leds_lock, flags);
120+
raw_spin_unlock_irqrestore(&leds_lock, flags);
121121

122122
if (led_state & LED_STATE_ENABLED) {
123-
spin_lock_irqsave(&nw_gpio_lock, flags);
123+
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
124124
nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
125-
spin_unlock_irqrestore(&nw_gpio_lock, flags);
125+
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
126126
}
127127
}
128128

arch/arm/mach-integrator/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static struct amba_pl010_data integrator_uart_data = {
205205

206206
#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL)
207207

208-
static DEFINE_SPINLOCK(cm_lock);
208+
static DEFINE_RAW_SPINLOCK(cm_lock);
209209

210210
/**
211211
* cm_control - update the CM_CTRL register.
@@ -217,10 +217,10 @@ void cm_control(u32 mask, u32 set)
217217
unsigned long flags;
218218
u32 val;
219219

220-
spin_lock_irqsave(&cm_lock, flags);
220+
raw_spin_lock_irqsave(&cm_lock, flags);
221221
val = readl(CM_CTRL) & ~mask;
222222
writel(val | set, CM_CTRL);
223-
spin_unlock_irqrestore(&cm_lock, flags);
223+
raw_spin_unlock_irqrestore(&cm_lock, flags);
224224
}
225225

226226
EXPORT_SYMBOL(cm_control);

0 commit comments

Comments
 (0)