Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268921
b: refs/heads/master
c: 8292c9e
h: refs/heads/master
i:
  268919: 39c4d41
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Sep 13, 2011
1 parent e8f5f07 commit 4eb509a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 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: ee30a7b2fc072f139dac44826860d2c1f422137c
refs/heads/master: 8292c9e15c3b069459794a04f5e2cf0d5665ddc4
4 changes: 2 additions & 2 deletions trunk/include/linux/semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

/* Please don't access any members of this structure directly */
struct semaphore {
spinlock_t lock;
raw_spinlock_t lock;
unsigned int count;
struct list_head wait_list;
};

#define __SEMAPHORE_INITIALIZER(name, n) \
{ \
.lock = __SPIN_LOCK_UNLOCKED((name).lock), \
.lock = __RAW_SPIN_LOCK_UNLOCKED((name).lock), \
.count = n, \
.wait_list = LIST_HEAD_INIT((name).wait_list), \
}
Expand Down
28 changes: 14 additions & 14 deletions trunk/kernel/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ void down(struct semaphore *sem)
{
unsigned long flags;

spin_lock_irqsave(&sem->lock, flags);
raw_spin_lock_irqsave(&sem->lock, flags);
if (likely(sem->count > 0))
sem->count--;
else
__down(sem);
spin_unlock_irqrestore(&sem->lock, flags);
raw_spin_unlock_irqrestore(&sem->lock, flags);
}
EXPORT_SYMBOL(down);

Expand All @@ -77,12 +77,12 @@ int down_interruptible(struct semaphore *sem)
unsigned long flags;
int result = 0;

spin_lock_irqsave(&sem->lock, flags);
raw_spin_lock_irqsave(&sem->lock, flags);
if (likely(sem->count > 0))
sem->count--;
else
result = __down_interruptible(sem);
spin_unlock_irqrestore(&sem->lock, flags);
raw_spin_unlock_irqrestore(&sem->lock, flags);

return result;
}
Expand All @@ -103,12 +103,12 @@ int down_killable(struct semaphore *sem)
unsigned long flags;
int result = 0;

spin_lock_irqsave(&sem->lock, flags);
raw_spin_lock_irqsave(&sem->lock, flags);
if (likely(sem->count > 0))
sem->count--;
else
result = __down_killable(sem);
spin_unlock_irqrestore(&sem->lock, flags);
raw_spin_unlock_irqrestore(&sem->lock, flags);

return result;
}
Expand All @@ -132,11 +132,11 @@ int down_trylock(struct semaphore *sem)
unsigned long flags;
int count;

spin_lock_irqsave(&sem->lock, flags);
raw_spin_lock_irqsave(&sem->lock, flags);
count = sem->count - 1;
if (likely(count >= 0))
sem->count = count;
spin_unlock_irqrestore(&sem->lock, flags);
raw_spin_unlock_irqrestore(&sem->lock, flags);

return (count < 0);
}
Expand All @@ -157,12 +157,12 @@ int down_timeout(struct semaphore *sem, long jiffies)
unsigned long flags;
int result = 0;

spin_lock_irqsave(&sem->lock, flags);
raw_spin_lock_irqsave(&sem->lock, flags);
if (likely(sem->count > 0))
sem->count--;
else
result = __down_timeout(sem, jiffies);
spin_unlock_irqrestore(&sem->lock, flags);
raw_spin_unlock_irqrestore(&sem->lock, flags);

return result;
}
Expand All @@ -179,12 +179,12 @@ void up(struct semaphore *sem)
{
unsigned long flags;

spin_lock_irqsave(&sem->lock, flags);
raw_spin_lock_irqsave(&sem->lock, flags);
if (likely(list_empty(&sem->wait_list)))
sem->count++;
else
__up(sem);
spin_unlock_irqrestore(&sem->lock, flags);
raw_spin_unlock_irqrestore(&sem->lock, flags);
}
EXPORT_SYMBOL(up);

Expand Down Expand Up @@ -217,9 +217,9 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
if (timeout <= 0)
goto timed_out;
__set_task_state(task, state);
spin_unlock_irq(&sem->lock);
raw_spin_unlock_irq(&sem->lock);
timeout = schedule_timeout(timeout);
spin_lock_irq(&sem->lock);
raw_spin_lock_irq(&sem->lock);
if (waiter.up)
return 0;
}
Expand Down

0 comments on commit 4eb509a

Please sign in to comment.