Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 88288
b: refs/heads/master
c: 14dadf1
h: refs/heads/master
v: v3
  • Loading branch information
Mark Fasheh authored and Jonathan Corbet committed Apr 11, 2008
1 parent 836461a commit 348d467
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d396c5f158547e50c2b78bc984cb4a72d76e969b
refs/heads/master: 14dadf1d5eb5bea2dd115852cfee880505c1c169
22 changes: 22 additions & 0 deletions trunk/Documentation/spinlocks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or
__SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static
initialization.

Most of the time, you can simply turn:

static spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED;

into:

static DEFINE_SPINLOCK(xxx_lock);

Static structure member variables go from:

struct foo bar {
.lock = SPIN_LOCK_UNLOCKED;
};

to:

struct foo bar {
.lock = __SPIN_LOCK_UNLOCKED(bar.lock);
};

Declaration of static rw_locks undergo a similar transformation.

Dynamic initialization, when necessary, may be performed as
demonstrated below.

Expand Down

0 comments on commit 348d467

Please sign in to comment.