From: SUGIOKA T. <su...@it...> - 2001-04-19 16:14:23
|
Hi all. current cvs source tree seems broken around rw_semaphore since few days ago. I just fixed so that it could be build. I will commit this soon. 2001-04-20 SUGIOKA Toshinobu <su...@it...> * arch/sh/config.in: define CONFIG_RWSEM_GENERIC. * include/asm-sh/bitops.h (__set_bit, __clear_bit): defined. * include/asm-sh/semaphore.h: Follow i386 implementation. * include/linux/rwsem.h: small fix. * lib/rwsem.c: Added include linux/bitops.h. Index: arch/sh/config.in =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/config.in,v retrieving revision 1.34 diff -u -r1.34 config.in --- arch/sh/config.in 2001/04/18 04:25:15 1.34 +++ arch/sh/config.in 2001/04/19 15:50:20 @@ -7,6 +7,7 @@ define_bool CONFIG_SUPERH y define_bool CONFIG_UID16 y +define_bool CONFIG_RWSEM_GENERIC y define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n Index: include/asm-sh/bitops.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/bitops.h,v retrieving revision 1.6 diff -u -r1.6 bitops.h --- include/asm-sh/bitops.h 2000/09/30 03:43:32 1.6 +++ include/asm-sh/bitops.h 2001/04/19 15:50:39 @@ -19,6 +19,16 @@ restore_flags(flags); } +static __inline__ void __set_bit(int nr, volatile void * addr) +{ + int mask; + volatile unsigned int *a = addr; + + a += nr >> 5; + mask = 1 << (nr & 0x1f); + *a |= mask; +} + /* * clear_bit() doesn't provide any barrier for the compiler. */ @@ -35,6 +45,16 @@ save_and_cli(flags); *a &= ~mask; restore_flags(flags); +} + +static __inline__ void __clear_bit(int nr, volatile void * addr) +{ + int mask; + volatile unsigned int *a = addr; + + a += nr >> 5; + mask = 1 << (nr & 0x1f); + *a &= ~mask; } static __inline__ void change_bit(int nr, volatile void * addr) Index: include/asm-sh/semaphore.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/semaphore.h,v retrieving revision 1.2 diff -u -r1.2 semaphore.h --- include/asm-sh/semaphore.h 2001/04/18 04:25:17 1.2 +++ include/asm-sh/semaphore.h 2001/04/19 15:50:45 @@ -84,13 +84,10 @@ asmlinkage int __down_interruptible(struct semaphore * sem); asmlinkage int __down_trylock(struct semaphore * sem); asmlinkage void __up(struct semaphore * sem); -extern struct rw_semaphore *__down_read(struct rw_semaphore *sem, int carry); -extern struct rw_semaphore *__down_write(struct rw_semaphore *sem, int carry); -asmlinkage struct rw_semaphore *__rwsem_wake(struct rw_semaphore *sem); extern spinlock_t semaphore_wake_lock; -extern __inline__ void down(struct semaphore * sem) +static inline void down(struct semaphore * sem) { #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); @@ -100,7 +97,7 @@ __down(sem); } -extern __inline__ int down_interruptible(struct semaphore * sem) +static inline int down_interruptible(struct semaphore * sem) { int ret = 0; #if WAITQUEUE_DEBUG @@ -112,7 +109,7 @@ return ret; } -extern __inline__ int down_trylock(struct semaphore * sem) +static inline int down_trylock(struct semaphore * sem) { int ret = 0; #if WAITQUEUE_DEBUG @@ -128,7 +125,7 @@ * Note! This is subtle. We jump to wake people up only if * the semaphore was negative (== somebody was waiting on it). */ -extern __inline__ void up(struct semaphore * sem) +static inline void up(struct semaphore * sem) { #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); Index: include/linux/rwsem.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/include/linux/rwsem.h,v retrieving revision 1.2 diff -u -r1.2 rwsem.h --- include/linux/rwsem.h 2001/04/18 04:25:17 1.2 +++ include/linux/rwsem.h 2001/04/19 15:51:30 @@ -42,12 +42,6 @@ #include <asm/atomic.h> #include <linux/wait.h> -#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK -#include <linux/rwsem-spinlock.h> /* use a generic implementation */ -#else -#include <asm/rwsem.h> /* use an arch-specific implementation */ -#endif - /* defined contention handler functions for the generic case * - these are also used for the exchange-and-add based algorithm */ @@ -56,6 +50,12 @@ extern struct rw_semaphore *FASTCALL(rwsem_down_read_failed(struct rw_semaphore *sem)); extern struct rw_semaphore *FASTCALL(rwsem_down_write_failed(struct rw_semaphore *sem)); extern struct rw_semaphore *FASTCALL(rwsem_wake(struct rw_semaphore *sem)); +#endif + +#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK +#include <linux/rwsem-spinlock.h> /* use a generic implementation */ +#else +#include <asm/rwsem.h> /* use an arch-specific implementation */ #endif #ifndef rwsemtrace Index: lib/rwsem.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/lib/rwsem.c,v retrieving revision 1.2 diff -u -r1.2 rwsem.c --- lib/rwsem.c 2001/04/18 04:25:18 1.2 +++ lib/rwsem.c 2001/04/19 15:52:12 @@ -6,6 +6,7 @@ #include <linux/rwsem.h> #include <linux/sched.h> #include <linux/module.h> +#include <linux/bitops.h> /* * wait for the read lock to be granted ----- SUGIOKA Toshinobu |