Index: trunk/kernel/libk/spinlock.c
===================================================================
--- trunk/kernel/libk/spinlock.c	(revision 296)
+++ trunk/kernel/libk/spinlock.c	(revision 331)
@@ -1,5 +1,5 @@
 /*
  * spinlock.c - kernel spinlock synchronization
- * 
+ *
  * Authors   Ghassan Almaless  (2008,2009,2010,2011,2012)
  *           Alain Greiner     (2016}
@@ -35,39 +35,39 @@
 //////////////////////////////////////////////
 inline void spinlock_init( spinlock_t * lock )
-{  
-	lock->taken = 0;
-	lock->owner = NULL;
+{
+    lock->taken = 0;
+    lock->owner = NULL;
     list_entry_init( &lock->list );
 }
 
 ///////////////////////////////////////////
-void spinlock_lock_busy( spinlock_t * lock, 
+void spinlock_lock_busy( spinlock_t * lock,
                          uint32_t   * irq_state )
 {
-	reg_t               mode;
-	volatile uint32_t   taken;
-	thread_t          * this     = CURRENT_THREAD;
-	bool_t              isAtomic = false;
+    reg_t               mode;
+    volatile uint32_t   taken;
+    thread_t          * this     = CURRENT_THREAD;
+    bool_t              isAtomic = false;
 
     // disable interrupts
-	hal_disable_irq( &mode );
-  
+    hal_disable_irq( &mode );
+
     // loop until success
-	while( isAtomic == false )
-	{
-		taken = lock->taken;
+    while( isAtomic == false )
+    {
+        taken = lock->taken;
 
         // try to take the lock if not already taken
-		if( taken == 0 )
+        if( taken == 0 )
         {
-		    isAtomic = hal_atomic_cas( &lock->taken , 0 , 1 );
+            isAtomic = hal_atomic_cas( &lock->taken , 0 , 1 );
         }
-	}
+    }
 
-	this->local_locks++;
+    this->local_locks++;
     lock->owner = this;
     list_add_first( &this->locks_root , &lock->list );
 
-    // irq_state must be restored when lock is released 
+    // irq_state must be restored when lock is released
     *irq_state = mode;
 }
@@ -77,32 +77,32 @@
                            uint32_t     irq_state )
 {
-	thread_t * this = CURRENT_THREAD;;
-  
+    thread_t * this = CURRENT_THREAD;;
+
     lock->owner = NULL;
     lock->taken = 0;
     this->local_locks--;
     list_unlink( &lock->list );
- 
-	hal_restore_irq( irq_state );
+
+    hal_restore_irq( irq_state );
 }
-   
+
 ///////////////////////////////////////
 void spinlock_lock( spinlock_t * lock )
 {
-	reg_t             mode;
-	thread_t        * this     = CURRENT_THREAD;
-	bool_t            isAtomic = false;
-	volatile uint32_t taken;
-    
+    reg_t             mode;
+    thread_t        * this     = CURRENT_THREAD;
+    bool_t            isAtomic = false;
+    volatile uint32_t taken;
+
     // disable interrupts
-	hal_disable_irq( &mode );
-  
+    hal_disable_irq( &mode );
+
     // loop until success
-	while( isAtomic == false )
-	{
+    while( isAtomic == false )
+    {
         taken = lock->taken;
 
         // deschedule without blocking when lock already taken
-		if( taken != 0 )
+        if( taken != 0 )
         {
             hal_restore_irq( mode );
@@ -113,8 +113,8 @@
 
         // try to atomically take the lock if not already taken
-	    isAtomic = hal_atomic_cas( &lock->taken , 0 , 1 );
+        isAtomic = hal_atomic_cas( &lock->taken , 0 , 1 );
     }
 
-	this->local_locks++;
+    this->local_locks++;
     lock->owner = this;
     list_add_first( &this->locks_root , &lock->list );
@@ -126,26 +126,26 @@
 /////////////////////////////////////////////
 error_t spinlock_trylock( spinlock_t * lock )
-{ 
-	reg_t      mode;
-	bool_t     isAtomic = false;
-	thread_t * this     = CURRENT_THREAD;
+{
+    reg_t      mode;
+    bool_t     isAtomic = false;
+    thread_t * this     = CURRENT_THREAD;
 
-	hal_disable_irq( &mode );
+    hal_disable_irq( &mode );
 
-	if( lock->taken == 0)
-		isAtomic = hal_atomic_cas( &lock->taken , 0 , 1);
-  
-	if(isAtomic == false)
-	{
-		hal_restore_irq(mode);
-		return 1;
-	}
+    if( lock->taken == 0)
+        isAtomic = hal_atomic_cas( &lock->taken , 0 , 1);
+
+    if(isAtomic == false)
+    {
+        hal_restore_irq(mode);
+        return 1;
+    }
     else
     {
-	    this->local_locks++;
-	    lock->owner = this;
+        this->local_locks++;
+        lock->owner = this;
         list_add_first( &this->locks_root , &lock->list );
-	    hal_restore_irq(mode);  
-	    return 0;
+        hal_restore_irq(mode);
+        return 0;
     }
 }
@@ -154,6 +154,6 @@
 void spinlock_unlock( spinlock_t * lock )
 {
-	thread_t * this = CURRENT_THREAD;
-  
+    thread_t * this = CURRENT_THREAD;
+
     lock->owner = NULL;
     lock->taken = 0;
@@ -162,3 +162,2 @@
 }
 
-
