Index: kernel/generic/src/synch/workqueue.c
===================================================================
--- kernel/generic/src/synch/workqueue.c	(revision b7fd2a02e4161f4edd38548e7f8456b8021549be)
+++ kernel/generic/src/synch/workqueue.c	(revision 1b20da07baaa3e3c424f62c927274e676e4295cd)
@@ -54,6 +54,6 @@
 
 struct work_queue {
-	/* 
-	 * Protects everything except activate_worker. 
+	/*
+	 * Protects everything except activate_worker.
 	 * Must be acquired after any thread->locks.
 	 */
@@ -93,5 +93,5 @@
 	/* Magic cookie for integrity checks. Immutable. Accessed without lock. */
 	uint32_t cookie;
-#endif 
+#endif
 };
 
@@ -132,5 +132,5 @@
 static void interrupt_workers(struct work_queue *workq);
 static void wait_for_workers(struct work_queue *workq);
-static int _workq_enqueue(struct work_queue *workq, work_t *work_item, 
+static int _workq_enqueue(struct work_queue *workq, work_t *work_item,
 	work_func_t func, bool can_block);
 static void init_work_item(work_t *work_item, work_func_t func);
@@ -150,6 +150,6 @@
 void workq_global_worker_init(void)
 {
-	/* 
-	 * No need for additional synchronization. Stores to word-sized 
+	/*
+	 * No need for additional synchronization. Stores to word-sized
 	 * variables are atomic and the change will eventually propagate.
 	 * Moreover add_worker() includes the necessary memory barriers
@@ -221,5 +221,5 @@
 #ifdef CONFIG_DEBUG
 	workq->cookie = 0;
-#endif 
+#endif
 	
 	free(workq);
@@ -231,5 +231,5 @@
 #ifdef CONFIG_DEBUG
 	workq->cookie = WORKQ_MAGIC;
-#endif 
+#endif
 	
 	irq_spinlock_initialize(&workq->lock, name);
@@ -252,6 +252,6 @@
 }
 
-/** Initializes a work queue. Returns true if successful.  
- * 
+/** Initializes a work queue. Returns true if successful.
+ *
  * Before destroying a work queue it must be stopped via
  * workq_stop().
@@ -268,5 +268,5 @@
 	assert(!workq_corrupted(workq));
 
-	thread_t *thread = thread_create(worker_thread, workq, TASK, 
+	thread_t *thread = thread_create(worker_thread, workq, TASK,
 		THREAD_FLAG_NONE, workq->name);
 	
@@ -297,5 +297,5 @@
 			cpu_id = CPU->id;
 
-		thread->workq = workq;	
+		thread->workq = workq;
 		thread->cpu = &cpus[cpu_id];
 		thread->workq_blocked = false;
@@ -305,5 +305,5 @@
 		list_append(&thread->workq_link, &workq->workers);
 	} else {
-		/* 
+		/*
 		 * Work queue is shutting down - we must not add the worker
 		 * and we cannot destroy it without ready-ing it. Mark it
@@ -330,7 +330,7 @@
 }
 
-/** Shuts down the work queue. Waits for all pending work items to complete.  
- *
- * workq_stop() may only be run once. 
+/** Shuts down the work queue. Waits for all pending work items to complete.
+ *
+ * workq_stop() may only be run once.
  */
 void workq_stop(struct work_queue *workq)
@@ -391,6 +391,6 @@
 }
 
-/** Queues a function into the global wait queue without blocking. 
- * 
+/** Queues a function into the global wait queue without blocking.
+ *
  * See workq_enqueue_noblock() for more details.
  */
@@ -400,6 +400,6 @@
 }
 
-/** Queues a function into the global wait queue; may block. 
- * 
+/** Queues a function into the global wait queue; may block.
+ *
  * See workq_enqueue() for more details.
  */
@@ -409,13 +409,13 @@
 }
 
-/** Adds a function to be invoked in a separate thread without blocking. 
- * 
- * workq_enqueue_noblock() is guaranteed not to block. It is safe 
+/** Adds a function to be invoked in a separate thread without blocking.
+ *
+ * workq_enqueue_noblock() is guaranteed not to block. It is safe
  * to invoke from interrupt handlers.
- * 
+ *
  * Consider using workq_enqueue() instead if at all possible. Otherwise,
- * your work item may have to wait for previously enqueued sleeping 
+ * your work item may have to wait for previously enqueued sleeping
  * work items to complete if you are unlucky.
- * 
+ *
  * @param workq     Work queue where to queue the work item.
  * @param work_item Work item bookkeeping structure. Must be valid
@@ -423,9 +423,9 @@
  * @param func      User supplied function to invoke in a worker thread.
  
- * @return false if work queue is shutting down; function is not 
- *               queued for further processing. 
+ * @return false if work queue is shutting down; function is not
+ *               queued for further processing.
  * @return true  Otherwise. func() will be invoked in a separate thread.
  */
-bool workq_enqueue_noblock(struct work_queue *workq, work_t *work_item, 
+bool workq_enqueue_noblock(struct work_queue *workq, work_t *work_item,
 	work_func_t func)
 {
@@ -433,9 +433,9 @@
 }
 
-/** Adds a function to be invoked in a separate thread; may block. 
- * 
- * While the workq_enqueue() is unlikely to block, it may do so if too 
+/** Adds a function to be invoked in a separate thread; may block.
+ *
+ * While the workq_enqueue() is unlikely to block, it may do so if too
  * many previous work items blocked sleeping.
- * 
+ *
  * @param workq     Work queue where to queue the work item.
  * @param work_item Work item bookkeeping structure. Must be valid
@@ -443,6 +443,6 @@
  * @param func      User supplied function to invoke in a worker thread.
  
- * @return false if work queue is shutting down; function is not 
- *               queued for further processing. 
+ * @return false if work queue is shutting down; function is not
+ *               queued for further processing.
  * @return true  Otherwise. func() will be invoked in a separate thread.
  */
@@ -453,7 +453,7 @@
 
 /** Adds a work item that will be processed by a separate worker thread.
- * 
- * func() will be invoked in another kernel thread and may block. 
- * 
+ *
+ * func() will be invoked in another kernel thread and may block.
+ *
  * Prefer to call _workq_enqueue() with can_block set. Otherwise
  * your work item may have to wait for sleeping work items to complete.
@@ -461,5 +461,5 @@
  * be create without can_block set because creating a thread might
  * block due to low memory conditions.
- * 
+ *
  * @param workq     Work queue where to queue the work item.
  * @param work_item Work item bookkeeping structure. Must be valid
@@ -468,9 +468,9 @@
  * @param can_block May adding this work item block?
  
- * @return false if work queue is shutting down; function is not 
- *               queued for further processing. 
+ * @return false if work queue is shutting down; function is not
+ *               queued for further processing.
  * @return true  Otherwise.
  */
-static int _workq_enqueue(struct work_queue *workq, work_t *work_item, 
+static int _workq_enqueue(struct work_queue *workq, work_t *work_item,
 	work_func_t func, bool can_block)
 {
@@ -493,6 +493,6 @@
 			signal_op = signal_worker_logic(workq, can_block);
 		} else {
-			/* 
-			 * During boot there are no workers to signal. Just queue 
+			/*
+			 * During boot there are no workers to signal. Just queue
 			 * the work and let future workers take care of it.
 			 */
@@ -514,5 +514,5 @@
 #ifdef CONFIG_DEBUG
 	work_item->cookie = WORK_ITEM_MAGIC;
-#endif 
+#endif
 	
 	link_initialize(&work_item->queue_link);
@@ -537,8 +537,8 @@
 	assert(workq->activate_pending <= workq->idle_worker_cnt);
 	
-	/* 
-	 * Workers actively running the work func() this very moment and 
-	 * are neither blocked nor idle. Exclude ->activate_pending workers 
-	 * since they will run their work func() once they get a time slice 
+	/*
+	 * Workers actively running the work func() this very moment and
+	 * are neither blocked nor idle. Exclude ->activate_pending workers
+	 * since they will run their work func() once they get a time slice
 	 * and are not running it right now.
 	 */
@@ -546,7 +546,7 @@
 }
 
-/** 
- * Returns the number of workers that are running or are about to run work 
- * func() and that are not blocked. 
+/**
+ * Returns the number of workers that are running or are about to run work
+ * func() and that are not blocked.
  */
 static size_t active_workers(struct work_queue *workq)
@@ -554,6 +554,6 @@
 	assert(irq_spinlock_locked(&workq->lock));
 	
-	/* 
-	 * Workers actively running the work func() and are neither blocked nor 
+	/*
+	 * Workers actively running the work func() and are neither blocked nor
 	 * idle. ->activate_pending workers will run their work func() once they
 	 * get a time slice after waking from a condvar wait, so count them
@@ -586,9 +586,9 @@
 
 /** Determines how to signal workers if at all.
- * 
+ *
  * @param workq     Work queue where a new work item was queued.
- * @param can_block True if we may block while signaling a worker or creating 
+ * @param can_block True if we may block while signaling a worker or creating
  *                  a new worker.
- * 
+ *
  * @return Function that will notify workers or NULL if no action is needed.
  */
@@ -601,7 +601,7 @@
 	signal_op_t signal_op = NULL;
 
-	/* 
-	 * Workers actively running the work func() and neither blocked nor idle. 
-	 * Including ->activate_pending workers that will run their work func() 
+	/*
+	 * Workers actively running the work func() and neither blocked nor idle.
+	 * Including ->activate_pending workers that will run their work func()
 	 * once they get a time slice.
 	 */
@@ -613,12 +613,12 @@
 	if (max_load < workq->item_cnt) {
 
-		size_t remaining_idle = 
+		size_t remaining_idle =
 			workq->idle_worker_cnt - workq->activate_pending;
 
 		/* Idle workers still exist - activate one. */
 		if (remaining_idle > 0) {
-			/* 
+			/*
 			 * Directly changing idle_worker_cnt here would not allow
-			 * workers to recognize spurious wake-ups. Change 
+			 * workers to recognize spurious wake-ups. Change
 			 * activate_pending instead.
 			 */
@@ -633,5 +633,5 @@
 			if (need_worker && can_block) {
 				signal_op = add_worker_op;
-				/* 
+				/*
 				 * It may take some time to actually create the worker.
 				 * We don't want to swamp the thread pool with superfluous
@@ -642,5 +642,5 @@
 			}
 			
-			/* 
+			/*
 			 * We cannot create a new worker but we need one desperately
 			 * because all workers are blocked in their work functions.
@@ -661,6 +661,6 @@
 		}
 	} else {
-		/* 
-		 * There are enough active/running workers to process the queue. 
+		/*
+		 * There are enough active/running workers to process the queue.
 		 * No need to signal/activate any new workers.
 		 */
@@ -674,7 +674,7 @@
 static void worker_thread(void *arg)
 {
-	/* 
-	 * The thread has been created after the work queue was ordered to stop. 
-	 * Do not access the work queue and return immediately. 
+	/*
+	 * The thread has been created after the work queue was ordered to stop.
+	 * Do not access the work queue and return immediately.
 	 */
 	if (thread_interrupted(THREAD)) {
@@ -760,5 +760,5 @@
 		return (min_worker_cnt <= workq->idle_worker_cnt);
 	} else {
-		/* 
+		/*
 		 * There is work but we are swamped with too many active workers
 		 * that were woken up from sleep at around the same time. We
@@ -854,5 +854,5 @@
 	bool stopping = workq->stopping;
 	bool worker_surplus = worker_unnecessary(workq);
-	const char *load_str = worker_surplus ? "decreasing" : 
+	const char *load_str = worker_surplus ? "decreasing" :
 		(0 < workq->activate_pending) ? "increasing" : "stable";
 	
@@ -869,5 +869,5 @@
 		"Stopping: %d\n"
 		"Load: %s\n",
-		max_worker_cnt, min_worker_cnt, 
+		max_worker_cnt, min_worker_cnt,
 		max_concurrent_workers, max_items_per_worker,
 		total,
@@ -895,5 +895,5 @@
 	
 	while (list_empty(&info->work_queues) && !stop) {
-		errno_t ret = _condvar_wait_timeout_irq_spinlock(&info->req_cv, 
+		errno_t ret = _condvar_wait_timeout_irq_spinlock(&info->req_cv,
 			&info->lock, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
 		
@@ -902,5 +902,5 @@
 	
 	if (!stop) {
-		*pworkq = list_get_instance(list_first(&info->work_queues), 
+		*pworkq = list_get_instance(list_first(&info->work_queues),
 			struct work_queue, nb_link);
 
@@ -932,5 +932,5 @@
 	list_initialize(&nonblock_adder.work_queues);
 	
-	nonblock_adder.thread = thread_create(thr_nonblock_add_worker, 
+	nonblock_adder.thread = thread_create(thr_nonblock_add_worker,
 		&nonblock_adder, TASK, THREAD_FLAG_NONE, "kworkq-nb");
 	
@@ -938,5 +938,5 @@
 		thread_ready(nonblock_adder.thread);
 	} else {
-		/* 
+		/*
 		 * We won't be able to add workers without blocking if all workers
 		 * sleep, but at least boot the system.
@@ -947,11 +947,11 @@
 
 #ifdef CONFIG_DEBUG
-/** Returns true if the workq is definitely corrupted; false if not sure. 
- * 
+/** Returns true if the workq is definitely corrupted; false if not sure.
+ *
  * Can be used outside of any locks.
  */
 static bool workq_corrupted(struct work_queue *workq)
 {
-	/* 
+	/*
 	 * Needed to make the most current cookie value set by workq_preinit()
 	 * visible even if we access the workq right after it is created but
@@ -963,6 +963,6 @@
 }
 
-/** Returns true if the work_item is definitely corrupted; false if not sure. 
- * 
+/** Returns true if the work_item is definitely corrupted; false if not sure.
+ *
  * Must be used with the work queue protecting spinlock locked.
  */
