[PATCH 4/19] MUTEX: FRV arch mutex

[PATCH 4/19] MUTEX: FRV arch mutex

Post by David Howe » Wed, 14 Dec 2005 09:00:20


he attached patch renames the functions of the FRV traditional semaphore
implementation to include "_sem" in their names and to remove the MUTEX macros
that are now provided by the new mutex facility.

Signed-Off-By: David Howells < XXXX@XXXXX.COM >
---
warthog>diffstat -p1 mutex-frv-2615rc5.diff
arch/frv/kernel/frv_ksyms.c | 2 +-
arch/frv/kernel/semaphore.c | 24 ++++++++++++------------
include/asm-frv/semaphore.h | 35 +++++++++++------------------------
3 files changed, 24 insertions(+), 37 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15-rc5/include/asm-frv/semaphore.h linux-2.6.15-rc5-mutex/include/asm-frv/semaphore.h
--- /warthog/kernels/linux-2.6.15-rc5/include/asm-frv/semaphore.h 2005-12-08 16:23:52.000000000 +0000
+++ linux-2.6.15-rc5-mutex/include/asm-frv/semaphore.h 2005-12-12 19:26:43.000000000 +0000
@@ -50,29 +50,16 @@ struct semaphore {
#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)

-#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
-
static inline void sema_init (struct semaphore *sem, int val)
{
*sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val);
}

-static inline void init_MUTEX (struct semaphore *sem)
-{
- sema_init(sem, 1);
-}
-
-static inline void init_MUTEX_LOCKED (struct semaphore *sem)
-{
- sema_init(sem, 0);
-}
-
-extern void __down(struct semaphore *sem, unsigned long flags);
-extern int __down_interruptible(struct semaphore *sem, unsigned long flags);
-extern void __up(struct semaphore *sem);
+extern void __down_sem(struct semaphore *sem, unsigned long flags);
+extern int __down_sem_interruptible(struct semaphore *sem, unsigned long flags);
+extern void __up_sem(struct semaphore *sem);

-static inline void down(struct semaphore *sem)
+static inline void down_sem(struct semaphore *sem)
{
unsigned long flags;

@@ -86,11 +73,11 @@ static inline void down(struct semaphore
spin_unlock_irqrestore(&sem->wait_lock, flags);
}
else {
- __down(sem, flags);
+ __down_sem(sem, flags);
}
}

-static inline int down_interruptible(struct semaphore *sem)
+static inline int down_sem_interruptible(struct semaphore *sem)
{
unsigned long flags;
int ret = 0;
@@ -105,16 +92,16 @@ static inline int down_interruptible(str
spin_unlock_irqrestore(&sem->wait_lock, flags);
}
else {
- ret = __down_interruptible(sem, flags);
+ ret = __down_sem_interruptible(sem, flags);
}
return ret;
}

/*
- * non-blockingly attempt to down() a semaphore.
+ * non-blockingly attempt to down_sem() a semaphore.
* - returns zero if we acquired it
*/
-static inline int down_trylock(struct semaphore *sem)
+static inline int down_sem_trylock(struct semaphore *sem)
{
unsigned long flags;
int success = 0;
@@ -132,7 +119,7 @@ static inline int down_trylock(struct se
return !success;
}

-static inline void up(struct semaphore *sem)
+static inline void up_sem(struct semaphore *sem)
{
unsigned long flags;

@@ -142,7 +129,7 @@ static inline void up(struct semaphore *

spin_lock_irqsave(&sem->wait_lock, flags);
if (!list_empty(&sem->wait_list))
- __up(sem);
+ __up_sem(sem);
else
sem->counter++;
spin_unlock_irqrestore(&sem->wait_lock, flags);
diff -uNrp /warthog/kernels/linux-2.6.15-rc5/arch/frv/k