Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6d9c5d94
Commit
6d9c5d94
authored
Apr 21, 2005
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
rsync://rsync.kernel.org/pub/linux/kernel/people/davem/sparc-2.6.git
parents
858eaca1
489ec5f5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
17 deletions
+31
-17
include/asm-sparc64/spinlock.h
include/asm-sparc64/spinlock.h
+31
-17
No files found.
include/asm-sparc64/spinlock.h
View file @
6d9c5d94
...
@@ -31,15 +31,20 @@
...
@@ -31,15 +31,20 @@
#ifndef CONFIG_DEBUG_SPINLOCK
#ifndef CONFIG_DEBUG_SPINLOCK
typedef
unsigned
char
spinlock_t
;
typedef
struct
{
#define SPIN_LOCK_UNLOCKED 0
volatile
unsigned
char
lock
;
#ifdef CONFIG_PREEMPT
unsigned
int
break_lock
;
#endif
}
spinlock_t
;
#define SPIN_LOCK_UNLOCKED (spinlock_t) {0,}
#define spin_lock_init(l
ock) (*((unsigned char *)(lock)) =
0)
#define spin_lock_init(l
p) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(
0)
#define spin_is_locked(l
ock) (*((volatile unsigned char *)(lock))
!= 0)
#define spin_is_locked(l
p) ((lp)->lock
!= 0)
#define spin_unlock_wait(l
ock
) \
#define spin_unlock_wait(l
p
) \
do { membar("#LoadLoad"); \
do { membar("#LoadLoad"); \
} while(
*((volatile unsigned char *)lock)
)
} while(
lp->lock
)
static
inline
void
_raw_spin_lock
(
spinlock_t
*
lock
)
static
inline
void
_raw_spin_lock
(
spinlock_t
*
lock
)
{
{
...
@@ -109,20 +114,19 @@ static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags)
...
@@ -109,20 +114,19 @@ static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags)
#else
/* !(CONFIG_DEBUG_SPINLOCK) */
#else
/* !(CONFIG_DEBUG_SPINLOCK) */
typedef
struct
{
typedef
struct
{
unsigned
char
lock
;
volatile
unsigned
char
lock
;
unsigned
int
owner_pc
,
owner_cpu
;
unsigned
int
owner_pc
,
owner_cpu
;
#ifdef CONFIG_PREEMPT
unsigned
int
break_lock
;
#endif
}
spinlock_t
;
}
spinlock_t
;
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0, 0xff }
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0, 0xff }
#define spin_lock_init(__lock) \
#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0)
do { (__lock)->lock = 0; \
#define spin_is_locked(__lock) ((__lock)->lock != 0)
(__lock)->owner_pc = 0; \
(__lock)->owner_cpu = 0xff; \
} while(0)
#define spin_is_locked(__lock) (*((volatile unsigned char *)(&((__lock)->lock))) != 0)
#define spin_unlock_wait(__lock) \
#define spin_unlock_wait(__lock) \
do { \
do { \
membar("#LoadLoad"); \
membar("#LoadLoad"); \
} while(
*((volatile unsigned char *)(&((__lock)->lock)))
)
} while(
(__lock)->lock
)
extern
void
_do_spin_lock
(
spinlock_t
*
lock
,
char
*
str
);
extern
void
_do_spin_lock
(
spinlock_t
*
lock
,
char
*
str
);
extern
void
_do_spin_unlock
(
spinlock_t
*
lock
);
extern
void
_do_spin_unlock
(
spinlock_t
*
lock
);
...
@@ -139,8 +143,13 @@ extern int _do_spin_trylock (spinlock_t *lock);
...
@@ -139,8 +143,13 @@ extern int _do_spin_trylock (spinlock_t *lock);
#ifndef CONFIG_DEBUG_SPINLOCK
#ifndef CONFIG_DEBUG_SPINLOCK
typedef
unsigned
int
rwlock_t
;
typedef
struct
{
#define RW_LOCK_UNLOCKED 0
volatile
unsigned
int
lock
;
#ifdef CONFIG_PREEMPT
unsigned
int
break_lock
;
#endif
}
rwlock_t
;
#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)
static
void
inline
__read_lock
(
rwlock_t
*
lock
)
static
void
inline
__read_lock
(
rwlock_t
*
lock
)
...
@@ -251,9 +260,12 @@ static int inline __write_trylock(rwlock_t *lock)
...
@@ -251,9 +260,12 @@ static int inline __write_trylock(rwlock_t *lock)
#else
/* !(CONFIG_DEBUG_SPINLOCK) */
#else
/* !(CONFIG_DEBUG_SPINLOCK) */
typedef
struct
{
typedef
struct
{
unsigned
long
lock
;
volatile
unsigned
long
lock
;
unsigned
int
writer_pc
,
writer_cpu
;
unsigned
int
writer_pc
,
writer_cpu
;
unsigned
int
reader_pc
[
NR_CPUS
];
unsigned
int
reader_pc
[
NR_CPUS
];
#ifdef CONFIG_PREEMPT
unsigned
int
break_lock
;
#endif
}
rwlock_t
;
}
rwlock_t
;
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } }
#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } }
#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)
...
@@ -304,6 +316,8 @@ do { unsigned long flags; \
...
@@ -304,6 +316,8 @@ do { unsigned long flags; \
#endif
/* CONFIG_DEBUG_SPINLOCK */
#endif
/* CONFIG_DEBUG_SPINLOCK */
#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
#define read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
#define write_can_lock(rw) (!(rw)->lock)
#endif
/* !(__ASSEMBLY__) */
#endif
/* !(__ASSEMBLY__) */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment