Index: trunk/kernel/libk/remote_barrier.c
===================================================================
--- trunk/kernel/libk/remote_barrier.c	(revision 60)
+++ trunk/kernel/libk/remote_barrier.c	(revision 104)
@@ -1,5 +1,5 @@
 /*
  * remote_barrier.c - Access a POSIX barrier.
- * 
+ *
  * Author   Alain Greiner (2016,2017)
  *
@@ -35,5 +35,5 @@
 /////////////////////////////////////////////////
 inline void remote_barrier( xptr_t    barrier_xp,
-                            uint32_t  count ) 
+                            uint32_t  count )
 {
     uint32_t  expected;
@@ -45,18 +45,18 @@
     uint32_t sense = hal_remote_lw( XPTR( cxy , &ptr->sense ) );
 
-	// compute expected value
+    // compute expected value
     if ( sense == 0 ) expected = 1;
     else              expected = 0;
 
-    // atomically increment current 
+    // atomically increment current
     uint32_t current = hal_remote_atomic_add( XPTR( cxy , &ptr->current ) , 1 );
 
     // last task reset current and toggle sense
-    if( current == (count-1) ) 
-    {
-        hal_remote_sw( XPTR( cxy , &ptr->current) , 0 );  
-        hal_remote_sw( XPTR( cxy , &ptr->sense  ) , expected );  
-    }
-    else   // other tasks poll the sense 
+    if( current == (count-1) )
+    {
+        hal_remote_sw( XPTR( cxy , &ptr->current) , 0 );
+        hal_remote_sw( XPTR( cxy , &ptr->sense  ) , expected );
+    }
+    else   // other tasks poll the sense
     {
         while( hal_remote_lw( XPTR( cxy , &ptr->sense ) ) != expected ) asm volatile ("nop");
@@ -73,11 +73,11 @@
     xptr_t      ref_xp = process->ref_xp;
 
-    // get cluster and local pointer on reference process 
+    // get cluster and local pointer on reference process
     cxy_t          ref_cxy = GET_CXY( ref_xp );
     process_t    * ref_ptr = (process_t *)GET_PTR( ref_xp );
 
-    // get extended pointer on root of barriers list 
+    // get extended pointer on root of barriers list
     xptr_t root_xp = XPTR( ref_cxy , &ref_ptr->barrier_root );
-   
+
     // scan reference process barriers list
     xptr_t             iter_xp;
@@ -87,5 +87,5 @@
     intptr_t           current;
     bool_t             found = false;
-            
+
     XLIST_FOREACH( root_xp , iter_xp )
     {
@@ -93,5 +93,5 @@
         barrier_cxy = GET_CXY( barrier_xp );
         barrier_ptr = (remote_barrier_t *)GET_PTR( barrier_xp );
-        current     = (intptr_t)hal_remote_lpt( XPTR( barrier_cxy , &barrier_ptr->ident ) );   
+        current     = (intptr_t)hal_remote_lpt( XPTR( barrier_cxy , &barrier_ptr->ident ) );
         if( ident == current )
         {
@@ -103,6 +103,5 @@
     if( found == false )  return XPTR_NULL;
     else                  return barrier_xp;
-
-}  // end remote_barrier_from_ident()
+}
 
 //////////////////////////////////////////////
@@ -124,7 +123,7 @@
 
     // allocate memory for barrier descriptor
-    if( ref_cxy == local_cxy )                  // local cluster is the reference 
-    {
-        kmem_req_t req;   
+    if( ref_cxy == local_cxy )                  // local cluster is the reference
+    {
+        kmem_req_t req;
         req.type      = KMEM_BARRIER;
         req.flags     = AF_ZERO;
@@ -140,5 +139,5 @@
     if( barrier_ptr == NULL ) return ENOMEM;
 
-    // initialise barrier 
+    // initialise barrier
     hal_remote_sw ( XPTR( ref_cxy , &barrier_ptr->nb_threads ) , count );
     hal_remote_sw ( XPTR( ref_cxy , &barrier_ptr->current    ) , 0 );
@@ -157,6 +156,5 @@
 
     return 0;
-
-}  // end remote_barrier_create()
+}
 
 ////////////////////////////////////////////////
@@ -194,6 +192,5 @@
         rpc_kcm_free_client( barrier_cxy , barrier_ptr , KMEM_BARRIER );
     }
-
-}  // end remote_barrier_destroy()
+}
 
 /////////////////////////////////////////////
@@ -222,25 +219,25 @@
     sense = hal_remote_lw( XPTR( barrier_cxy , &barrier_ptr->sense ) );
 
-	// compute expected value
+    // compute expected value
     if ( sense == 0 ) expected = 1;
     else              expected = 0;
 
-    // atomically increment current 
+    // atomically increment current
     current = hal_remote_atomic_add( XPTR( barrier_cxy , &barrier_ptr->current ) , 1 );
 
     // last thread reset current, toggle sense, and activate all waiting threads
-    // other threads block, register in queue, and deschedule 
+    // other threads block, register in queue, and deschedule
 
     if( current == (count-1) )                       // last thread
     {
-        hal_remote_sw( XPTR( barrier_cxy , &barrier_ptr->current) , 0 );  
-        hal_remote_sw( XPTR( barrier_cxy , &barrier_ptr->sense  ) , expected );  
+        hal_remote_sw( XPTR( barrier_cxy , &barrier_ptr->current) , 0 );
+        hal_remote_sw( XPTR( barrier_cxy , &barrier_ptr->sense  ) , expected );
 
         // activate waiting threads if required
-        if( xlist_is_empty( root_xp ) == false )  
+        if( xlist_is_empty( root_xp ) == false )
         {
             // disable interrupts
-	        hal_disable_irq( &irq_state );
-  
+            hal_disable_irq( &irq_state );
+
             xptr_t  iter_xp;
             xptr_t  thread_xp;
@@ -249,5 +246,5 @@
                 // get extended pointer on waiting thread
                 thread_xp = XLIST_ELEMENT( iter_xp , thread_t , wait_list );
-        
+
                 // remove waiting thread from queue
                 remote_spinlock_lock( XPTR( barrier_cxy , &barrier_ptr->lock ) );
@@ -256,5 +253,5 @@
 
                 // unblock waiting thread
-                thread_unblock( thread_xp , THREAD_BLOCKED_USERSYNC ); 
+                thread_unblock( thread_xp , THREAD_BLOCKED_USERSYNC );
             }
 
@@ -263,17 +260,17 @@
         }
     }
-    else                                             // not the last thread  
+    else                                             // not the last thread
     {
         // disable interrupts
-	    hal_disable_irq( &irq_state );
-  
+        hal_disable_irq( &irq_state );
+
         // register calling thread in barrier waiting queue
         xptr_t entry_xp = XPTR( thread_cxy , &thread_ptr->wait_list );
 
-        remote_spinlock_lock( XPTR( barrier_cxy , &barrier_ptr->lock ) ); 
+        remote_spinlock_lock( XPTR( barrier_cxy , &barrier_ptr->lock ) );
         xlist_add_last( root_xp , entry_xp );
-        remote_spinlock_unlock( XPTR( barrier_cxy , &barrier_ptr->lock ) ); 
-
-        // block & deschedule the calling thread   
+        remote_spinlock_unlock( XPTR( barrier_cxy , &barrier_ptr->lock ) );
+
+        // block & deschedule the calling thread
         thread_block( thread_ptr , THREAD_BLOCKED_USERSYNC );
         sched_yield();
@@ -282,3 +279,3 @@
         hal_restore_irq( irq_state );
     }
-}  // end remote_barrier_wait()
+}
