aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2007-05-08 03:34:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:20 -0400
commit4431f46f5fe0e3b740dfaf09ba34f0b14688185e (patch)
treed60c7604c82a02da61a8638891b21606c635146b /include/asm-ia64
parenta075227948636e10aa2cc2d8725fbbab27681d4a (diff)
local_t: ia64 extension
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-ia64')
-rw-r--r--include/asm-ia64/local.h51
1 files changed, 1 insertions, 50 deletions
diff --git a/include/asm-ia64/local.h b/include/asm-ia64/local.h
index dc519092ef4d..c11c530f74d0 100644
--- a/include/asm-ia64/local.h
+++ b/include/asm-ia64/local.h
@@ -1,50 +1 @@
1#ifndef _ASM_IA64_LOCAL_H #include <asm-generic/local.h>
2#define _ASM_IA64_LOCAL_H
3
4/*
5 * Copyright (C) 2003 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
8
9#include <linux/percpu.h>
10
11typedef struct {
12 atomic64_t val;
13} local_t;
14
15#define LOCAL_INIT(i) ((local_t) { { (i) } })
16#define local_read(l) atomic64_read(&(l)->val)
17#define local_set(l, i) atomic64_set(&(l)->val, i)
18#define local_inc(l) atomic64_inc(&(l)->val)
19#define local_dec(l) atomic64_dec(&(l)->val)
20#define local_add(i, l) atomic64_add((i), &(l)->val)
21#define local_sub(i, l) atomic64_sub((i), &(l)->val)
22
23/* Non-atomic variants, i.e., preemption disabled and won't be touched in interrupt, etc. */
24
25#define __local_inc(l) (++(l)->val.counter)
26#define __local_dec(l) (--(l)->val.counter)
27#define __local_add(i,l) ((l)->val.counter += (i))
28#define __local_sub(i,l) ((l)->val.counter -= (i))
29
30/*
31 * Use these for per-cpu local_t variables. Note they take a variable (eg. mystruct.foo),
32 * not an address.
33 */
34#define cpu_local_read(v) local_read(&__ia64_per_cpu_var(v))
35#define cpu_local_set(v, i) local_set(&__ia64_per_cpu_var(v), (i))
36#define cpu_local_inc(v) local_inc(&__ia64_per_cpu_var(v))
37#define cpu_local_dec(v) local_dec(&__ia64_per_cpu_var(v))
38#define cpu_local_add(i, v) local_add((i), &__ia64_per_cpu_var(v))
39#define cpu_local_sub(i, v) local_sub((i), &__ia64_per_cpu_var(v))
40
41/*
42 * Non-atomic increments, i.e., preemption disabled and won't be touched in interrupt,
43 * etc.
44 */
45#define __cpu_local_inc(v) __local_inc(&__ia64_per_cpu_var(v))
46#define __cpu_local_dec(v) __local_dec(&__ia64_per_cpu_var(v))
47#define __cpu_local_add(i, v) __local_add((i), &__ia64_per_cpu_var(v))
48#define __cpu_local_sub(i, v) __local_sub((i), &__ia64_per_cpu_var(v))
49
50#endif /* _ASM_IA64_LOCAL_H */