Index: uspace/lib/drv/generic/driver.c
===================================================================
--- uspace/lib/drv/generic/driver.c	(revision 1a23f6ec4a86a9f9b2d79272d9b134a9e00875f8)
+++ uspace/lib/drv/generic/driver.c	(revision 2f90b46749b0b0b689233324cb5f2489bd7b57a3)
@@ -125,19 +125,17 @@
 static void driver_dev_add(ipc_callid_t iid, ipc_call_t *icall)
 {
-	char *dev_name = NULL;
-	int res;
-	
 	devman_handle_t dev_handle = IPC_GET_ARG1(*icall);
 	devman_handle_t parent_fun_handle = IPC_GET_ARG2(*icall);
 	
 	ddf_dev_t *dev = create_device();
-
+	
 	/* Add one reference that will be dropped by driver_dev_remove() */
 	dev_add_ref(dev);
 	dev->handle = dev_handle;
-
+	
+	char *dev_name = NULL;
 	async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0);
 	dev->name = dev_name;
-
+	
 	/*
 	 * Currently not used, parent fun handle is stored in context
@@ -146,5 +144,5 @@
 	(void) parent_fun_handle;
 	
-	res = driver->driver_ops->dev_add(dev);
+	int res = driver->driver_ops->dev_add(dev);
 	
 	if (res != EOK) {
@@ -163,12 +161,8 @@
 static void driver_dev_remove(ipc_callid_t iid, ipc_call_t *icall)
 {
-	devman_handle_t devh;
-	ddf_dev_t *dev;
-	int rc;
-	
-	devh = IPC_GET_ARG1(*icall);
+	devman_handle_t devh = IPC_GET_ARG1(*icall);
 	
 	fibril_mutex_lock(&devices_mutex);
-	dev = driver_get_device(devh);
+	ddf_dev_t *dev = driver_get_device(devh);
 	if (dev != NULL)
 		dev_add_ref(dev);
@@ -179,4 +173,6 @@
 		return;
 	}
+	
+	int rc;
 	
 	if (driver->driver_ops->dev_remove != NULL)
@@ -193,12 +189,8 @@
 static void driver_dev_gone(ipc_callid_t iid, ipc_call_t *icall)
 {
-	devman_handle_t devh;
-	ddf_dev_t *dev;
-	int rc;
-	
-	devh = IPC_GET_ARG1(*icall);
+	devman_handle_t devh = IPC_GET_ARG1(*icall);
 	
 	fibril_mutex_lock(&devices_mutex);
-	dev = driver_get_device(devh);
+	ddf_dev_t *dev = driver_get_device(devh);
 	if (dev != NULL)
 		dev_add_ref(dev);
@@ -209,4 +201,6 @@
 		return;
 	}
+	
+	int rc;
 	
 	if (driver->driver_ops->dev_gone != NULL)
@@ -223,9 +217,5 @@
 static void driver_fun_online(ipc_callid_t iid, ipc_call_t *icall)
 {
-	devman_handle_t funh;
-	ddf_fun_t *fun;
-	int rc;
-	
-	funh = IPC_GET_ARG1(*icall);
+	devman_handle_t funh = IPC_GET_ARG1(*icall);
 	
 	/*
@@ -236,5 +226,5 @@
 	fibril_mutex_lock(&functions_mutex);
 	
-	fun = driver_get_function(funh);
+	ddf_fun_t *fun = driver_get_function(funh);
 	if (fun != NULL)
 		fun_add_ref(fun);
@@ -248,4 +238,6 @@
 	
 	/* Call driver entry point */
+	int rc;
+	
 	if (driver->driver_ops->fun_online != NULL)
 		rc = driver->driver_ops->fun_online(fun);
@@ -260,9 +252,5 @@
 static void driver_fun_offline(ipc_callid_t iid, ipc_call_t *icall)
 {
-	devman_handle_t funh;
-	ddf_fun_t *fun;
-	int rc;
-	
-	funh = IPC_GET_ARG1(*icall);
+	devman_handle_t funh = IPC_GET_ARG1(*icall);
 	
 	/*
@@ -273,5 +261,5 @@
 	fibril_mutex_lock(&functions_mutex);
 	
-	fun = driver_get_function(funh);
+	ddf_fun_t *fun = driver_get_function(funh);
 	if (fun != NULL)
 		fun_add_ref(fun);
@@ -285,4 +273,6 @@
 	
 	/* Call driver entry point */
+	int rc;
+	
 	if (driver->driver_ops->fun_offline != NULL)
 		rc = driver->driver_ops->fun_offline(fun);
@@ -597,12 +587,10 @@
 void *ddf_dev_data_alloc(ddf_dev_t *dev, size_t size)
 {
-	void *data;
-
 	assert(dev->driver_data == NULL);
-
-	data = calloc(1, size);
+	
+	void *data = calloc(1, size);
 	if (data == NULL)
 		return NULL;
-
+	
 	dev->driver_data = data;
 	return data;
@@ -634,17 +622,15 @@
 ddf_fun_t *ddf_fun_create(ddf_dev_t *dev, fun_type_t ftype, const char *name)
 {
-	ddf_fun_t *fun;
-
-	fun = create_function();
+	ddf_fun_t *fun = create_function();
 	if (fun == NULL)
 		return NULL;
-
+	
 	/* Add one reference that will be dropped by ddf_fun_destroy() */
 	fun->dev = dev;
 	fun_add_ref(fun);
-
+	
 	fun->bound = false;
 	fun->ftype = ftype;
-
+	
 	fun->name = str_dup(name);
 	if (fun->name == NULL) {
@@ -652,5 +638,5 @@
 		return NULL;
 	}
-
+	
 	return fun;
 }
@@ -659,13 +645,11 @@
 void *ddf_fun_data_alloc(ddf_fun_t *fun, size_t size)
 {
-	void *data;
-
 	assert(fun->bound == false);
 	assert(fun->driver_data == NULL);
-
-	data = calloc(1, size);
+	
+	void *data = calloc(1, size);
 	if (data == NULL)
 		return NULL;
-
+	
 	fun->driver_data = data;
 	return data;
@@ -677,10 +661,11 @@
  * must not be bound.
  *
- * @param fun		Function to destroy
+ * @param fun Function to destroy
+ *
  */
 void ddf_fun_destroy(ddf_fun_t *fun)
 {
 	assert(fun->bound == false);
-
+	
 	/*
 	 * Drop the reference added by ddf_fun_create(). This will deallocate
@@ -697,4 +682,5 @@
 	if (fun->ops == NULL)
 		return NULL;
+	
 	return fun->ops->interfaces[idx];
 }
@@ -709,6 +695,8 @@
  * the same name.
  *
- * @param fun		Function to bind
- * @return		EOK on success or negative error code
+ * @param fun Function to bind
+ *
+ * @return EOK on success or negative error code
+ *
  */
 int ddf_fun_bind(ddf_fun_t *fun)
@@ -717,8 +705,6 @@
 	assert(fun->name != NULL);
 	
-	int res;
-	
 	add_to_functions_list(fun);
-	res = devman_add_function(fun->name, fun->ftype, &fun->match_ids,
+	int res = devman_add_function(fun->name, fun->ftype, &fun->match_ids,
 	    fun->dev->handle, &fun->handle);
 	if (res != EOK) {
@@ -736,17 +722,17 @@
  * the function invisible to the system.
  *
- * @param fun		Function to unbind
- * @return		EOK on success or negative error code
+ * @param fun Function to unbind
+ *
+ * @return EOK on success or negative error code
+ *
  */
 int ddf_fun_unbind(ddf_fun_t *fun)
 {
-	int res;
-	
 	assert(fun->bound == true);
 	
-	res = devman_remove_function(fun->handle);
+	int res = devman_remove_function(fun->handle);
 	if (res != EOK)
 		return res;
-
+	
 	remove_from_functions_list(fun);
 	
@@ -757,14 +743,14 @@
 /** Online function.
  *
- * @param fun		Function to online
- * @return		EOK on success or negative error code
+ * @param fun Function to online
+ *
+ * @return EOK on success or negative error code
+ *
  */
 int ddf_fun_online(ddf_fun_t *fun)
 {
-	int res;
-	
 	assert(fun->bound == true);
 	
-	res = devman_drv_fun_online(fun->handle);
+	int res = devman_drv_fun_online(fun->handle);
 	if (res != EOK)
 		return res;
@@ -775,14 +761,14 @@
 /** Offline function.
  *
- * @param fun		Function to offline
- * @return		EOK on success or negative error code
+ * @param fun Function to offline
+ *
+ * @return EOK on success or negative error code
+ *
  */
 int ddf_fun_offline(ddf_fun_t *fun)
 {
-	int res;
-	
 	assert(fun->bound == true);
 	
-	res = devman_drv_fun_offline(fun->handle);
+	int res = devman_drv_fun_offline(fun->handle);
 	if (res != EOK)
 		return res;
@@ -796,18 +782,19 @@
  * Cannot be called when the function node is bound.
  *
- * @param fun			Function
- * @param match_id_str		Match string
- * @param match_score		Match score
- * @return			EOK on success, ENOMEM if out of memory.
+ * @param fun          Function
+ * @param match_id_str Match string
+ * @param match_score  Match score
+ *
+ * @return EOK on success.
+ * @return ENOMEM if out of memory.
+ *
  */
 int ddf_fun_add_match_id(ddf_fun_t *fun, const char *match_id_str,
     int match_score)
 {
-	match_id_t *match_id;
-	
 	assert(fun->bound == false);
 	assert(fun->ftype == fun_inner);
 	
-	match_id = create_match_id();
+	match_id_t *match_id = create_match_id();
 	if (match_id == NULL)
 		return ENOMEM;
@@ -831,4 +818,5 @@
  *
  * Must only be called when the function is bound.
+ *
  */
 int ddf_fun_add_to_category(ddf_fun_t *fun, const char *cat_name)
@@ -842,6 +830,4 @@
 int ddf_driver_main(driver_t *drv)
 {
-	int rc;
-
 	/*
 	 * Remember the driver structure - driver_ops will be called by generic
@@ -858,5 +844,5 @@
 	 */
 	async_set_client_connection(driver_connection);
-	rc = devman_driver_register(driver->name);
+	int rc = devman_driver_register(driver->name);
 	if (rc != EOK) {
 		printf("Error: Failed to register driver with device manager "
@@ -864,5 +850,5 @@
 		    str_error(rc));
 		
-		return 1;
+		return rc;
 	}
 	
@@ -870,10 +856,10 @@
 	rc = task_retval(0);
 	if (rc != EOK)
-		return 1;
-
+		return rc;
+	
 	async_manager();
 	
 	/* Never reached. */
-	return 0;
+	return EOK;
 }
 
Index: uspace/lib/drv/generic/interrupt.c
===================================================================
--- uspace/lib/drv/generic/interrupt.c	(revision 1a23f6ec4a86a9f9b2d79272d9b134a9e00875f8)
+++ uspace/lib/drv/generic/interrupt.c	(revision 2f90b46749b0b0b689233324cb5f2489bd7b57a3)
@@ -117,6 +117,6 @@
 }
 
-static void
-add_interrupt_context(interrupt_context_list_t *list, interrupt_context_t *ctx)
+static void add_interrupt_context(interrupt_context_list_t *list,
+    interrupt_context_t *ctx)
 {
 	fibril_mutex_lock(&list->mutex);
@@ -134,6 +134,6 @@
 }
 
-static interrupt_context_t *
-find_interrupt_context_by_id(interrupt_context_list_t *list, int id)
+static interrupt_context_t *find_interrupt_context_by_id(
+    interrupt_context_list_t *list, int id)
 {
 	interrupt_context_t *ctx;
@@ -153,6 +153,6 @@
 }
 
-static interrupt_context_t *
-find_interrupt_context(interrupt_context_list_t *list, ddf_dev_t *dev, int irq)
+static interrupt_context_t *find_interrupt_context(
+    interrupt_context_list_t *list, ddf_dev_t *dev, int irq)
 {
 	interrupt_context_t *ctx;
@@ -173,7 +173,6 @@
 
 
-int
-register_interrupt_handler(ddf_dev_t *dev, int irq, interrupt_handler_t *handler,
-    irq_code_t *pseudocode)
+int register_interrupt_handler(ddf_dev_t *dev, int irq,
+    interrupt_handler_t *handler, irq_code_t *pseudocode)
 {
 	interrupt_context_t *ctx = create_interrupt_context();
@@ -193,5 +192,5 @@
 		delete_interrupt_context(ctx);
 	}
-
+	
 	return res;
 }
Index: uspace/lib/drv/generic/log.c
===================================================================
--- uspace/lib/drv/generic/log.c	(revision 1a23f6ec4a86a9f9b2d79272d9b134a9e00875f8)
+++ uspace/lib/drv/generic/log.c	(revision 2f90b46749b0b0b689233324cb5f2489bd7b57a3)
@@ -33,11 +33,11 @@
 #include <io/log.h>
 #include <stdarg.h>
-
 #include <ddf/log.h>
 
 /** Initialize the logging system.
  *
- * @param drv_name	Driver name, will be printed as part of message
- * @param level		Minimum message level to print
+ * @param drv_name Driver name, will be printed as part of message
+ * @param level    Minimum message level to print
+ *
  */
 int ddf_log_init(const char *drv_name, log_level_t level)
@@ -48,13 +48,14 @@
 /** Log a driver message.
  *
- * @param level		Message verbosity level. Message is only printed
- *			if verbosity is less than or equal to current
- *			reporting level.
- * @param fmt		Format string (no trailing newline)
+ * @param level Message verbosity level. Message is only printed
+ *              if verbosity is less than or equal to current
+ *              reporting level.
+ * @param fmt   Format string (no trailing newline)
+ *
  */
 void ddf_msg(log_level_t level, const char *fmt, ...)
 {
 	va_list args;
-
+	
 	va_start(args, fmt);
 	log_msgv(level, fmt, args);
Index: uspace/lib/drv/include/ddf/driver.h
===================================================================
--- uspace/lib/drv/include/ddf/driver.h	(revision 1a23f6ec4a86a9f9b2d79272d9b134a9e00875f8)
+++ uspace/lib/drv/include/ddf/driver.h	(revision 2f90b46749b0b0b689233324cb5f2489bd7b57a3)
@@ -81,4 +81,5 @@
 	 */
 	devman_handle_t handle;
+	
 	/** Reference count */
 	atomic_t refcnt;
@@ -104,6 +105,8 @@
 	/** True if bound to the device manager */
 	bool bound;
+	
 	/** Function indentifier (asigned by device manager) */
 	devman_handle_t handle;
+	
 	/** Reference count */
 	atomic_t refcnt;
@@ -114,12 +117,17 @@
 	/** Function type */
 	fun_type_t ftype;
+	
 	/** Function name */
 	const char *name;
+	
 	/** List of device ids for driver matching */
 	match_id_list_t match_ids;
+	
 	/** Driver-specific data associated with this function */
 	void *driver_data;
+	
 	/** Implementation of operations provided by this function */
 	ddf_dev_ops_t *ops;
+	
 	/** Connection handler or @c NULL to use the DDF default handler. */
 	async_client_conn_t conn_handler;
@@ -137,10 +145,14 @@
 	/** Callback method for passing a new device to the device driver */
 	int (*dev_add)(ddf_dev_t *);
+	
 	/** Ask driver to remove a device */
 	int (*dev_remove)(ddf_dev_t *);
+	
 	/** Inform driver a device disappeared */
 	int (*dev_gone)(ddf_dev_t *);
+	
 	/** Ask driver to online a specific function */
 	int (*fun_online)(ddf_fun_t *);
+	
 	/** Ask driver to offline a specific function */
 	int (*fun_offline)(ddf_fun_t *);
Index: uspace/lib/drv/include/ddf/interrupt.h
===================================================================
--- uspace/lib/drv/include/ddf/interrupt.h	(revision 1a23f6ec4a86a9f9b2d79272d9b134a9e00875f8)
+++ uspace/lib/drv/include/ddf/interrupt.h	(revision 2f90b46749b0b0b689233324cb5f2489bd7b57a3)
@@ -42,5 +42,4 @@
 #include <ddi.h>
 #include <fibril_synch.h>
-
 #include "driver.h"
 #include "../dev_iface.h"
Index: uspace/lib/drv/include/ops/hw_res.h
===================================================================
--- uspace/lib/drv/include/ops/hw_res.h	(revision 1a23f6ec4a86a9f9b2d79272d9b134a9e00875f8)
+++ uspace/lib/drv/include/ops/hw_res.h	(revision 2f90b46749b0b0b689233324cb5f2489bd7b57a3)
@@ -39,5 +39,4 @@
 #include <device/hw_res.h>
 #include <sys/types.h>
-
 #include "../ddf/driver.h"
 
Index: uspace/lib/drv/include/ops/nic.h
===================================================================
--- uspace/lib/drv/include/ops/nic.h	(revision 1a23f6ec4a86a9f9b2d79272d9b134a9e00875f8)
+++ uspace/lib/drv/include/ops/nic.h	(revision 2f90b46749b0b0b689233324cb5f2489bd7b57a3)
@@ -40,5 +40,4 @@
 #include <nic/nic.h>
 #include <sys/time.h>
-
 #include "../ddf/driver.h"
 
