Rev 622 | Rev 1100 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 622 | Rev 625 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | * |
43 | * |
44 | * @param sl Pointer to spinlock_t structure. |
44 | * @param sl Pointer to spinlock_t structure. |
45 | */ |
45 | */ |
46 | void spinlock_initialize(spinlock_t *sl, char *name) |
46 | void spinlock_initialize(spinlock_t *sl, char *name) |
47 | { |
47 | { |
48 | sl->val = 0; |
48 | atomic_set(&sl->val, 0); |
49 | #ifdef CONFIG_DEBUG_SPINLOCK |
49 | #ifdef CONFIG_DEBUG_SPINLOCK |
50 | sl->name = name; |
50 | sl->name = name; |
51 | #endif |
51 | #endif |
52 | } |
52 | } |
53 | 53 | ||
Line 149... | Line 149... | ||
149 | * |
149 | * |
150 | * @param sl Pointer to spinlock_t structure. |
150 | * @param sl Pointer to spinlock_t structure. |
151 | */ |
151 | */ |
152 | void spinlock_unlock(spinlock_t *sl) |
152 | void spinlock_unlock(spinlock_t *sl) |
153 | { |
153 | { |
154 | ASSERT(sl->val != 0); |
154 | ASSERT(atomic_get(&sl->val) != 0); |
155 | 155 | ||
156 | /* |
156 | /* |
157 | * Prevent critical section code from bleeding out this way down. |
157 | * Prevent critical section code from bleeding out this way down. |
158 | */ |
158 | */ |
159 | CS_LEAVE_BARRIER(); |
159 | CS_LEAVE_BARRIER(); |
160 | 160 | ||
161 | sl->val = 0; |
161 | atomic_set(&sl->val,0); |
162 | preemption_enable(); |
162 | preemption_enable(); |
163 | } |
163 | } |
164 | 164 | ||
165 | #endif |
165 | #endif |