To make spinlock/rwlock initialization consistent all over the kernel,
this patch converts explicit lock-initializers into spin_lock_init() and
rwlock_init() calls.

Currently, spinlocks and rwlocks are initialized in two different ways:

  lock = SPIN_LOCK_UNLOCKED
  spin_lock_init(&lock)
  
  rwlock = RW_LOCK_UNLOCKED
  rwlock_init(&rwlock)

this patch converts all explicit lock initializations to
spin_lock_init() or rwlock_init(). (Besides consistency this also helps
automatic lock validators and debugging code.)

The conversion was done with a script, it was verified manually and it
was reviewed, compiled and tested as far as possible on x86, ARM, PPC.

There is no runtime overhead or actual code change resulting out of this
patch, because spin_lock_init() and rwlock_init() are macros and are
thus equivalent to the explicit initialization method.

That's the second batch of the unifying patches.

Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
Acked-by: Ingo Molnar <[EMAIL PROTECTED]>

---
 drm_drv.h     |    2 +-
 gamma_lists.h |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff -urN 2.6.10-rc1/drivers/char/drm/drm_drv.h 2.6.10-new/drivers/char/drm/drm_drv.h
--- 2.6.10-rc1/drivers/char/drm/drm_drv.h       2004-10-18 23:54:55.000000000 +0200
+++ 2.6.10-new/drivers/char/drm/drm_drv.h       2004-10-25 16:17:49.000000000 +0200
@@ -447,7 +447,7 @@
        dev = &(DRM(device)[DRM(numdevs)]);
 
        memset( (void *)dev, 0, sizeof(*dev) );
-       dev->count_lock = SPIN_LOCK_UNLOCKED;
+       spin_lock_init(&dev->count_lock);
        init_timer( &dev->timer );
        sema_init( &dev->struct_sem, 1 );
        sema_init( &dev->ctxlist_sem, 1 );
diff -urN 2.6.10-rc1/drivers/char/drm/gamma_lists.h 
2.6.10-new/drivers/char/drm/gamma_lists.h
--- 2.6.10-rc1/drivers/char/drm/gamma_lists.h   2004-10-18 23:53:44.000000000 +0200
+++ 2.6.10-new/drivers/char/drm/gamma_lists.h   2004-10-25 16:17:47.000000000 +0200
@@ -45,8 +45,8 @@
        bl->rp         = bl->bufs;
        bl->wp         = bl->bufs;
        bl->end        = &bl->bufs[bl->count+1];
-       bl->write_lock = SPIN_LOCK_UNLOCKED;
-       bl->read_lock  = SPIN_LOCK_UNLOCKED;
+       spin_lock_init(&bl->write_lock);
+       spin_lock_init(&bl->read_lock);
        return 0;
 }
 
@@ -110,7 +110,7 @@
        bl->low_mark  = 0;
        bl->high_mark = 0;
        atomic_set(&bl->wfh,   0);
-       bl->lock      = SPIN_LOCK_UNLOCKED;
+       spin_lock_init(&bl->lock);
        ++bl->initialized;
        return 0;
 }


-------------------------------------------------------
This Newsletter Sponsored by: Macrovision
For reliable Linux application installations, use the industry's leading
setup authoring tool, InstallShield X. Learn more and evaluate
today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/
--
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to