projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vmstat: use our own timer events
[powerpc.git]
/
include
/
linux
/
seqlock.h
diff --git
a/include/linux/seqlock.h
b/include/linux/seqlock.h
index
5a09557
..
26e4925
100644
(file)
--- a/
include/linux/seqlock.h
+++ b/
include/linux/seqlock.h
@@
-2,7
+2,7
@@
#define __LINUX_SEQLOCK_H
/*
* Reader/writer consistent mechanism without starving writers. This type of
#define __LINUX_SEQLOCK_H
/*
* Reader/writer consistent mechanism without starving writers. This type of
- * lock for data where the reader wants a consitent set of information
+ * lock for data where the reader wants a consi
s
tent set of information
* and is willing to retry if the information changes. Readers never
* block but they may have to retry if a writer is in
* progress. Writers do not wait for readers.
* and is willing to retry if the information changes. Readers never
* block but they may have to retry if a writer is in
* progress. Writers do not wait for readers.
@@
-26,7
+26,6
@@
* by Keith Owens and Andrea Arcangeli
*/
* by Keith Owens and Andrea Arcangeli
*/
-#include <linux/config.h>
#include <linux/spinlock.h>
#include <linux/preempt.h>
#include <linux/spinlock.h>
#include <linux/preempt.h>
@@
-39,9
+38,20
@@
typedef struct {
* These macros triggered gcc-3.x compile-time problems. We think these are
* OK now. Be cautious.
*/
* These macros triggered gcc-3.x compile-time problems. We think these are
* OK now. Be cautious.
*/
-#define
SEQLOCK_UNLOCKED { 0, SPIN_LOCK_UNLOCKED }
-#define seqlock_init(x) do { *(x) = (seqlock_t) SEQLOCK_UNLOCKED; } while (0)
+#define
__SEQLOCK_UNLOCKED(lockname) \
+ { 0, __SPIN_LOCK_UNLOCKED(lockname) }
+#define SEQLOCK_UNLOCKED \
+ __SEQLOCK_UNLOCKED(old_style_seqlock_init)
+
+#define seqlock_init(x) \
+ do { \
+ (x)->sequence = 0; \
+ spin_lock_init(&(x)->lock); \
+ } while (0)
+
+#define DEFINE_SEQLOCK(x) \
+ seqlock_t x = __SEQLOCK_UNLOCKED(x)
/* Lock out other writers and update the count.
* Acts like a normal spin_lock/unlock.
/* Lock out other writers and update the count.
* Acts like a normal spin_lock/unlock.
@@
-51,10
+61,10
@@
static inline void write_seqlock(seqlock_t *sl)
{
spin_lock(&sl->lock);
++sl->sequence;
{
spin_lock(&sl->lock);
++sl->sequence;
- smp_wmb();
-}
+ smp_wmb();
+}
-static inline void write_sequnlock(seqlock_t *sl)
+static inline void write_sequnlock(seqlock_t *sl)
{
smp_wmb();
sl->sequence++;
{
smp_wmb();
sl->sequence++;
@@
-67,7
+77,7
@@
static inline int write_tryseqlock(seqlock_t *sl)
if (ret) {
++sl->sequence;
if (ret) {
++sl->sequence;
- smp_wmb();
+ smp_wmb();
}
return ret;
}
}
return ret;
}