Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision 08d9c4e6d721642eed91d99f8760f47351b6aaff)
+++ uspace/srv/devman/devman.c	(revision e85920d25272fb692d6b05b2d26c67cc7f787ed1)
@@ -244,4 +244,5 @@
 node_t * create_root_node()
 {
+	printf(NAME ": create_root_node\n");
 	node_t *node = create_dev_node();
 	if (node) {
@@ -257,4 +258,5 @@
 driver_t * find_best_match_driver(link_t *drivers_list, node_t *node)
 {
+	printf(NAME ": find_best_match_driver\n");
 	driver_t *best_drv = NULL, *drv = NULL;
 	int best_score = 0, score = 0;
@@ -267,5 +269,6 @@
 			best_score = score;
 			best_drv = drv;
-		}		
+		}	
+		link = link->next;
 	}	
 	
@@ -281,4 +284,6 @@
 bool start_driver(driver_t *drv)
 {
+	printf(NAME ": start_driver\n");
+	
 	char *argv[2];
 	
@@ -293,4 +298,5 @@
 	}
 	
+	drv->state = DRIVER_STARTING;
 	return true;
 }
@@ -298,4 +304,6 @@
 bool add_device(driver_t *drv, node_t *node)
 {
+	printf(NAME ": add_device\n");
+	
 	// TODO
 	
@@ -310,7 +318,10 @@
 bool assign_driver(node_t *node, link_t *drivers_list) 
 {
+	printf(NAME ": assign_driver\n");
+	
 	// find the driver which is the most suitable for handling this device
 	driver_t *drv = find_best_match_driver(drivers_list, node);
 	if (NULL == drv) {
+		printf(NAME ": no driver found for device.\n"); 
 		return false;		
 	}
@@ -319,8 +330,10 @@
 	attach_driver(node, drv);
 	
-	if (!drv->running) {
+	if (DRIVER_NOT_STARTED == drv->state) {
 		// start driver
 		start_driver(drv);
-	} else {
+	} 
+	
+	if (DRIVER_RUNNING == drv->state) {
 		// notify driver about new device
 		add_device(drv, node);		
@@ -332,5 +345,5 @@
 bool init_device_tree(dev_tree_t *tree, link_t *drivers_list)
 {
-	printf(NAME ": init_device_tree.");
+	printf(NAME ": init_device_tree.\n");
 	// create root node and add it to the device tree
 	if (NULL == (tree->root_node = create_root_node())) {
Index: uspace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision 08d9c4e6d721642eed91d99f8760f47351b6aaff)
+++ uspace/srv/devman/devman.h	(revision e85920d25272fb692d6b05b2d26c67cc7f787ed1)
@@ -40,4 +40,5 @@
 #include <adt/list.h>
 #include <ipc/ipc.h>
+#include <fibril_synch.h>
 
 #include "util.h"
@@ -74,4 +75,13 @@
 } match_id_list_t;
 
+typedef enum {
+	/** driver has not been started */
+	DRIVER_NOT_STARTED = 0,
+	/** driver has been started, but has not registered as running and ready to receive requests */
+	DRIVER_STARTING,
+	/** driver is running and prepared to serve incomming requests */
+	DRIVER_RUNNING
+} driver_state_t;
+
 /** Representation of device driver.
  */
@@ -79,6 +89,6 @@
 	/** Pointers to previous and next drivers in a linked list */
 	link_t drivers;
-	/** Specifies whether the driver has been started.*/
-	bool running;
+	/** Specifies whether the driver has been started and wheter is running and prepared to receive requests.*/
+	int state;
 	/** Phone asociated with this driver */
 	ipcarg_t phone;
@@ -91,5 +101,15 @@
 	/** Pointer to the linked list of devices controlled by this driver */
 	link_t devices;
+	/** Fibril mutex for this driver - driver state, list of devices, phone.*/
+	fibril_mutex_t driver_mutex;
 } driver_t;
+
+/** The list of drivers. */
+typedef struct driver_list {
+	/** List of drivers */
+	link_t drivers;
+	/** Fibril mutex for list of drivers. */
+	fibril_mutex_t drivers_mutex;	
+} driver_list_t;
 
 /** Representation of a node in the device tree.*/
@@ -101,4 +121,6 @@
 	/** List of child device nodes. */
 	link_t children;
+	/** Fibril mutex for the list of child device nodes of this node. */
+	fibril_mutex_t children_mutex;
 	/** List of device ids for device-to-driver matching.*/
 	match_id_list_t match_ids;
