SPIN_LOCK_UNLOCKED cleanup done!

Submitted by milindchoudhary
on April 19, 2007 - 7:33am

wan working on SPIN_LOCK_UNLOCKED clean
for last few days..

different places where SPIN_LOCK_UNLOCKED currently appears are

1. static spinlock_t foobar = SPIN_LOCK_UNLOCKED; needs to be replaced bye DEFINE_SPINLOCK

e.g linux-core/drm_memory_debug.h -static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(drm_mem_lock);

there are very few occurrences left in the tree i see

2. allocating a data structure dynamically & initializing the spinlock embedded within

use spin_lock_init() e.g linux-core/via_dmablit.c

- blitq->blit_lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&blitq->blit_lock);

3. static initialization of structure members struct foo bar ={ . . . .lock = SPIN_LOCK_UNLOCKED, . } use struct foo bar ={ . . . .lock = __SPIN_LOCK_UNLOCKED(bar.lock), . }

e.g arch/i386/kernel/traps.c - .lock = SPIN_LOCK_UNLOCKED, + .lock = __SPIN_LOCK_UNLOCKED(die.lock),

plenty of these are still there may be some patches queued

4. arrays of spinlocks e.g arch/cris/arch-v32/kernel/smp.c

-spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED}; +raw_spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = __RAW_SPIN_LOCK_UNLOCKED};

majority of the first three cases are fixed.
for arrays i saw a patch floating on lkml no responses..
i guess :(