[PATCH 2/19] MUTEX: i386 arch mutex

[PATCH 2/19] MUTEX: i386 arch mutex

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


he attached patch renames the functions of the i386 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-i386-2615rc5.diff
arch/i386/kernel/cpu/proc.c | 2 -
arch/i386/kernel/i386_ksyms.c | 12 ++++++---
arch/i386/kernel/semaphore.c | 24 +++++++++---------
include/asm-i386/mmu.h | 4 +--
include/asm-i386/semaphore.h | 55 ++++++++++++++++--------------------------
include/asm-i386/voyager.h | 2 -
6 files changed, 45 insertions(+), 54 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15-rc5/include/asm-i386/mmu.h linux-2.6.15-rc5-mutex/include/asm-i386/mmu.h
--- /warthog/kernels/linux-2.6.15-rc5/include/asm-i386/mmu.h 2004-06-18 13:42:21.000000000 +0100
+++ linux-2.6.15-rc5-mutex/include/asm-i386/mmu.h 2005-12-12 18:49:34.000000000 +0000
@@ -1,7 +1,7 @@
#ifndef __i386_MMU_H
#define __i386_MMU_H

-#include <asm/semaphore.h>
+#include <linux/mutex.h>
/*
* The i386 doesn't have a mmu context, but
* we put the segment information here.
@@ -10,7 +10,7 @@
*/
typedef struct {
int size;
- struct semaphore sem;
+ struct mutex sem;
void *ldt;
} mm_context_t;

diff -uNrp /warthog/kernels/linux-2.6.15-rc5/include/asm-i386/semaphore.h linux-2.6.15-rc5-mutex/include/asm-i386/semaphore.h
--- /warthog/kernels/linux-2.6.15-rc5/include/asm-i386/semaphore.h 2005-12-08 16:23:52.000000000 +0000
+++ linux-2.6.15-rc5-mutex/include/asm-i386/semaphore.h 2005-12-12 17:02:03.000000000 +0000
@@ -58,9 +58,6 @@ 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)
{
/*
@@ -74,37 +71,27 @@ static inline void sema_init (struct sem
init_waitqueue_head(&sem->wait);
}

-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);
-}
-
-fastcall void __down_failed(void /* special register calling convention */);
-fastcall int __down_failed_interruptible(void /* params in registers */);
-fastcall int __down_failed_trylock(void /* params in registers */);
-fastcall void __up_wakeup(void /* special register calling convention */);
+fastcall void __down_sem_failed(void /* special register calling convention */);
+fastcall int __down_sem_failed_interruptible(void /* params in registers */);
+fastcall int __down_sem_failed_trylock(void /* params in registers */);
+fastcall void __up_sem_wakeup(void /* special register calling convention */);

/*
* This is ugly, but we want the default case to fall through.
* "__down_failed" is a special asm handler that calls the C
* routine that actually waits. See arch/i386/kernel/semaphore.c
*/
-static inline void down(struct semaphore * sem)
+static inline void down_sem(struct semaphore * sem)
{
might_sleep();
__asm__ __volatile__(
- "# atomic down operation\n\t"
+ "# atomic down_sem operation\n\t"
LOCK "decl %0\n\t" /* --sem->count */
"js 2f\n"
"1:\n"
LOCK_SECTION_START("")