Do a better job of matching some linux APIs. Still not quite working.

This commit is contained in:
skrll 2013-09-05 13:56:12 +00:00
parent 5d36abf618
commit 618a9dc6b5
1 changed files with 10 additions and 28 deletions

View File

@ -96,7 +96,7 @@ test_and_clear_bit(int nr, volatile void *addr)
typedef volatile unsigned int atomic_t;
#define atomic_set(p, v) (*(p) = (v))
#define atomic_read(p) (*(p))
#define atomic_read(p) (*(volatile int *)(p))
#define atomic_inc(p) atomic_inc_uint(p)
#define atomic_dec(p) atomic_dec_uint(p)
#define atomic_dec_and_test(p) (atomic_dec_uint_nv(p) == 0)
@ -125,15 +125,6 @@ typedef kmutex_t spinlock_t;
#define spin_lock_destroy(lock) mutex_destroy(lock)
#define spin_lock(lock) mutex_spin_enter(lock)
#define spin_unlock(lock) mutex_spin_exit(lock)
#define spin_lock_bh(lock) spin_lock(lock)
#define spin_unlock_bh(lock) spin_unlock(lock)
#define spin_lock_irqsave(lock, flags) \
do { \
spin_lock(lock); \
(void) &(flags); \
} while (0)
#define spin_unlock_irqrestore(lock, flags) \
spin_unlock(lock)
/*
* Mutex API
@ -151,25 +142,16 @@ struct mutex {
/*
* Rwlock API
*/
typedef krwlock_t rwlock_t;
typedef kmutex_t rwlock_t;
/*
* NB: Need to initialize these at attach time!
*/
#define DEFINE_RWLOCK(name) rwlock_t name
#define rwlock_init(rwlock) rw_init(rwlock)
#define read_lock(rwlock) rw_enter(rwlock, RW_READER)
#define read_unlock(rwlock) rw_exit(rwlock)
#define DEFINE_RWLOCK(name) kmutex_t name
#define write_lock(rwlock) rw_enter(rwlock, RW_WRITER)
#define write_unlock(rwlock) rw_exit(rwlock)
#define write_lock_irqsave(rwlock, flags) \
do { \
write_lock(rwlock); \
(void) &(flags); \
} while (0)
#define write_unlock_irqrestore(rwlock, flags) \
write_unlock(rwlock)
#define rwlock_init(rwlock) mutex_init(rwlock, MUTEX_DEFAULT, IPL_VM)
#define read_lock(rwlock) mutex_spin_enter(rwlock)
#define read_unlock(rwlock) mutex_spin_exit(rwlock)
#define write_lock(rwlock) mutex_spin_enter(rwlock)
#define write_unlock(rwlock) mutex_spin_exit(rwlock)
#define read_lock_bh(rwlock) read_lock(rwlock)
#define read_unlock_bh(rwlock) read_unlock(rwlock)
@ -371,7 +353,7 @@ static inline unsigned long msecs_to_jiffies(unsigned long msecs)
#define time_before(a, b) time_after((b), (a))
/*
* kthread API (we use proc)
* kthread API (we use lwp)
*/
typedef lwp_t * VCHIQ_THREAD_T;