Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision 667eac45adb7e050c43596b1f6c9786d689d0606)
+++ uspace/srv/devman/devman.c	(revision 58b833c28450decc06c7a346badd4976170e6cda)
@@ -47,6 +47,6 @@
 }
 
-static int
-devman_devices_compare(unsigned long key[], hash_count_t keys, link_t *item)
+static int devman_devices_compare(unsigned long key[], hash_count_t keys,
+    link_t *item)
 {
 	node_t *dev = hash_table_get_instance(item, node_t, devman_link);
@@ -54,6 +54,6 @@
 }
 
-static int
-devmap_devices_compare(unsigned long key[], hash_count_t keys, link_t *item)
+static int devmap_devices_compare(unsigned long key[], hash_count_t keys,
+    link_t *item)
 {
 	node_t *dev = hash_table_get_instance(item, node_t, devmap_link);
@@ -79,8 +79,8 @@
 /** Allocate and initialize a new driver structure.
  *
- * @return		Driver structure.
+ * @return	Driver structure.
  */
 driver_t *create_driver(void)
-{	
+{
 	driver_t *res = malloc(sizeof(driver_t));
 	if (res != NULL)
@@ -91,6 +91,6 @@
 /** Add a driver to the list of drivers.
  *
- * @param drivers_list the list of drivers.
- * @param drv the driver's structure.
+ * @param drivers_list	List of drivers.
+ * @param drv		Driver structure.
  */
 void add_driver(driver_list_t *drivers_list, driver_t *drv)
@@ -99,5 +99,5 @@
 	list_prepend(&drv->drivers, &drivers_list->drivers);
 	fibril_mutex_unlock(&drivers_list->drivers_mutex);
-	
+
 	printf(NAME": the '%s' driver was added to the list of available "
 	    "drivers.\n", drv->name);
@@ -218,7 +218,7 @@
 		    "'%s'.\n", conf_path);
 		goto cleanup;
-	}	
-	
-	if (0 >= read(fd, buf, len)) {
+	}
+	
+	if (read(fd, buf, len) <= 0) {
 		printf(NAME ": unable to read file '%s'.\n", conf_path);
 		goto cleanup;
@@ -231,5 +231,5 @@
 	free(buf);
 	
-	if(opened)
+	if (opened)
 		close(fd);
 	
@@ -270,5 +270,5 @@
 	/* Read the list of match ids from the driver's configuration file. */
 	match_path = get_abs_path(base_path, name, MATCH_EXT);
-	if (NULL == match_path)
+	if (match_path == NULL)
 		goto cleanup;
 	
@@ -279,5 +279,5 @@
 	name_size = str_size(name) + 1;
 	drv->name = malloc(name_size);
-	if (!drv->name)
+	if (drv->name == NULL)
 		goto cleanup;
 	str_cpy(drv->name, name_size, name);
@@ -285,10 +285,10 @@
 	/* Initialize path with driver's binary. */
 	drv->binary_path = get_abs_path(base_path, name, "");
-	if (NULL == drv->binary_path)
+	if (drv->binary_path == NULL)
 		goto cleanup;
 	
 	/* Check whether the driver's binary exists. */
 	struct stat s;
-	if (stat(drv->binary_path, &s) == ENOENT) {
+	if (stat(drv->binary_path, &s) == ENOENT) { /* FIXME!! */
 		printf(NAME ": driver not found at path %s.", drv->binary_path);
 		goto cleanup;
@@ -344,12 +344,15 @@
 /** Create root device node in the device tree.
  *
- * @param tree		The device tree.
- * @return		True on success, false otherwise.
+ * @param tree	The device tree.
+ * @return	True on success, false otherwise.
  */
 bool create_root_node(dev_tree_t *tree)
 {
+	node_t *node;
+
 	printf(NAME ": create_root_node\n");
-	node_t *node = create_dev_node();
-	if (node) {
+
+	node = create_dev_node();
+	if (node != NULL) {
 		insert_dev_node(tree, node, clone_string(""), NULL);
 		match_id_t *id = create_match_id();
@@ -359,4 +362,5 @@
 		tree->root_node = node;
 	}
+
 	return node != NULL;
 }
@@ -391,5 +395,5 @@
 			best_score = score;
 			best_drv = drv;
-		}	
+		}
 		link = link->next;
 	}
@@ -436,5 +440,5 @@
 	
 	int err;
-	if (!task_spawn(drv->binary_path, argv, &err)) {
+	if (task_spawn(drv->binary_path, argv, &err) == 0) {
 		printf(NAME ": error spawning %s, errno = %d\n",
 		    drv->name, err);
@@ -456,17 +460,19 @@
 {
 	driver_t *res = NULL;
+	driver_t *drv = NULL;
+	link_t *link;
 	
 	fibril_mutex_lock(&drv_list->drivers_mutex);
 	
-	driver_t *drv = NULL;
-	link_t *link = drv_list->drivers.next;
-	while (link !=  &drv_list->drivers) {
+	link = drv_list->drivers.next;
+	while (link != &drv_list->drivers) {
 		drv = list_get_instance(link, driver_t, drivers);
-		if (0 == str_cmp(drv->name, drv_name)) {
+		if (str_cmp(drv->name, drv_name) == 0) {
 			res = drv;
 			break;
-		}		
+		}
+
 		link = link->next;
-	}	
+	}
 	
 	fibril_mutex_unlock(&drv_list->drivers_mutex);
@@ -483,5 +489,5 @@
 {
 	fibril_mutex_lock(&driver->driver_mutex);
-	assert(DRIVER_STARTING == driver->state);
+	assert(driver->state == DRIVER_STARTING);
 	driver->phone = phone;
 	fibril_mutex_unlock(&driver->driver_mutex);
@@ -496,11 +502,12 @@
 static void pass_devices_to_driver(driver_t *driver, dev_tree_t *tree)
 {
-	printf(NAME ": pass_devices_to_driver\n");
 	node_t *dev;
 	link_t *link;
-	
-	int phone = ipc_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
-	
-	if (0 < phone) {
+	int phone;
+
+	printf(NAME ": pass_devices_to_driver\n");
+
+	phone = ipc_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
+	if (phone > 0) {
 		
 		link = driver->devices.next;
@@ -549,5 +556,5 @@
 	
 	asprintf(&devmap_name, "%s", node->pathname);
-	if (NULL == devmap_name)
+	if (devmap_name == NULL)
 		return;
 	
@@ -556,5 +563,5 @@
 	asprintf(&devmap_pathname, "%s/%s", DEVMAP_DEVICE_NAMESPACE,
 	    devmap_name);
-	if (NULL == devmap_pathname) {
+	if (devmap_pathname == NULL) {
 		free(devmap_name);
 		return;
@@ -623,5 +630,5 @@
 	 */
 	driver_t *drv = find_best_match_driver(drivers_list, node);
-	if (NULL == drv) {
+	if (drv == NULL) {
 		printf(NAME ": no driver found for device '%s'.\n",
 		    node->pathname);
@@ -632,10 +639,10 @@
 	attach_driver(node, drv);
 	
-	if (DRIVER_NOT_STARTED == drv->state) {
+	if (drv->state == DRIVER_NOT_STARTED) {
 		/* Start the driver. */
 		start_driver(drv);
 	}
 	
-	if (DRIVER_RUNNING == drv->state) {
+	if (drv->state == DRIVER_RUNNING) {
 		/* Notify the driver about the new device. */
 		int phone = ipc_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0);
@@ -687,17 +694,17 @@
 static bool set_dev_path(node_t *node, node_t *parent)
 {
-	assert(NULL != node->name);
+	assert(node->name != NULL);
 	
 	size_t pathsize = (str_size(node->name) + 1);
-	if (NULL != parent)
+	if (parent != NULL)
 		pathsize += str_size(parent->pathname) + 1;
 	
 	node->pathname = (char *) malloc(pathsize);
-	if (NULL == node->pathname) {
+	if (node->pathname == NULL) {
 		printf(NAME ": failed to allocate device path.\n");
 		return false;
 	}
 	
-	if (NULL != parent) {
+	if (parent != NULL) {
 		str_cpy(node->pathname, pathsize, parent->pathname);
 		str_append(node->pathname, pathsize, "/");
@@ -719,11 +726,14 @@
  * @param dev_name	The name of the newly added device.
  * @param parent	The parent device node.
+ *
  * @return		True on success, false otherwise (insufficient resources
  *			etc.).
  */
-bool
-insert_dev_node(dev_tree_t *tree, node_t *node, char *dev_name, node_t *parent)
-{
-	assert(NULL != node && NULL != tree && NULL != dev_name);
+bool insert_dev_node(dev_tree_t *tree, node_t *node, char *dev_name,
+    node_t *parent)
+{
+	assert(node != NULL);
+	assert(tree != NULL);
+	assert(dev_name != NULL);
 	
 	node->name = dev_name;
@@ -740,5 +750,5 @@
 	/* Add the node to the list of its parent's children. */
 	node->parent = parent;
-	if (NULL != parent)
+	if (parent != NULL)
 		list_append(&node->sibling, &parent->children);
 	
@@ -764,9 +774,9 @@
 	char *rel_path = path;
 	char *next_path_elem = NULL;
-	bool cont = '/' == rel_path[0];
-	
-	while (cont && NULL != dev) {
+	bool cont = (rel_path[0] == '/');
+	
+	while (cont && dev != NULL) {
 		next_path_elem  = get_path_elem_end(rel_path + 1);
-		if ('/' == next_path_elem[0]) {
+		if (next_path_elem[0] == '/') {
 			cont = true;
 			next_path_elem[0] = 0;
@@ -807,5 +817,5 @@
 		dev = list_get_instance(link, node_t, sibling);
 		
-		if (0 == str_cmp(name, dev->name))
+		if (str_cmp(name, dev->name) == 0)
 			return dev;
 		
@@ -829,5 +839,5 @@
 	const char *base_name;
 	
-	if (NULL != base_dev_name)
+	if (base_dev_name != NULL)
 		base_name = base_dev_name;
 	else
@@ -853,10 +863,10 @@
  *			with the class.
  */
-dev_class_info_t *
-add_device_to_class(node_t *dev, dev_class_t *cl, const char *base_dev_name)
+dev_class_info_t *add_device_to_class(node_t *dev, dev_class_t *cl,
+    const char *base_dev_name)
 {
 	dev_class_info_t *info = create_dev_class_info();
 	
-	if (NULL != info) {
+	if (info != NULL) {
 		info->dev_class = cl;
 		info->dev = dev;
@@ -883,7 +893,7 @@
 	fibril_rwlock_write_lock(&class_list->rwlock);
 	cl = find_dev_class_no_lock(class_list, class_name);
-	if (NULL == cl) {
+	if (cl == NULL) {
 		cl = create_dev_class();
-		if (NULL != cl) {
+		if (cl != NULL) {
 			cl->name = class_name;
 			cl->base_dev_name = "";
@@ -891,10 +901,11 @@
 		}
 	}
+
 	fibril_rwlock_write_unlock(&class_list->rwlock);
 	return cl;
 }
 
-dev_class_t *
-find_dev_class_no_lock(class_list_t *class_list, const char *class_name)
+dev_class_t *find_dev_class_no_lock(class_list_t *class_list,
+    const char *class_name)
 {
 	dev_class_t *cl;
@@ -903,5 +914,5 @@
 	while (link != &class_list->classes) {
 		cl = list_get_instance(link, dev_class_t, link);
-		if (0 == str_cmp(cl->name, class_name))
+		if (str_cmp(cl->name, class_name) == 0)
 			return cl;
 	}
@@ -929,5 +940,5 @@
 	fibril_rwlock_read_lock(&tree->rwlock);
 	link = hash_table_find(&tree->devmap_devices, &key);
-	if (NULL != link)
+	if (link != NULL)
 		dev = hash_table_get_instance(link, node_t, devmap_link);
 	fibril_rwlock_read_unlock(&tree->rwlock);
@@ -936,6 +947,6 @@
 }
 
-node_t *
-find_devmap_class_device(class_list_t *classes, dev_handle_t devmap_handle)
+node_t *find_devmap_class_device(class_list_t *classes,
+    dev_handle_t devmap_handle)
 {
 	node_t *dev = NULL;
@@ -946,5 +957,5 @@
 	fibril_rwlock_read_lock(&classes->rwlock);
 	link = hash_table_find(&classes->devmap_devices, &key);
-	if (NULL != link) {
+	if (link != NULL) {
 		cli = hash_table_get_instance(link, dev_class_info_t,
 		    devmap_link);
Index: uspace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision 667eac45adb7e050c43596b1f6c9786d689d0606)
+++ uspace/srv/devman/devman.h	(revision 58b833c28450decc06c7a346badd4976170e6cda)
@@ -222,5 +222,6 @@
 } dev_class_t;
 
-/** Provides n-to-m mapping between device nodes and classes - each device may
+/**
+ * Provides n-to-m mapping between device nodes and classes - each device may
  * be register to the arbitrary number of classes and each class may contain
  * the arbitrary number of devices.
@@ -290,5 +291,5 @@
 static inline void init_driver_list(driver_list_t *drv_list)
 {
-	assert(NULL != drv_list);
+	assert(drv_list != NULL);
 	
 	list_initialize(&drv_list->drivers);
@@ -348,5 +349,5 @@
 static inline void delete_driver(driver_t *drv)
 {
-	assert(NULL != drv);
+	assert(drv != NULL);
 	
 	clean_driver(drv);
@@ -382,6 +383,6 @@
 {
 	assert(list_empty(&node->children));
-	assert(NULL == node->parent);
-	assert(NULL == node->drv);
+	assert(node->parent == NULL);
+	assert(node->drv == NULL);
 	
 	clean_match_ids(&node->match_ids);
@@ -399,6 +400,6 @@
  * @return		The device node.
  */
-static inline node_t *
-find_dev_node_no_lock(dev_tree_t *tree, device_handle_t handle)
+static inline node_t *find_dev_node_no_lock(dev_tree_t *tree,
+    device_handle_t handle)
 {
 	unsigned long key = handle;
@@ -413,6 +414,5 @@
  * @return		The device node.
  */
-static inline node_t *
-find_dev_node(dev_tree_t *tree, device_handle_t handle)
+static inline node_t *find_dev_node(dev_tree_t *tree, device_handle_t handle)
 {
 	node_t *node = NULL;
@@ -440,5 +440,5 @@
 /** Create device class.
  *
- * @return		Device class.
+ * @return	Device class.
  */
 static inline dev_class_t *create_dev_class(void)
@@ -447,5 +447,5 @@
 	
 	cl = (dev_class_t *) malloc(sizeof(dev_class_t));
-	if (NULL != cl) {
+	if (cl != NULL) {
 		memset(cl, 0, sizeof(dev_class_t));
 		list_initialize(&cl->devices);
@@ -465,5 +465,5 @@
 	
 	info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
-	if (NULL != info)
+	if (info != NULL)
 		memset(info, 0, sizeof(dev_class_info_t));
 	
@@ -491,6 +491,6 @@
 extern dev_class_t *find_dev_class_no_lock(class_list_t *, const char *);
 
-static inline void
-add_dev_class_no_lock(class_list_t *class_list, dev_class_t *cl)
+static inline void add_dev_class_no_lock(class_list_t *class_list,
+    dev_class_t *cl)
 {
 	list_append(&cl->link, &class_list->classes);
@@ -503,6 +503,6 @@
 extern node_t *find_devmap_class_device(class_list_t *, dev_handle_t);
 
-static inline void
-class_add_devmap_device(class_list_t *class_list, dev_class_info_t *cli)
+static inline void class_add_devmap_device(class_list_t *class_list,
+    dev_class_info_t *cli)
 {
 	unsigned long key = (unsigned long) cli->devmap_handle;
