Index: uspace/lib/usb/src/debug.c
===================================================================
--- uspace/lib/usb/src/debug.c	(revision 1efe89b1e7ca890cc3565fca0d6e6e03e52481e1)
+++ uspace/lib/usb/src/debug.c	(revision fcc525d1eff9d820732245a991f6cf99dcba9945)
@@ -31,5 +31,5 @@
  */
 /** @file
- * @brief Debugging support.
+ * Debugging and logging support.
  */
 #include <adt/list.h>
@@ -40,126 +40,16 @@
 #include <usb/debug.h>
 
-/** Debugging tag. */
-typedef struct {
-	/** Linked list member. */
-	link_t link;
-	/** Tag name.
-	 * We always have a private copy of the name.
-	 */
-	char *tag;
-	/** Enabled level of debugging. */
-	int level;
-} usb_debug_tag_t;
-
-/** Get instance of usb_debug_tag_t from link_t. */
-#define USB_DEBUG_TAG_INSTANCE(iterator) \
-	list_get_instance(iterator, usb_debug_tag_t, link)
-
-/** List of all known tags. */
-static LIST_INITIALIZE(tag_list);
-/** Mutex guard for the list of all tags. */
-static FIBRIL_MUTEX_INITIALIZE(tag_list_guard);
-
 /** Level of logging messages. */
 static usb_log_level_t log_level = USB_LOG_LEVEL_WARNING;
+
 /** Prefix for logging messages. */
 static const char *log_prefix = "usb";
+
 /** Serialization mutex for logging functions. */
 static FIBRIL_MUTEX_INITIALIZE(log_serializer);
+
+/** File where to store the log. */
 static FILE *log_stream = NULL;
 
-/** Find or create new tag with given name.
- *
- * @param tagname Tag name.
- * @return Debug tag structure.
- * @retval NULL Out of memory.
- */
-static usb_debug_tag_t *get_tag(const char *tagname)
-{
-	link_t *link;
-	for (link = tag_list.next; \
-	    link != &tag_list; \
-	    link = link->next) {
-		usb_debug_tag_t *tag = USB_DEBUG_TAG_INSTANCE(link);
-		if (str_cmp(tag->tag, tagname) == 0) {
-			return tag;
-		}
-	}
-
-	/*
-	 * Tag not found, we will create a new one.
-	 */
-	usb_debug_tag_t *new_tag = malloc(sizeof(usb_debug_tag_t));
-	int rc = asprintf(&new_tag->tag, "%s", tagname);
-	if (rc < 0) {
-		free(new_tag);
-		return NULL;
-	}
-	list_initialize(&new_tag->link);
-	new_tag->level = 1;
-
-	/*
-	 * Append it to the end of known tags.
-	 */
-	list_append(&new_tag->link, &tag_list);
-
-	return new_tag;
-}
-
-/** Print debugging information.
- * If the tag is used for the first time, its structures are automatically
- * created and initial verbosity level is set to 1.
- *
- * @param tagname Tag name.
- * @param level Level (verbosity) of the message.
- * @param format Formatting string for printf().
- */
-void usb_dprintf(const char *tagname, int level, const char *format, ...)
-{
-	fibril_mutex_lock(&tag_list_guard);
-	usb_debug_tag_t *tag = get_tag(tagname);
-	if (tag == NULL) {
-		printf("USB debug: FATAL ERROR - failed to create tag.\n");
-		goto leave;
-	}
-
-	if (tag->level < level) {
-		goto leave;
-	}
-
-	va_list args;
-	va_start(args, format);
-
-	printf("[%s:%d]: ", tagname, level);
-	vprintf(format, args);
-
-	va_end(args);
-
-leave:
-	fibril_mutex_unlock(&tag_list_guard);
-}
-
-/** Enable debugging prints for given tag.
- *
- * Setting level to <i>n</i> will cause that only printing messages
- * with level lower or equal to <i>n</i> will be printed.
- *
- * @param tagname Tag name.
- * @param level Enabled level.
- */
-void usb_dprintf_enable(const char *tagname, int level)
-{
-	fibril_mutex_lock(&tag_list_guard);
-	usb_debug_tag_t *tag = get_tag(tagname);
-	if (tag == NULL) {
-		printf("USB debug: FATAL ERROR - failed to create tag.\n");
-		goto leave;
-	}
-
-	tag->level = level;
-
-leave:
-	fibril_mutex_unlock(&tag_list_guard);
-}
 
 /** Enable logging.
@@ -182,5 +72,9 @@
 }
 
-
+/** Get log level name prefix.
+ *
+ * @param level Log level.
+ * @return String prefix for the message.
+ */
 static const char *log_level_name(usb_log_level_t level)
 {
@@ -256,6 +150,12 @@
 /* string + terminator + number width (enough for 4GB)*/
 #define REMAINDER_STR_LEN (5 + 1 + 10)
+
+/** How many bytes to group together. */
 #define BUFFER_DUMP_GROUP_SIZE 4
+
+/** Size of the string for buffer dumps. */
 #define BUFFER_DUMP_LEN 240 /* Ought to be enough for everybody ;-). */
+
+/** Fibril local storage for the dumped buffer. */
 static fibril_local char buffer_dump[BUFFER_DUMP_LEN];
 
@@ -265,5 +165,5 @@
  * in a static fibril local string.
  * That means that you do not have to deallocate the string (actually, you
- * can not do that) and you do not have to save it agains concurrent
+ * can not do that) and you do not have to guard it against concurrent
  * calls to it.
  * The only limitation is that each call rewrites the buffer again.
