~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to include/linux/seqlock.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
#include <linux/spinlock.h>
30
30
#include <linux/preempt.h>
 
31
#include <asm/processor.h>
31
32
 
32
33
typedef struct {
33
34
        unsigned sequence;
41
42
#define __SEQLOCK_UNLOCKED(lockname) \
42
43
                 { 0, __SPIN_LOCK_UNLOCKED(lockname) }
43
44
 
44
 
#define SEQLOCK_UNLOCKED \
45
 
                 __SEQLOCK_UNLOCKED(old_style_seqlock_init)
46
 
 
47
45
#define seqlock_init(x)                                 \
48
46
        do {                                            \
49
47
                (x)->sequence = 0;                      \
88
86
        unsigned ret;
89
87
 
90
88
repeat:
91
 
        ret = sl->sequence;
92
 
        smp_rmb();
 
89
        ret = ACCESS_ONCE(sl->sequence);
93
90
        if (unlikely(ret & 1)) {
94
91
                cpu_relax();
95
92
                goto repeat;
96
93
        }
 
94
        smp_rmb();
97
95
 
98
96
        return ret;
99
97
}