Commit 6b7e73bb authored by David S. Miller's avatar David S. Miller

[SPARC64]: Add rwlock_is_locked and in_atomic.

parent a0ca06e9
...@@ -85,8 +85,10 @@ typedef struct { ...@@ -85,8 +85,10 @@ typedef struct {
#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
#if CONFIG_PREEMPT #if CONFIG_PREEMPT
# define in_atomic() (preempt_count() != kernel_locked())
# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
#else #else
# define in_atomic() (preempt_count() != 0)
# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
#endif #endif
#define irq_exit() \ #define irq_exit() \
......
...@@ -112,6 +112,7 @@ extern int _spin_trylock (spinlock_t *lock); ...@@ -112,6 +112,7 @@ extern int _spin_trylock (spinlock_t *lock);
typedef unsigned int rwlock_t; typedef unsigned int rwlock_t;
#define RW_LOCK_UNLOCKED 0 #define RW_LOCK_UNLOCKED 0
#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
#define rwlock_is_locked(x) (*(x) != RW_LOCK_UNLOCKED)
extern void __read_lock(rwlock_t *); extern void __read_lock(rwlock_t *);
extern void __read_unlock(rwlock_t *); extern void __read_unlock(rwlock_t *);
...@@ -132,6 +133,7 @@ typedef struct { ...@@ -132,6 +133,7 @@ typedef struct {
} rwlock_t; } rwlock_t;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { 0, 0, 0, 0 } } #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { 0, 0, 0, 0 } }
#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
#define rwlock_is_locked(x) ((x)->lock != 0)
extern void _do_read_lock(rwlock_t *rw, char *str); extern void _do_read_lock(rwlock_t *rw, char *str);
extern void _do_read_unlock(rwlock_t *rw, char *str); extern void _do_read_unlock(rwlock_t *rw, char *str);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment