Index: kernel/arch/sparc64/src/drivers/tick.c
===================================================================
--- kernel/arch/sparc64/src/drivers/tick.c	(revision c109dd0d57e16b366a742aafd75aacb6224d94bd)
+++ kernel/arch/sparc64/src/drivers/tick.c	(revision 4e33b6b225ade31ba0ed3f0d717b4c3af3a41738)
@@ -100,6 +100,6 @@
 		CPU->missed_clock_ticks++;
 	}
-	CPU->arch.next_tick_cmpr = tick_read() + (CPU->arch.clock_frequency / HZ)
-		- drift;
+	CPU->arch.next_tick_cmpr = tick_read() + (CPU->arch.clock_frequency /
+		HZ) - drift;
 	tick_compare_write(CPU->arch.next_tick_cmpr);
 	clock();
Index: kernel/generic/src/cpu/cpu.c
===================================================================
--- kernel/generic/src/cpu/cpu.c	(revision c109dd0d57e16b366a742aafd75aacb6224d94bd)
+++ kernel/generic/src/cpu/cpu.c	(revision 4e33b6b225ade31ba0ed3f0d717b4c3af3a41738)
@@ -60,7 +60,7 @@
 	int i, j;
 	
-	#ifdef CONFIG_SMP
+#ifdef CONFIG_SMP
 	if (config.cpu_active == 1) {
-	#endif /* CONFIG_SMP */
+#endif /* CONFIG_SMP */
 		cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count,
 					FRAME_ATOMIC);
@@ -84,7 +84,7 @@
 		}
 		
-	#ifdef CONFIG_SMP
+#ifdef CONFIG_SMP
 	}
-	#endif /* CONFIG_SMP */
+#endif /* CONFIG_SMP */
 
 	CPU = &cpus[config.cpu_active-1];
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision c109dd0d57e16b366a742aafd75aacb6224d94bd)
+++ kernel/generic/src/proc/scheduler.c	(revision 4e33b6b225ade31ba0ed3f0d717b4c3af3a41738)
@@ -1,4 +1,4 @@
 /*
- * Copyright (C) 2001-2004 Jakub Jermar
+ * Copyright (C) 2001-2007 Jakub Jermar
  * All rights reserved.
  *
@@ -143,5 +143,6 @@
 			spinlock_unlock(&THREAD->lock);
 			spinlock_unlock(&CPU->lock);
-			THREAD->saved_fpu_context = slab_alloc(fpu_context_slab, 0);
+			THREAD->saved_fpu_context =
+				slab_alloc(fpu_context_slab, 0);
 			/* We may have switched CPUs during slab_alloc */
 			goto restart; 
@@ -232,5 +233,5 @@
 		t->cpu = CPU;
 
-		t->ticks = us2ticks((i+1)*10000);
+		t->ticks = us2ticks((i + 1) * 10000);
 		t->priority = i;	/* correct rq index */
 
@@ -268,5 +269,5 @@
 	spinlock_lock(&CPU->lock);
 	if (CPU->needs_relink > NEEDS_RELINK_MAX) {
-		for (i = start; i<RQ_COUNT-1; i++) {
+		for (i = start; i < RQ_COUNT - 1; i++) {
 			/* remember and empty rq[i + 1] */
 			r = &CPU->rq[i + 1];
@@ -332,7 +333,7 @@
 
 		/*
-		 * Interrupt priority level of preempted thread is recorded here
-		 * to facilitate scheduler() invocations from interrupts_disable()'d
-		 * code (e.g. waitq_sleep_timeout()). 
+		 * Interrupt priority level of preempted thread is recorded
+		 * here to facilitate scheduler() invocations from
+		 * interrupts_disable()'d code (e.g. waitq_sleep_timeout()). 
 		 */
 		THREAD->saved_context.ipl = ipl;
@@ -395,6 +396,6 @@
 			} else {
 				/*
-				 * The thread structure is kept allocated until somebody
-				 * calls thread_detach() on it.
+				 * The thread structure is kept allocated until
+				 * somebody calls thread_detach() on it.
 				 */
 				if (!spinlock_trylock(&THREAD->join_wq.lock)) {
@@ -422,11 +423,13 @@
 
 			/*
-			 * We need to release wq->lock which we locked in waitq_sleep().
-			 * Address of wq->lock is kept in THREAD->sleep_queue.
+			 * We need to release wq->lock which we locked in
+			 * waitq_sleep(). Address of wq->lock is kept in
+			 * THREAD->sleep_queue.
 			 */
 			spinlock_unlock(&THREAD->sleep_queue->lock);
 
 			/*
-			 * Check for possible requests for out-of-context invocation.
+			 * Check for possible requests for out-of-context
+			 * invocation.
 			 */
 			if (THREAD->call_me) {
@@ -444,5 +447,6 @@
 			 * Entering state is unexpected.
 			 */
-			panic("tid%d: unexpected state %s\n", THREAD->tid, thread_states[THREAD->state]);
+			panic("tid%d: unexpected state %s\n", THREAD->tid,
+				thread_states[THREAD->state]);
 			break;
 		}
@@ -460,5 +464,6 @@
 
 	/*
-	 * If both the old and the new task are the same, lots of work is avoided.
+	 * If both the old and the new task are the same, lots of work is
+	 * avoided.
 	 */
 	if (TASK != THREAD->task) {
@@ -477,5 +482,6 @@
 		
 		/*
-		 * Note that it is possible for two tasks to share one address space.
+		 * Note that it is possible for two tasks to share one address
+		 * space.
 		 */
 		if (as1 != as2) {
@@ -494,6 +500,7 @@
 
 #ifdef SCHEDULER_VERBOSE
-	printf("cpu%d: tid %d (priority=%d,ticks=%lld,nrdy=%ld)\n",
-		CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, atomic_get(&CPU->nrdy));
+	printf("cpu%d: tid %d (priority=%d, ticks=%lld, nrdy=%ld)\n",
+		CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks,
+			atomic_get(&CPU->nrdy));
 #endif	
 
@@ -509,5 +516,6 @@
 
 	/*
-	 * Copy the knowledge of CPU, TASK, THREAD and preemption counter to thread's stack.
+	 * Copy the knowledge of CPU, TASK, THREAD and preemption counter to
+	 * thread's stack.
 	 */
 	the_copy(THE, (the_t *) THREAD->kstack);
@@ -556,8 +564,9 @@
 
 	/*
-	 * Searching least priority queues on all CPU's first and most priority queues on all CPU's last.
-	 */
-	for (j=RQ_COUNT-1; j >= 0; j--) {
-		for (i=0; i < config.cpu_active; i++) {
+	 * Searching least priority queues on all CPU's first and most priority
+	 * queues on all CPU's last.
+	 */
+	for (j= RQ_COUNT - 1; j >= 0; j--) {
+		for (i = 0; i < config.cpu_active; i++) {
 			link_t *l;
 			runq_t *r;
@@ -568,5 +577,6 @@
 			/*
 			 * Not interested in ourselves.
-			 * Doesn't require interrupt disabling for kcpulb has THREAD_FLAG_WIRED.
+			 * Doesn't require interrupt disabling for kcpulb has
+			 * THREAD_FLAG_WIRED.
 			 */
 			if (CPU == cpu)
@@ -589,11 +599,14 @@
 				t = list_get_instance(l, thread_t, rq_link);
 				/*
-				 * We don't want to steal CPU-wired threads neither threads already
-				 * stolen. The latter prevents threads from migrating between CPU's
-				 * without ever being run. We don't want to steal threads whose FPU
-				 * context is still in CPU.
+				 * We don't want to steal CPU-wired threads
+				 * neither threads already stolen. The latter
+				 * prevents threads from migrating between CPU's
+				 * without ever being run. We don't want to
+				 * steal threads whose FPU context is still in
+				 * CPU.
 				 */
 				spinlock_lock(&t->lock);
-				if ((!(t->flags & (THREAD_FLAG_WIRED | THREAD_FLAG_STOLEN))) &&
+				if ((!(t->flags & (THREAD_FLAG_WIRED |
+					THREAD_FLAG_STOLEN))) &&
 					(!(t->fpu_context_engaged)) ) {
 					/*
@@ -622,6 +635,7 @@
 				spinlock_lock(&t->lock);
 #ifdef KCPULB_VERBOSE
-				printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, avg=%nd\n",
-					CPU->id, t->tid, CPU->id, atomic_get(&CPU->nrdy),
+				printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, "
+					"avg=%nd\n", CPU->id, t->tid, CPU->id,
+					atomic_get(&CPU->nrdy),
 					atomic_get(&nrdy) / config.cpu_active);
 #endif
@@ -638,5 +652,6 @@
 					
 				/*
-				 * We are not satisfied yet, focus on another CPU next time.
+				 * We are not satisfied yet, focus on another
+				 * CPU next time.
 				 */
 				k++;
@@ -689,7 +704,8 @@
 		spinlock_lock(&cpus[cpu].lock);
 		printf("cpu%d: address=%p, nrdy=%ld, needs_relink=%ld\n",
-		       cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy), cpus[cpu].needs_relink);
+			cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
+			cpus[cpu].needs_relink);
 		
-		for (i=0; i<RQ_COUNT; i++) {
+		for (i = 0; i < RQ_COUNT; i++) {
 			r = &cpus[cpu].rq[i];
 			spinlock_lock(&r->lock);
@@ -699,8 +715,9 @@
 			}
 			printf("\trq[%d]: ", i);
-			for (cur=r->rq_head.next; cur!=&r->rq_head; cur=cur->next) {
+			for (cur = r->rq_head.next; cur != &r->rq_head;
+				cur = cur->next) {
 				t = list_get_instance(cur, thread_t, rq_link);
 				printf("%d(%s) ", t->tid,
-				       thread_states[t->state]);
+					thread_states[t->state]);
 			}
 			printf("\n");
Index: kernel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision c109dd0d57e16b366a742aafd75aacb6224d94bd)
+++ kernel/generic/src/proc/thread.c	(revision 4e33b6b225ade31ba0ed3f0d717b4c3af3a41738)
@@ -81,11 +81,14 @@
 }; 
 
-/** Lock protecting the threads_btree B+tree. For locking rules, see declaration thereof. */
+/** Lock protecting the threads_btree B+tree.
+ *
+ * For locking rules, see declaration thereof.
+ */
 SPINLOCK_INITIALIZE(threads_lock);
 
 /** B+tree of all threads.
  *
- * When a thread is found in the threads_btree B+tree, it is guaranteed to exist as long
- * as the threads_lock is held.
+ * When a thread is found in the threads_btree B+tree, it is guaranteed to
+ * exist as long as the threads_lock is held.
  */
 btree_t threads_btree;		
@@ -99,9 +102,8 @@
 #endif
 
-/** Thread wrapper
- *
- * This wrapper is provided to ensure that every thread
- * makes a call to thread_exit() when its implementing
- * function returns.
+/** Thread wrapper.
+ *
+ * This wrapper is provided to ensure that every thread makes a call to
+ * thread_exit() when its implementing function returns.
  *
  * interrupts_disable() is assumed.
@@ -202,12 +204,10 @@
 	THREAD = NULL;
 	atomic_set(&nrdy,0);
-	thread_slab = slab_cache_create("thread_slab", 
-					sizeof(thread_t),0, 
-					thr_constructor, thr_destructor, 0);
+	thread_slab = slab_cache_create("thread_slab", sizeof(thread_t), 0,
+		thr_constructor, thr_destructor, 0);
+
 #ifdef ARCH_HAS_FPU
-	fpu_context_slab = slab_cache_create("fpu_slab",
-					     sizeof(fpu_context_t),
-					     FPU_CONTEXT_ALIGN,
-					     NULL, NULL, 0);
+	fpu_context_slab = slab_cache_create("fpu_slab", sizeof(fpu_context_t),
+		FPU_CONTEXT_ALIGN, NULL, NULL, 0);
 #endif
 
@@ -235,5 +235,5 @@
 	ASSERT(! (t->state == Ready));
 
-	i = (t->priority < RQ_COUNT -1) ? ++t->priority : t->priority;
+	i = (t->priority < RQ_COUNT - 1) ? ++t->priority : t->priority;
 	
 	cpu = CPU;
@@ -268,5 +268,5 @@
 void thread_destroy(thread_t *t)
 {
-	bool destroy_task = false;	
+	bool destroy_task = false;
 
 	ASSERT(t->state == Exiting || t->state == Undead);
@@ -275,6 +275,6 @@
 
 	spinlock_lock(&t->cpu->lock);
-	if(t->cpu->fpu_owner==t)
-		t->cpu->fpu_owner=NULL;
+	if(t->cpu->fpu_owner == t)
+		t->cpu->fpu_owner = NULL;
 	spinlock_unlock(&t->cpu->lock);
 
@@ -311,10 +311,12 @@
  * @param flags     Thread flags.
  * @param name      Symbolic name.
- * @param uncounted Thread's accounting doesn't affect accumulated task accounting.
+ * @param uncounted Thread's accounting doesn't affect accumulated task
+ * 	 accounting.
  *
  * @return New thread's structure on success, NULL on failure.
  *
  */
-thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags, char *name, bool uncounted)
+thread_t *thread_create(void (* func)(void *), void *arg, task_t *task,
+	int flags, char *name, bool uncounted)
 {
 	thread_t *t;
@@ -326,5 +328,6 @@
 	
 	/* Not needed, but good for debugging */
-	memsetb((uintptr_t) t->kstack, THREAD_STACK_SIZE * 1 << STACK_FRAMES, 0);
+	memsetb((uintptr_t) t->kstack, THREAD_STACK_SIZE * 1 << STACK_FRAMES,
+		0);
 	
 	ipl = interrupts_disable();
@@ -335,5 +338,6 @@
 	
 	context_save(&t->saved_context);
-	context_set(&t->saved_context, FADDR(cushion), (uintptr_t) t->kstack, THREAD_STACK_SIZE);
+	context_set(&t->saved_context, FADDR(cushion), (uintptr_t) t->kstack,
+		THREAD_STACK_SIZE);
 	
 	the_initialize((the_t *) t->kstack);
@@ -377,5 +381,6 @@
 	t->fpu_context_engaged = 0;
 
-	thread_create_arch(t);		/* might depend on previous initialization */
+	/* might depend on previous initialization */
+	thread_create_arch(t);	
 	
 	/*
@@ -399,5 +404,6 @@
 	 */
 	spinlock_lock(&threads_lock);
-	btree_insert(&threads_btree, (btree_key_t) ((uintptr_t) t), (void *) t, NULL);
+	btree_insert(&threads_btree, (btree_key_t) ((uintptr_t) t), (void *) t,
+		NULL);
 	spinlock_unlock(&threads_lock);
 	
@@ -409,7 +415,6 @@
 /** Terminate thread.
  *
- * End current thread execution and switch it to the exiting
- * state. All pending timeouts are executed.
- *
+ * End current thread execution and switch it to the exiting state. All pending
+ * timeouts are executed.
  */
 void thread_exit(void)
@@ -420,5 +425,6 @@
 	ipl = interrupts_disable();
 	spinlock_lock(&THREAD->lock);
-	if (THREAD->timeout_pending) { /* busy waiting for timeouts in progress */
+	if (THREAD->timeout_pending) { 
+		/* busy waiting for timeouts in progress */
 		spinlock_unlock(&THREAD->lock);
 		interrupts_restore(ipl);
@@ -444,5 +450,5 @@
 void thread_sleep(uint32_t sec)
 {
-	thread_usleep(sec*1000000);
+	thread_usleep(sec * 1000000);
 }
 
Index: kernel/generic/src/synch/waitq.c
===================================================================
--- kernel/generic/src/synch/waitq.c	(revision c109dd0d57e16b366a742aafd75aacb6224d94bd)
+++ kernel/generic/src/synch/waitq.c	(revision 4e33b6b225ade31ba0ed3f0d717b4c3af3a41738)
@@ -189,18 +189,18 @@
  
  * If usec is greater than zero, regardless of the value of the
- * SYNCH_FLAGS_NON_BLOCKING bit in flags, the call will not return until either timeout,
- * interruption or wakeup comes. 
- *
- * If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is not set in flags, the call
- * will not return until wakeup or interruption comes.
- *
- * If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is set in flags, the call will
- * immediately return, reporting either success or failure.
- *
- * @return 	Returns one of: ESYNCH_WOULD_BLOCK, ESYNCH_TIMEOUT, ESYNCH_INTERRUPTED,
- *      	ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED.
- *
- * @li ESYNCH_WOULD_BLOCK means that the sleep failed because at the time
- * of the call there was no pending wakeup.
+ * SYNCH_FLAGS_NON_BLOCKING bit in flags, the call will not return until either
+ * timeout, interruption or wakeup comes. 
+ *
+ * If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is not set in flags,
+ * the call will not return until wakeup or interruption comes.
+ *
+ * If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is set in flags, the
+ * call will immediately return, reporting either success or failure.
+ *
+ * @return One of: ESYNCH_WOULD_BLOCK, ESYNCH_TIMEOUT, ESYNCH_INTERRUPTED,
+ * ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED.
+ *
+ * @li ESYNCH_WOULD_BLOCK means that the sleep failed because at the time of the
+ * call there was no pending wakeup.
  *
  * @li ESYNCH_TIMEOUT means that the sleep timed out.
@@ -352,5 +352,6 @@
 		}
 		THREAD->timeout_pending = true;
-		timeout_register(&THREAD->sleep_timeout, (uint64_t) usec, waitq_timeouted_sleep, THREAD);
+		timeout_register(&THREAD->sleep_timeout, (uint64_t) usec,
+			waitq_timeouted_sleep, THREAD);
 	}
 
@@ -365,5 +366,6 @@
 	spinlock_unlock(&THREAD->lock);
 
-	scheduler(); 	/* wq->lock is released in scheduler_separated_stack() */
+	/* wq->lock is released in scheduler_separated_stack() */
+	scheduler(); 
 	
 	return ESYNCH_OK_BLOCKED;
@@ -373,14 +375,13 @@
 /** Wake up first thread sleeping in a wait queue
  *
- * Wake up first thread sleeping in a wait queue.
- * This is the SMP- and IRQ-safe wrapper meant for
- * general use.
- *
- * Besides its 'normal' wakeup operation, it attempts
- * to unregister possible timeout.
+ * Wake up first thread sleeping in a wait queue. This is the SMP- and IRQ-safe
+ * wrapper meant for general use.
+ *
+ * Besides its 'normal' wakeup operation, it attempts to unregister possible
+ * timeout.
  *
  * @param wq Pointer to wait queue.
- * @param all If this is non-zero, all sleeping threads
- *        will be woken up and missed count will be zeroed.
+ * @param all If this is non-zero, all sleeping threads will be woken up and
+ * 	missed count will be zeroed.
  */
 void waitq_wakeup(waitq_t *wq, bool all)
@@ -399,11 +400,10 @@
 /** Internal SMP- and IRQ-unsafe version of waitq_wakeup()
  *
- * This is the internal SMP- and IRQ-unsafe version
- * of waitq_wakeup(). It assumes wq->lock is already
- * locked and interrupts are already disabled.
+ * This is the internal SMP- and IRQ-unsafe version of waitq_wakeup(). It
+ * assumes wq->lock is already locked and interrupts are already disabled.
  *
  * @param wq Pointer to wait queue.
- * @param all If this is non-zero, all sleeping threads
- *        will be woken up and missed count will be zeroed.
+ * @param all If this is non-zero, all sleeping threads will be woken up and
+ * 	missed count will be zeroed.
  */
 void _waitq_wakeup_unsafe(waitq_t *wq, bool all)
