Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14458
b: refs/heads/master
c: 08dc2ca
h: refs/heads/master
v: v3
  • Loading branch information
James Bottomley authored and Kyle McMartin committed Nov 17, 2005
1 parent 45d91db commit 1344834
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4269b0d371c43bc8f3c9e183847a08258587cf06
refs/heads/master: 08dc2ca61e683e9119ff534dfcd0fd555401fcf7
19 changes: 10 additions & 9 deletions trunk/include/asm-parisc/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,25 @@ static inline int __raw_spin_is_locked(raw_spinlock_t *x)
return *a == 0;
}

#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
#define __raw_spin_lock(lock) __raw_spin_lock_flags(lock, 0)
#define __raw_spin_unlock_wait(x) \
do { cpu_relax(); } while (__raw_spin_is_locked(x))

static inline void __raw_spin_lock(raw_spinlock_t *x)
static inline void __raw_spin_lock_flags(raw_spinlock_t *x,
unsigned long flags)
{
volatile unsigned int *a;

mb();
a = __ldcw_align(x);
while (__ldcw(a) == 0)
while (*a == 0);
while (*a == 0)
if (flags & PSW_SM_I) {
local_irq_enable();
cpu_relax();
local_irq_disable();
} else
cpu_relax();
mb();
}

Expand Down Expand Up @@ -60,26 +67,20 @@ static inline int __raw_spin_trylock(raw_spinlock_t *x)

static __inline__ void __raw_read_lock(raw_rwlock_t *rw)
{
unsigned long flags;
local_irq_save(flags);
__raw_spin_lock(&rw->lock);

rw->counter++;

__raw_spin_unlock(&rw->lock);
local_irq_restore(flags);
}

static __inline__ void __raw_read_unlock(raw_rwlock_t *rw)
{
unsigned long flags;
local_irq_save(flags);
__raw_spin_lock(&rw->lock);

rw->counter--;

__raw_spin_unlock(&rw->lock);
local_irq_restore(flags);
}

/* write_lock is less trivial. We optimistically grab the lock and check
Expand Down

0 comments on commit 1344834

Please sign in to comment.