Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / arch / alpha / kernel / srmcons.c
index 6312402..3b30d4f 100644 (file)
@@ -22,7 +22,7 @@
 #include <asm/uaccess.h>
 
 
-static spinlock_t srmcons_callback_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(srmcons_callback_lock);
 static int srm_is_registered_console = 0;
 
 /* 
@@ -160,33 +160,26 @@ static int
 srmcons_get_private_struct(struct srmcons_private **ps)
 {
        static struct srmcons_private *srmconsp = NULL;
-       static spinlock_t srmconsp_lock = SPIN_LOCK_UNLOCKED;
+       static DEFINE_SPINLOCK(srmconsp_lock);
        unsigned long flags;
        int retval = 0;
 
-       spin_lock_irqsave(&srmconsp_lock, flags);
-
-       do {
-               if (srmconsp != NULL) {
-                       *ps = srmconsp;
-                       break;
-               }
+       if (srmconsp == NULL) {
+               spin_lock_irqsave(&srmconsp_lock, flags);
 
                srmconsp = kmalloc(sizeof(*srmconsp), GFP_KERNEL);
-               if (srmconsp == NULL) {
+               if (srmconsp == NULL)
                        retval = -ENOMEM;
-                       break;
+               else {
+                       srmconsp->tty = NULL;
+                       spin_lock_init(&srmconsp->lock);
+                       init_timer(&srmconsp->timer);
                }
 
-               srmconsp->tty = NULL;
-               srmconsp->lock = SPIN_LOCK_UNLOCKED;
-               init_timer(&srmconsp->timer);
-
-               *ps = srmconsp;
-       } while(0);
-
-       spin_unlock_irqrestore(&srmconsp_lock, flags);
+               spin_unlock_irqrestore(&srmconsp_lock, flags);
+       }
 
+       *ps = srmconsp;
        return retval;
 }