Skip to content

Commit

Permalink
locking: Convert raw_rwlock to arch_rwlock
Browse files Browse the repository at this point in the history
Not strictly necessary for -rt as -rt does not have non sleeping
rwlocks, but it's odd to not have a consistent naming convention.

No functional change.

Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Acked-by: David S. Miller <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: [email protected]
  • Loading branch information
KAGA-KOKO committed Dec 14, 2009
1 parent 0199c4e commit fb3a6bb
Show file tree
Hide file tree
Showing 32 changed files with 151 additions and 151 deletions.
16 changes: 8 additions & 8 deletions arch/alpha/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)

/***********************************************************/

static inline int __raw_read_can_lock(raw_rwlock_t *lock)
static inline int __raw_read_can_lock(arch_rwlock_t *lock)
{
return (lock->lock & 1) == 0;
}

static inline int __raw_write_can_lock(raw_rwlock_t *lock)
static inline int __raw_write_can_lock(arch_rwlock_t *lock)
{
return lock->lock == 0;
}

static inline void __raw_read_lock(raw_rwlock_t *lock)
static inline void __raw_read_lock(arch_rwlock_t *lock)
{
long regx;

Expand All @@ -80,7 +80,7 @@ static inline void __raw_read_lock(raw_rwlock_t *lock)
: "m" (*lock) : "memory");
}

static inline void __raw_write_lock(raw_rwlock_t *lock)
static inline void __raw_write_lock(arch_rwlock_t *lock)
{
long regx;

Expand All @@ -100,7 +100,7 @@ static inline void __raw_write_lock(raw_rwlock_t *lock)
: "m" (*lock) : "memory");
}

static inline int __raw_read_trylock(raw_rwlock_t * lock)
static inline int __raw_read_trylock(arch_rwlock_t * lock)
{
long regx;
int success;
Expand All @@ -122,7 +122,7 @@ static inline int __raw_read_trylock(raw_rwlock_t * lock)
return success;
}

static inline int __raw_write_trylock(raw_rwlock_t * lock)
static inline int __raw_write_trylock(arch_rwlock_t * lock)
{
long regx;
int success;
Expand All @@ -144,7 +144,7 @@ static inline int __raw_write_trylock(raw_rwlock_t * lock)
return success;
}

static inline void __raw_read_unlock(raw_rwlock_t * lock)
static inline void __raw_read_unlock(arch_rwlock_t * lock)
{
long regx;
__asm__ __volatile__(
Expand All @@ -160,7 +160,7 @@ static inline void __raw_read_unlock(raw_rwlock_t * lock)
: "m" (*lock) : "memory");
}

static inline void __raw_write_unlock(raw_rwlock_t * lock)
static inline void __raw_write_unlock(arch_rwlock_t * lock)
{
mb();
lock->lock = 0;
Expand Down
4 changes: 2 additions & 2 deletions arch/alpha/include/asm/spinlock_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ typedef struct {

typedef struct {
volatile unsigned int lock;
} raw_rwlock_t;
} arch_rwlock_t;

#define __RAW_RW_LOCK_UNLOCKED { 0 }
#define __ARCH_RW_LOCK_UNLOCKED { 0 }

#endif
12 changes: 6 additions & 6 deletions arch/arm/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
* just write zero since the lock is exclusively held.
*/

static inline void __raw_write_lock(raw_rwlock_t *rw)
static inline void __raw_write_lock(arch_rwlock_t *rw)
{
unsigned long tmp;

Expand All @@ -106,7 +106,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
smp_mb();
}

static inline int __raw_write_trylock(raw_rwlock_t *rw)
static inline int __raw_write_trylock(arch_rwlock_t *rw)
{
unsigned long tmp;

Expand All @@ -126,7 +126,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
}
}

static inline void __raw_write_unlock(raw_rwlock_t *rw)
static inline void __raw_write_unlock(arch_rwlock_t *rw)
{
smp_mb();

Expand Down Expand Up @@ -156,7 +156,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
* currently active. However, we know we won't have any write
* locks.
*/
static inline void __raw_read_lock(raw_rwlock_t *rw)
static inline void __raw_read_lock(arch_rwlock_t *rw)
{
unsigned long tmp, tmp2;

Expand All @@ -176,7 +176,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
smp_mb();
}

static inline void __raw_read_unlock(raw_rwlock_t *rw)
static inline void __raw_read_unlock(arch_rwlock_t *rw)
{
unsigned long tmp, tmp2;

Expand All @@ -198,7 +198,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
: "cc");
}

static inline int __raw_read_trylock(raw_rwlock_t *rw)
static inline int __raw_read_trylock(arch_rwlock_t *rw)
{
unsigned long tmp, tmp2 = 1;

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/include/asm/spinlock_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ typedef struct {

typedef struct {
volatile unsigned int lock;
} raw_rwlock_t;
} arch_rwlock_t;

#define __RAW_RW_LOCK_UNLOCKED { 0 }
#define __ARCH_RW_LOCK_UNLOCKED { 0 }

#endif
16 changes: 8 additions & 8 deletions arch/blackfin/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,42 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
cpu_relax();
}

static inline int __raw_read_can_lock(raw_rwlock_t *rw)
static inline int __raw_read_can_lock(arch_rwlock_t *rw)
{
return __raw_uncached_fetch_asm(&rw->lock) > 0;
}

static inline int __raw_write_can_lock(raw_rwlock_t *rw)
static inline int __raw_write_can_lock(arch_rwlock_t *rw)
{
return __raw_uncached_fetch_asm(&rw->lock) == RW_LOCK_BIAS;
}

static inline void __raw_read_lock(raw_rwlock_t *rw)
static inline void __raw_read_lock(arch_rwlock_t *rw)
{
__raw_read_lock_asm(&rw->lock);
}

static inline int __raw_read_trylock(raw_rwlock_t *rw)
static inline int __raw_read_trylock(arch_rwlock_t *rw)
{
return __raw_read_trylock_asm(&rw->lock);
}

static inline void __raw_read_unlock(raw_rwlock_t *rw)
static inline void __raw_read_unlock(arch_rwlock_t *rw)
{
__raw_read_unlock_asm(&rw->lock);
}

static inline void __raw_write_lock(raw_rwlock_t *rw)
static inline void __raw_write_lock(arch_rwlock_t *rw)
{
__raw_write_lock_asm(&rw->lock);
}

static inline int __raw_write_trylock(raw_rwlock_t *rw)
static inline int __raw_write_trylock(arch_rwlock_t *rw)
{
return __raw_write_trylock_asm(&rw->lock);
}

static inline void __raw_write_unlock(raw_rwlock_t *rw)
static inline void __raw_write_unlock(arch_rwlock_t *rw)
{
__raw_write_unlock_asm(&rw->lock);
}
Expand Down
4 changes: 2 additions & 2 deletions arch/blackfin/include/asm/spinlock_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ typedef struct {

typedef struct {
volatile unsigned int lock;
} raw_rwlock_t;
} arch_rwlock_t;

#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
#define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }

#endif
16 changes: 8 additions & 8 deletions arch/cris/include/arch-v32/arch/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,48 +56,48 @@ arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)
*
*/

static inline int __raw_read_can_lock(raw_rwlock_t *x)
static inline int __raw_read_can_lock(arch_rwlock_t *x)
{
return (int)(x)->lock > 0;
}

static inline int __raw_write_can_lock(raw_rwlock_t *x)
static inline int __raw_write_can_lock(arch_rwlock_t *x)
{
return (x)->lock == RW_LOCK_BIAS;
}

static inline void __raw_read_lock(raw_rwlock_t *rw)
static inline void __raw_read_lock(arch_rwlock_t *rw)
{
arch_spin_lock(&rw->slock);
while (rw->lock == 0);
rw->lock--;
arch_spin_unlock(&rw->slock);
}

static inline void __raw_write_lock(raw_rwlock_t *rw)
static inline void __raw_write_lock(arch_rwlock_t *rw)
{
arch_spin_lock(&rw->slock);
while (rw->lock != RW_LOCK_BIAS);
rw->lock = 0;
arch_spin_unlock(&rw->slock);
}

static inline void __raw_read_unlock(raw_rwlock_t *rw)
static inline void __raw_read_unlock(arch_rwlock_t *rw)
{
arch_spin_lock(&rw->slock);
rw->lock++;
arch_spin_unlock(&rw->slock);
}

static inline void __raw_write_unlock(raw_rwlock_t *rw)
static inline void __raw_write_unlock(arch_rwlock_t *rw)
{
arch_spin_lock(&rw->slock);
while (rw->lock != RW_LOCK_BIAS);
rw->lock = RW_LOCK_BIAS;
arch_spin_unlock(&rw->slock);
}

static inline int __raw_read_trylock(raw_rwlock_t *rw)
static inline int __raw_read_trylock(arch_rwlock_t *rw)
{
int ret = 0;
arch_spin_lock(&rw->slock);
Expand All @@ -109,7 +109,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
return ret;
}

static inline int __raw_write_trylock(raw_rwlock_t *rw)
static inline int __raw_write_trylock(arch_rwlock_t *rw)
{
int ret = 0;
arch_spin_lock(&rw->slock);
Expand Down
16 changes: 8 additions & 8 deletions arch/ia64/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
#ifdef ASM_SUPPORTED

static __always_inline void
__raw_read_lock_flags(raw_rwlock_t *lock, unsigned long flags)
__raw_read_lock_flags(arch_rwlock_t *lock, unsigned long flags)
{
__asm__ __volatile__ (
"tbit.nz p6, p0 = %1,%2\n"
Expand Down Expand Up @@ -177,7 +177,7 @@ __raw_read_lock_flags(raw_rwlock_t *lock, unsigned long flags)

#define __raw_read_lock(rw) \
do { \
raw_rwlock_t *__read_lock_ptr = (rw); \
arch_rwlock_t *__read_lock_ptr = (rw); \
\
while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \
ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \
Expand All @@ -190,14 +190,14 @@ do { \

#define __raw_read_unlock(rw) \
do { \
raw_rwlock_t *__read_lock_ptr = (rw); \
arch_rwlock_t *__read_lock_ptr = (rw); \
ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \
} while (0)

#ifdef ASM_SUPPORTED

static __always_inline void
__raw_write_lock_flags(raw_rwlock_t *lock, unsigned long flags)
__raw_write_lock_flags(arch_rwlock_t *lock, unsigned long flags)
{
__asm__ __volatile__ (
"tbit.nz p6, p0 = %1, %2\n"
Expand Down Expand Up @@ -235,7 +235,7 @@ __raw_write_lock_flags(raw_rwlock_t *lock, unsigned long flags)
(result == 0); \
})

static inline void __raw_write_unlock(raw_rwlock_t *x)
static inline void __raw_write_unlock(arch_rwlock_t *x)
{
u8 *y = (u8 *)x;
barrier();
Expand Down Expand Up @@ -265,18 +265,18 @@ static inline void __raw_write_unlock(raw_rwlock_t *x)
(ia64_val == 0); \
})

static inline void __raw_write_unlock(raw_rwlock_t *x)
static inline void __raw_write_unlock(arch_rwlock_t *x)
{
barrier();
x->write_lock = 0;
}

#endif /* !ASM_SUPPORTED */

static inline int __raw_read_trylock(raw_rwlock_t *x)
static inline int __raw_read_trylock(arch_rwlock_t *x)
{
union {
raw_rwlock_t lock;
arch_rwlock_t lock;
__u32 word;
} old, new;
old.lock = new.lock = *x;
Expand Down
4 changes: 2 additions & 2 deletions arch/ia64/include/asm/spinlock_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ typedef struct {
typedef struct {
volatile unsigned int read_counter : 31;
volatile unsigned int write_lock : 1;
} raw_rwlock_t;
} arch_rwlock_t;

#define __RAW_RW_LOCK_UNLOCKED { 0, 0 }
#define __ARCH_RW_LOCK_UNLOCKED { 0, 0 }

#endif
12 changes: 6 additions & 6 deletions arch/m32r/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
*/
#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)

static inline void __raw_read_lock(raw_rwlock_t *rw)
static inline void __raw_read_lock(arch_rwlock_t *rw)
{
unsigned long tmp0, tmp1;

Expand Down Expand Up @@ -199,7 +199,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
);
}

static inline void __raw_write_lock(raw_rwlock_t *rw)
static inline void __raw_write_lock(arch_rwlock_t *rw)
{
unsigned long tmp0, tmp1, tmp2;

Expand Down Expand Up @@ -252,7 +252,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
);
}

static inline void __raw_read_unlock(raw_rwlock_t *rw)
static inline void __raw_read_unlock(arch_rwlock_t *rw)
{
unsigned long tmp0, tmp1;

Expand All @@ -274,7 +274,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
);
}

static inline void __raw_write_unlock(raw_rwlock_t *rw)
static inline void __raw_write_unlock(arch_rwlock_t *rw)
{
unsigned long tmp0, tmp1, tmp2;

Expand All @@ -298,7 +298,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
);
}

static inline int __raw_read_trylock(raw_rwlock_t *lock)
static inline int __raw_read_trylock(arch_rwlock_t *lock)
{
atomic_t *count = (atomic_t*)lock;
if (atomic_dec_return(count) >= 0)
Expand All @@ -307,7 +307,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *lock)
return 0;
}

static inline int __raw_write_trylock(raw_rwlock_t *lock)
static inline int __raw_write_trylock(arch_rwlock_t *lock)
{
atomic_t *count = (atomic_t *)lock;
if (atomic_sub_and_test(RW_LOCK_BIAS, count))
Expand Down
Loading

0 comments on commit fb3a6bb

Please sign in to comment.