Index: uspace/drv/bus/usb/usbhid/generic/hiddev.c
===================================================================
--- uspace/drv/bus/usb/usbhid/generic/hiddev.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/generic/hiddev.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -48,5 +48,5 @@
 /*----------------------------------------------------------------------------*/
 
-usb_endpoint_description_t usb_hid_generic_poll_endpoint_description = {
+const usb_endpoint_description_t usb_hid_generic_poll_endpoint_description = {
 	.transfer_type = USB_TRANSFER_INTERRUPT,
 	.direction = USB_DIRECTION_IN,
Index: uspace/drv/bus/usb/usbhid/generic/hiddev.h
===================================================================
--- uspace/drv/bus/usb/usbhid/generic/hiddev.h	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/generic/hiddev.h	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -41,5 +41,6 @@
 struct usb_hid_dev;
 
-usb_endpoint_description_t usb_hid_generic_poll_endpoint_description;
+extern const usb_endpoint_description_t
+    usb_hid_generic_poll_endpoint_description;
 
 const char *HID_GENERIC_FUN_NAME;
Index: uspace/drv/bus/usb/usbhid/kbd/kbddev.c
===================================================================
--- uspace/drv/bus/usb/usbhid/kbd/kbddev.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/kbd/kbddev.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -88,5 +88,5 @@
 
 /** Keyboard polling endpoint description for boot protocol class. */
-usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = {
+const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = {
 	.transfer_type = USB_TRANSFER_INTERRUPT,
 	.direction = USB_DIRECTION_IN,
@@ -237,33 +237,33 @@
 
 	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    hid_dev->report, NULL, kbd_dev->led_path, 
+	    &hid_dev->report, NULL, kbd_dev->led_path,
 	    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
 	    USB_HID_REPORT_TYPE_OUTPUT);
 
 	while (field != NULL) {
-		
-		if ((field->usage == USB_HID_LED_NUM_LOCK) 
+
+		if ((field->usage == USB_HID_LED_NUM_LOCK)
 		    && (kbd_dev->mods & KM_NUM_LOCK)){
 			field->value = 1;
 		}
 
-		if ((field->usage == USB_HID_LED_CAPS_LOCK) 
+		if ((field->usage == USB_HID_LED_CAPS_LOCK)
 		    && (kbd_dev->mods & KM_CAPS_LOCK)){
 			field->value = 1;
 		}
 
-		if ((field->usage == USB_HID_LED_SCROLL_LOCK) 
+		if ((field->usage == USB_HID_LED_SCROLL_LOCK)
 		    && (kbd_dev->mods & KM_SCROLL_LOCK)){
 			field->value = 1;
 		}
-		
-		field = usb_hid_report_get_sibling(hid_dev->report, field,
-		    kbd_dev->led_path,  
-	    	USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-			USB_HID_REPORT_TYPE_OUTPUT);
+
+		field = usb_hid_report_get_sibling(
+		    &hid_dev->report, field, kbd_dev->led_path,
+		USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
+		    USB_HID_REPORT_TYPE_OUTPUT);
 	}
 
 	// TODO: what about the Report ID?
-	int rc = usb_hid_report_output_translate(hid_dev->report, 0,
+	int rc = usb_hid_report_output_translate(&hid_dev->report, 0,
 	    kbd_dev->output_buffer, kbd_dev->output_size);
 
@@ -432,5 +432,4 @@
 static void usb_kbd_process_data(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev)
 {
-	assert(hid_dev->report != NULL);
 	assert(hid_dev != NULL);
 	assert(kbd_dev != NULL);
@@ -444,6 +443,6 @@
 
 	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    hid_dev->report, NULL, path, 
-	    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
+	    &hid_dev->report, NULL, path,
+	    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
 	    USB_HID_REPORT_TYPE_INPUT);
 	unsigned i = 0;
@@ -454,5 +453,5 @@
 		
 		assert(i < kbd_dev->key_count);
-		
+
 		// save the key usage
 		if (field->value != 0) {
@@ -463,9 +462,9 @@
 		}
 		usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]);
-		
+
 		++i;
-		field = usb_hid_report_get_sibling(hid_dev->report, field, path, 
-		    USB_HID_PATH_COMPARE_END 
-		    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
+		field = usb_hid_report_get_sibling(
+		    &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
+		        | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
 		    USB_HID_REPORT_TYPE_INPUT);
 	}
@@ -616,10 +615,10 @@
 
 	kbd_dev->key_count = usb_hid_report_size(
-	    hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT); 
+	    &hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);
 	usb_hid_report_path_free(path);
 
 	usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count);
 
-	kbd_dev->keys = (int32_t *)calloc(kbd_dev->key_count, sizeof(int32_t));
+	kbd_dev->keys = calloc(kbd_dev->key_count, sizeof(int32_t));
 
 	if (kbd_dev->keys == NULL) {
@@ -643,5 +642,5 @@
 	 */
 	kbd_dev->output_size = 0;
-	kbd_dev->output_buffer = usb_hid_report_output(hid_dev->report, 
+	kbd_dev->output_buffer = usb_hid_report_output(&hid_dev->report,
 	    &kbd_dev->output_size, 0);
 	if (kbd_dev->output_buffer == NULL) {
@@ -657,6 +656,6 @@
 	    kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0);
 
-	kbd_dev->led_output_size = usb_hid_report_size(hid_dev->report, 
-	    0, USB_HID_REPORT_TYPE_OUTPUT);
+	kbd_dev->led_output_size = usb_hid_report_size(
+	    &hid_dev->report, 0, USB_HID_REPORT_TYPE_OUTPUT);
 
 	usb_log_debug("Output report size (in items): %zu\n", 
@@ -826,6 +825,6 @@
 int usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev)
 {
-	int rc = usb_hid_parse_report_descriptor(hid_dev->report, 
-	    USB_KBD_BOOT_REPORT_DESCRIPTOR, 
+	int rc = usb_hid_parse_report_descriptor(
+	    &hid_dev->report, USB_KBD_BOOT_REPORT_DESCRIPTOR,
 	    USB_KBD_BOOT_REPORT_DESCRIPTOR_SIZE);
 
@@ -836,5 +835,5 @@
 	}
 
-	rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 
+	rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe,
 	    hid_dev->usb_dev->interface_no, USB_HID_PROTOCOL_BOOT);
 
Index: uspace/drv/bus/usb/usbhid/kbd/kbddev.h
===================================================================
--- uspace/drv/bus/usb/usbhid/kbd/kbddev.h	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/kbd/kbddev.h	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -118,5 +118,5 @@
 /*----------------------------------------------------------------------------*/
 
-usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description;
+extern const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description;
 
 const char *HID_KBD_FUN_NAME;
Index: uspace/drv/bus/usb/usbhid/main.c
===================================================================
--- uspace/drv/bus/usb/usbhid/main.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/main.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -92,5 +92,5 @@
 	if (rc != EOK) {
 		usb_log_error("Failed to initialize USB/HID device.\n");
-		usb_hid_destroy(hid_dev);
+		usb_hid_deinit(hid_dev);
 		return rc;
 	}
@@ -128,9 +128,8 @@
 		usb_log_error("Failed to start polling fibril for `%s'.\n",
 		    dev->ddf_dev->name);
-		usb_hid_destroy(hid_dev);
+		usb_hid_deinit(hid_dev);
 		return rc;
 	}
 	hid_dev->running = true;
-	dev->driver_data = hid_dev;
 
 	/*
@@ -204,5 +203,5 @@
 
 	assert(!hid_dev->running);
-	usb_hid_destroy(hid_dev);
+	usb_hid_deinit(hid_dev);
 	usb_log_debug2("%s destruction complete.\n", dev->ddf_dev->name);
 	return EOK;
Index: uspace/drv/bus/usb/usbhid/mouse/mousedev.c
===================================================================
--- uspace/drv/bus/usb/usbhid/mouse/mousedev.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/mouse/mousedev.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -59,5 +59,5 @@
 /*----------------------------------------------------------------------------*/
 
-usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
+const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
 	.transfer_type = USB_TRANSFER_INTERRUPT,
 	.direction = USB_DIRECTION_IN,
@@ -268,12 +268,13 @@
 
 	int shift_x = get_mouse_axis_move_value(hid_dev->report_id,
-	    hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_X);
+	    &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_X);
 	int shift_y = get_mouse_axis_move_value(hid_dev->report_id,
-	    hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_Y);
+	    &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_Y);
 	int wheel = get_mouse_axis_move_value(hid_dev->report_id,
-	    hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
+	    &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
 
 	if ((shift_x != 0) || (shift_y != 0)) {
-		async_exch_t *exch = async_exchange_begin(mouse_dev->mouse_sess);
+		async_exch_t *exch =
+		    async_exchange_begin(mouse_dev->mouse_sess);
 		async_req_2_0(exch, MOUSEEV_MOVE_EVENT, shift_x, shift_y);
 		async_exchange_end(exch);
@@ -291,7 +292,6 @@
 
 	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END
-	    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
-	    USB_HID_REPORT_TYPE_INPUT);
+	    &hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END
+	    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, USB_HID_REPORT_TYPE_INPUT);
 
 	while (field != NULL) {
@@ -314,12 +314,12 @@
 			async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, field->usage, 0);
 			async_exchange_end(exch);
-			
+
 			mouse_dev->buttons[field->usage - field->usage_minimum] =
 			   field->value;
 		}
-		
+
 		field = usb_hid_report_get_sibling(
-		    hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
-		    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
+		    &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
+		    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
 		    USB_HID_REPORT_TYPE_INPUT);
 	}
@@ -474,6 +474,6 @@
 	// that the current solution is good enough.
 	/* Adding 1 because we will be accessing buttons[highest]. */
-	mouse_dev->buttons_count = usb_mouse_get_highest_button(hid_dev->report,
-	    hid_dev->report_id) + 1;
+	mouse_dev->buttons_count = 1 + usb_mouse_get_highest_button(
+	    &hid_dev->report, hid_dev->report_id);
 	mouse_dev->buttons = calloc(mouse_dev->buttons_count, sizeof(int32_t));
 
@@ -532,6 +532,6 @@
 int usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev)
 {
-	int rc = usb_hid_parse_report_descriptor(hid_dev->report, 
-	    USB_MOUSE_BOOT_REPORT_DESCRIPTOR, 
+	int rc = usb_hid_parse_report_descriptor(
+	    &hid_dev->report, USB_MOUSE_BOOT_REPORT_DESCRIPTOR,
 	    USB_MOUSE_BOOT_REPORT_DESCRIPTOR_SIZE);
 
@@ -542,5 +542,5 @@
 	}
 
-	rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 
+	rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe,
 	    hid_dev->usb_dev->interface_no, USB_HID_PROTOCOL_BOOT);
 
Index: uspace/drv/bus/usb/usbhid/mouse/mousedev.h
===================================================================
--- uspace/drv/bus/usb/usbhid/mouse/mousedev.h	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/mouse/mousedev.h	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -63,5 +63,5 @@
 /*----------------------------------------------------------------------------*/
 
-usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description;
+extern const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description;
 
 const char *HID_MOUSE_FUN_NAME;
Index: uspace/drv/bus/usb/usbhid/multimedia/multimedia.c
===================================================================
--- uspace/drv/bus/usb/usbhid/multimedia/multimedia.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/multimedia/multimedia.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -161,10 +161,15 @@
 /*----------------------------------------------------------------------------*/
 
-static int usb_multimedia_create_function(usb_hid_dev_t *hid_dev, 
-    usb_multimedia_t *multim_dev)
-{
+int usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data)
+{
+	if (hid_dev == NULL || hid_dev->usb_dev == NULL) {
+		return EINVAL; /*! @todo Other return code? */
+	}
+
+	usb_log_debug(NAME " Initializing HID/multimedia structure...\n");
+
 	/* Create the exposed function. */
-	ddf_fun_t *fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed, 
-	    NAME);
+	ddf_fun_t *fun = ddf_fun_create(
+	    hid_dev->usb_dev->ddf_dev, fun_exposed, NAME);
 	if (fun == NULL) {
 		usb_log_error("Could not create DDF function node.\n");
@@ -173,5 +178,16 @@
 
 	fun->ops = &multimedia_ops;
-	fun->driver_data = multim_dev;   // TODO: maybe change to hid_dev->data
+
+	usb_multimedia_t *multim_dev =
+	    ddf_fun_data_alloc(fun, sizeof(usb_multimedia_t));
+	if (multim_dev == NULL) {
+		ddf_fun_destroy(fun);
+		return ENOMEM;
+	}
+
+	multim_dev->console_sess = NULL;
+	multim_dev->fun = fun;
+
+	//todo Autorepeat?
 
 	int rc = ddf_fun_bind(fun);
@@ -194,40 +210,9 @@
 		return rc;
 	}
-	multim_dev->fun = fun;
-
-	return EOK;
-}
-
-/*----------------------------------------------------------------------------*/
-
-int usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data)
-{
-	if (hid_dev == NULL || hid_dev->usb_dev == NULL) {
-		return EINVAL; /*! @todo Other return code? */
-	}
-
-	usb_log_debug(NAME " Initializing HID/multimedia structure...\n");
-
-	usb_multimedia_t *multim_dev = (usb_multimedia_t *)malloc(
-	    sizeof(usb_multimedia_t));
-	if (multim_dev == NULL) {
-		return ENOMEM;
-	}
-
-	multim_dev->console_sess = NULL;
-
-	/*! @todo Autorepeat */
-
-	// save the KBD device structure into the HID device structure
+
+	/* Save the KBD device structure into the HID device structure. */
 	*data = multim_dev;
 
-	usb_log_debug(NAME " HID/multimedia device structure initialized.\n");
-
-	int rc = usb_multimedia_create_function(hid_dev, multim_dev);
-	if (rc != EOK)
-		return rc;
-
 	usb_log_debug(NAME " HID/multimedia structure initialized.\n");
-
 	return EOK;
 }
@@ -272,6 +257,6 @@
 
 	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END 
-	    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
+	    &hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END
+	    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
 	    USB_HID_REPORT_TYPE_INPUT);
 
@@ -293,5 +278,5 @@
 
 		field = usb_hid_report_get_sibling(
-		    hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
+		    &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
 		    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
 		    USB_HID_REPORT_TYPE_INPUT);
Index: uspace/drv/bus/usb/usbhid/subdrivers.c
===================================================================
--- uspace/drv/bus/usb/usbhid/subdrivers.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/subdrivers.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -42,16 +42,16 @@
 #include "generic/hiddev.h"
 
-static usb_hid_subdriver_usage_t path_kbd[] = {
-	{USB_HIDUT_PAGE_GENERIC_DESKTOP, 
-	 USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYBOARD}, 
+static const usb_hid_subdriver_usage_t path_kbd[] = {
+	{USB_HIDUT_PAGE_GENERIC_DESKTOP,
+	 USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYBOARD},
 	{0, 0}
 };
 
-static usb_hid_subdriver_usage_t path_mouse[] = {
+static const usb_hid_subdriver_usage_t path_mouse[] = {
 	{USB_HIDUT_PAGE_GENERIC_DESKTOP, USB_HIDUT_USAGE_GENERIC_DESKTOP_MOUSE},
 	{0, 0}
 };
 
-static usb_hid_subdriver_usage_t multim_key_path[] = {
+static const usb_hid_subdriver_usage_t multim_key_path[] = {
 	{USB_HIDUT_PAGE_CONSUMER, USB_HIDUT_USAGE_CONSUMER_CONSUMER_CONTROL},
 	{0, 0}
@@ -71,5 +71,4 @@
 			.poll_end = NULL
 		},
-		
 	},
 	{
@@ -102,4 +101,7 @@
 };
 
+const int USB_HID_MAX_SUBDRIVERS =
+    sizeof(usb_hid_subdrivers) / sizeof(usb_hid_subdrivers[0]);
+
 /**
  * @}
Index: uspace/drv/bus/usb/usbhid/subdrivers.h
===================================================================
--- uspace/drv/bus/usb/usbhid/subdrivers.h	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/subdrivers.h	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -78,5 +78,5 @@
 
 	/** Subdriver for controlling this device. */
-	usb_hid_subdriver_t subdriver;
+	const usb_hid_subdriver_t subdriver;
 } usb_hid_subdriver_mapping_t;
 
@@ -84,4 +84,5 @@
 
 extern const usb_hid_subdriver_mapping_t usb_hid_subdrivers[];
+extern const int USB_HID_MAX_SUBDRIVERS;
 
 /*----------------------------------------------------------------------------*/
Index: uspace/drv/bus/usb/usbhid/usbhid.c
===================================================================
--- uspace/drv/bus/usb/usbhid/usbhid.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/usbhid.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -54,5 +54,5 @@
 
 /* Array of endpoints expected on the device, NULL terminated. */
-usb_endpoint_description_t *usb_hid_endpoints[] = {
+const usb_endpoint_description_t *usb_hid_endpoints[] = {
 	&usb_hid_kbd_poll_endpoint_description,
 	&usb_hid_mouse_poll_endpoint_description,
@@ -61,35 +61,18 @@
 };
 
-static const int USB_HID_MAX_SUBDRIVERS = 10;
-
 /*----------------------------------------------------------------------------*/
 
 static int usb_hid_set_boot_kbd_subdriver(usb_hid_dev_t *hid_dev)
 {
-	assert(hid_dev != NULL && hid_dev->subdriver_count == 0);
-
-	hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc(
-	    sizeof(usb_hid_subdriver_t));
+	assert(hid_dev != NULL);
+	assert(hid_dev->subdriver_count == 0);
+
+	hid_dev->subdrivers = malloc(sizeof(usb_hid_subdriver_t));
 	if (hid_dev->subdrivers == NULL) {
 		return ENOMEM;
 	}
-
-	assert(hid_dev->subdriver_count >= 0);
-
-	// set the init callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].init = usb_kbd_init;
-
-	// set the polling callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].poll = 
-	    usb_kbd_polling_callback;
-
-	// set the polling ended callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].poll_end = NULL;
-
-	// set the deinit callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].deinit = usb_kbd_deinit;
-
-	// set subdriver count
-	++hid_dev->subdriver_count;
+	hid_dev->subdriver_count = 1;
+	// TODO 0 should be keyboard, but find a better way
+	hid_dev->subdrivers[0] = usb_hid_subdrivers[0].subdriver;
 
 	return EOK;
@@ -100,29 +83,14 @@
 static int usb_hid_set_boot_mouse_subdriver(usb_hid_dev_t *hid_dev)
 {
-	assert(hid_dev != NULL && hid_dev->subdriver_count == 0);
-
-	hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc(
-	    sizeof(usb_hid_subdriver_t));
+	assert(hid_dev != NULL);
+	assert(hid_dev->subdriver_count == 0);
+
+	hid_dev->subdrivers = malloc(sizeof(usb_hid_subdriver_t));
 	if (hid_dev->subdrivers == NULL) {
 		return ENOMEM;
 	}
-
-	assert(hid_dev->subdriver_count >= 0);
-
-	// set the init callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].init = usb_mouse_init;
-
-	// set the polling callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].poll = 
-	    usb_mouse_polling_callback;
-
-	// set the polling ended callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].poll_end = NULL;
-
-	// set the deinit callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].deinit = usb_mouse_deinit;
-
-	// set subdriver count
-	++hid_dev->subdriver_count;
+	hid_dev->subdriver_count = 1;
+	// TODO 2 should be mouse, but find a better way
+	hid_dev->subdrivers[2] = usb_hid_subdrivers[0].subdriver;
 
 	return EOK;
@@ -135,29 +103,15 @@
 	assert(hid_dev != NULL && hid_dev->subdriver_count == 0);
 
-	hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc(
-	    sizeof(usb_hid_subdriver_t));
+	hid_dev->subdrivers = malloc(sizeof(usb_hid_subdriver_t));
 	if (hid_dev->subdrivers == NULL) {
 		return ENOMEM;
 	}
-
-	assert(hid_dev->subdriver_count >= 0);
-
-	// set the init callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].init =
-	    usb_generic_hid_init;
-
-	// set the polling callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].poll = 
-	    usb_generic_hid_polling_callback;
-
-	// set the polling ended callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].poll_end = NULL;
-
-	// set the deinit callback
-	hid_dev->subdrivers[hid_dev->subdriver_count].deinit =
-	    usb_generic_hid_deinit;
-
-	// set subdriver count
-	++hid_dev->subdriver_count;
+	hid_dev->subdriver_count = 1;
+
+	/* Set generic hid subdriver routines */
+	hid_dev->subdrivers[0].init = usb_generic_hid_init;
+	hid_dev->subdrivers[0].poll = usb_generic_hid_polling_callback;
+	hid_dev->subdrivers[0].poll_end = NULL;
+	hid_dev->subdrivers[0].deinit = usb_generic_hid_deinit;
 
 	return EOK;
@@ -166,5 +120,5 @@
 /*----------------------------------------------------------------------------*/
 
-static bool usb_hid_ids_match(usb_hid_dev_t *hid_dev, 
+static bool usb_hid_ids_match(const usb_hid_dev_t *hid_dev,
     const usb_hid_subdriver_mapping_t *mapping)
 {
@@ -172,5 +126,5 @@
 	assert(hid_dev->usb_dev != NULL);
 
-	return (hid_dev->usb_dev->descriptors.device.vendor_id 
+	return (hid_dev->usb_dev->descriptors.device.vendor_id
 	    == mapping->vendor_id
 	    && hid_dev->usb_dev->descriptors.device.product_id 
@@ -180,5 +134,5 @@
 /*----------------------------------------------------------------------------*/
 
-static bool usb_hid_path_matches(usb_hid_dev_t *hid_dev, 
+static bool usb_hid_path_matches(usb_hid_dev_t *hid_dev,
     const usb_hid_subdriver_mapping_t *mapping)
 {
@@ -192,8 +146,8 @@
 	}
 	int i = 0;
-	while (mapping->usage_path[i].usage != 0 
+	while (mapping->usage_path[i].usage != 0
 	    || mapping->usage_path[i].usage_page != 0) {
-		if (usb_hid_report_path_append_item(usage_path, 
-		    mapping->usage_path[i].usage_page, 
+		if (usb_hid_report_path_append_item(usage_path,
+		    mapping->usage_path[i].usage_page,
 		    mapping->usage_path[i].usage) != EOK) {
 			usb_log_debug("Failed to append to usage path.\n");
@@ -204,6 +158,4 @@
 	}
 
-	assert(hid_dev->report != NULL);
-
 	usb_log_debug("Compare flags: %d\n", mapping->compare);
 
@@ -213,5 +165,5 @@
 	do {
 		usb_log_debug("Trying report id %u\n", report_id);
-		
+
 		if (report_id != 0) {
 			usb_hid_report_path_set_report_id(usage_path,
@@ -220,8 +172,7 @@
 
 		usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-		    hid_dev->report,
-		    NULL, usage_path, mapping->compare, 
+		    &hid_dev->report, NULL, usage_path, mapping->compare,
 		    USB_HID_REPORT_TYPE_INPUT);
-		
+
 		usb_log_debug("Field: %p\n", field);
 
@@ -230,8 +181,7 @@
 			break;
 		}
-		
+
 		report_id = usb_hid_get_next_report_id(
-		    hid_dev->report, report_id,
-		    USB_HID_REPORT_TYPE_INPUT);
+		    &hid_dev->report, report_id, USB_HID_REPORT_TYPE_INPUT);
 	} while (!matches && report_id != 0);
 
@@ -243,5 +193,5 @@
 /*----------------------------------------------------------------------------*/
 
-static int usb_hid_save_subdrivers(usb_hid_dev_t *hid_dev, 
+static int usb_hid_save_subdrivers(usb_hid_dev_t *hid_dev,
     const usb_hid_subdriver_t **subdrivers, int count)
 {
@@ -254,8 +204,6 @@
 	}
 
-	// add one generic HID subdriver per device
-
-	hid_dev->subdrivers = (usb_hid_subdriver_t *)malloc((count + 1) * 
-	    sizeof(usb_hid_subdriver_t));
+	/* +1 for generic hid subdriver */
+	hid_dev->subdrivers = calloc((count + 1), sizeof(usb_hid_subdriver_t));
 	if (hid_dev->subdrivers == NULL) {
 		return ENOMEM;
@@ -269,4 +217,5 @@
 	}
 
+	/* Add one generic HID subdriver per device */
 	hid_dev->subdrivers[count].init = usb_generic_hid_init;
 	hid_dev->subdrivers[count].poll = usb_generic_hid_polling_callback;
@@ -307,8 +256,8 @@
 			return EINVAL;
 		}
-		
+
 		ids_matched = false;
 		matched = false;
-		
+
 		if (mapping->vendor_id >= 0) {
 			assert(mapping->product_id >= 0);
@@ -321,5 +270,5 @@
 			}
 		}
-		
+
 		if (mapping->usage_path != NULL) {
 			usb_log_debug("Comparing device against usage path.\n");
@@ -332,14 +281,16 @@
 			matched = ids_matched;
 		}
-		
+
 		if (matched) {
 			usb_log_debug("Subdriver matched.\n");
 			subdrivers[count++] = &mapping->subdriver;
 		}
-		
+
 		mapping = &usb_hid_subdrivers[++i];
 	}
 
-	// we have all subdrivers determined, save them into the hid device
+	/* We have all subdrivers determined, save them into the hid device */
+	// TODO Dowe really need this complicated stuff if there is
+	// max_subdrivers limitation?
 	return usb_hid_save_subdrivers(hid_dev, subdrivers, count);
 }
@@ -347,9 +298,8 @@
 /*----------------------------------------------------------------------------*/
 
-static int usb_hid_check_pipes(usb_hid_dev_t *hid_dev, usb_device_t *dev)
-{
-	assert(hid_dev != NULL && dev != NULL);
-
-	int rc = EOK;
+static int usb_hid_check_pipes(usb_hid_dev_t *hid_dev, const usb_device_t *dev)
+{
+	assert(hid_dev);
+	assert(dev);
 
 	if (dev->pipes[USB_HID_KBD_POLL_EP_NO].present) {
@@ -368,8 +318,8 @@
 		usb_log_error("None of supported endpoints found - probably"
 		    " not a supported device.\n");
-		rc = ENOTSUP;
-	}
-
-	return rc;
+		return ENOTSUP;
+	}
+
+	return EOK;
 }
 
@@ -378,19 +328,18 @@
 static int usb_hid_init_report(usb_hid_dev_t *hid_dev)
 {
-	assert(hid_dev != NULL && hid_dev->report != NULL);
+	assert(hid_dev != NULL);
 
 	uint8_t report_id = 0;
-	size_t size;
-
 	size_t max_size = 0;
 
 	do {
 		usb_log_debug("Getting size of the report.\n");
-		size = usb_hid_report_byte_size(hid_dev->report, report_id, 
-		    USB_HID_REPORT_TYPE_INPUT);
+		const size_t size =
+		    usb_hid_report_byte_size(&hid_dev->report, report_id,
+		        USB_HID_REPORT_TYPE_INPUT);
 		usb_log_debug("Report ID: %u, size: %zu\n", report_id, size);
 		max_size = (size > max_size) ? size : max_size;
 		usb_log_debug("Getting next report ID\n");
-		report_id = usb_hid_get_next_report_id(hid_dev->report, 
+		report_id = usb_hid_get_next_report_id(&hid_dev->report,
 		    report_id, USB_HID_REPORT_TYPE_INPUT);
 	} while (report_id != 0);
@@ -398,12 +347,11 @@
 	usb_log_debug("Max size of input report: %zu\n", max_size);
 
-	hid_dev->max_input_report_size = max_size;
 	assert(hid_dev->input_report == NULL);
 
-	hid_dev->input_report = malloc(max_size);
+	hid_dev->input_report = calloc(1, max_size);
 	if (hid_dev->input_report == NULL) {
 		return ENOMEM;
 	}
-	memset(hid_dev->input_report, 0, max_size);
+	hid_dev->max_input_report_size = max_size;
 
 	return EOK;
@@ -430,11 +378,5 @@
 	}
 
-	hid_dev->report = (usb_hid_report_t *)(malloc(sizeof(
-	    usb_hid_report_t)));
-	if (hid_dev->report == NULL) {
-		usb_log_error("No memory!\n");
-		return ENOMEM;
-	}
-	usb_hid_report_init(hid_dev->report);
+	usb_hid_report_init(&hid_dev->report);
 
 	/* The USB device should already be initialized, save it in structure */
@@ -446,8 +388,8 @@
 		return rc;
 	}
-		
+
 	/* Get the report descriptor and parse it. */
-	rc = usb_hid_process_report_descriptor(hid_dev->usb_dev, 
-	    hid_dev->report, &hid_dev->report_desc, &hid_dev->report_desc_size);
+	rc = usb_hid_process_report_descriptor(hid_dev->usb_dev,
+	    &hid_dev->report, &hid_dev->report_desc, &hid_dev->report_desc_size);
 
 	bool fallback = false;
@@ -488,7 +430,7 @@
 			break;
 		default:
-			assert(hid_dev->poll_pipe_index 
+			assert(hid_dev->poll_pipe_index
 			    == USB_HID_GENERIC_POLL_EP_NO);
-			
+
 			usb_log_info("Falling back to generic HID driver.\n");
 			rc = usb_hid_set_generic_hid_subdriver(hid_dev);
@@ -499,13 +441,12 @@
 		usb_log_error("No subdriver for handling this device could be"
 		    " initialized: %s.\n", str_error(rc));
-		usb_log_debug("Subdriver count: %d\n", 
+		usb_log_debug("Subdriver count: %d\n",
 		    hid_dev->subdriver_count);
-		
 	} else {
 		bool ok = false;
-		
-		usb_log_debug("Subdriver count: %d\n", 
+
+		usb_log_debug("Subdriver count: %d\n",
 		    hid_dev->subdriver_count);
-		
+
 		for (i = 0; i < hid_dev->subdriver_count; ++i) {
 			if (hid_dev->subdrivers[i].init != NULL) {
@@ -524,5 +465,5 @@
 			}
 		}
-		
+
 		rc = (ok) ? EOK : -1;	// what error to report
 	}
@@ -538,5 +479,4 @@
 	}
 
-
 	return rc;
 }
@@ -544,17 +484,15 @@
 /*----------------------------------------------------------------------------*/
 
-bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer, 
+bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer,
     size_t buffer_size, void *arg)
 {
-	int i;
-
 	if (dev == NULL || arg == NULL || buffer == NULL) {
 		usb_log_error("Missing arguments to polling callback.\n");
 		return false;
 	}
-
-	usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
+	usb_hid_dev_t *hid_dev = arg;
 
 	assert(hid_dev->input_report != NULL);
+
 	usb_log_debug("New data [%zu/%zu]: %s\n", buffer_size,
 	    hid_dev->max_input_report_size,
@@ -568,22 +506,18 @@
 	}
 
-	// parse the input report
-
-	int rc = usb_hid_parse_report(hid_dev->report, buffer, buffer_size, 
-	    &hid_dev->report_id);
-
+	/* Parse the input report */
+	const int rc = usb_hid_parse_report(
+	    &hid_dev->report, buffer, buffer_size, &hid_dev->report_id);
 	if (rc != EOK) {
 		usb_log_warning("Error in usb_hid_parse_report():"
 		    "%s\n", str_error(rc));
-	}	
+	}
 
 	bool cont = false;
-
-	// continue if at least one of the subdrivers want to continue
-	for (i = 0; i < hid_dev->subdriver_count; ++i) {
-		if (hid_dev->subdrivers[i].poll != NULL
-		    && hid_dev->subdrivers[i].poll(hid_dev, 
-		        hid_dev->subdrivers[i].data)) {
-			cont = true;
+	/* Continue if at least one of the subdrivers want to continue */
+	for (int i = 0; i < hid_dev->subdriver_count; ++i) {
+		if (hid_dev->subdrivers[i].poll != NULL) {
+			cont = cont || hid_dev->subdrivers[i].poll(
+			    hid_dev, hid_dev->subdrivers[i].data);
 		}
 	}
@@ -594,19 +528,15 @@
 /*----------------------------------------------------------------------------*/
 
-void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, 
-     void *arg)
-{
-	int i; 
-
-	if (dev == NULL || arg == NULL) {
-		return;
-	}
-
-	usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
-
-	for (i = 0; i < hid_dev->subdriver_count; ++i) {
+void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, void *arg)
+{
+	assert(dev);
+	assert(arg);
+
+	usb_hid_dev_t *hid_dev = arg;
+
+	for (int i = 0; i < hid_dev->subdriver_count; ++i) {
 		if (hid_dev->subdrivers[i].poll_end != NULL) {
-			hid_dev->subdrivers[i].poll_end(hid_dev,
-			    hid_dev->subdrivers[i].data, reason);
+			hid_dev->subdrivers[i].poll_end(
+			    hid_dev, hid_dev->subdrivers[i].data, reason);
 		}
 	}
@@ -624,5 +554,5 @@
 /*----------------------------------------------------------------------------*/
 
-int usb_hid_report_number(usb_hid_dev_t *hid_dev)
+int usb_hid_report_number(const usb_hid_dev_t *hid_dev)
 {
 	return hid_dev->report_nr;
@@ -631,19 +561,14 @@
 /*----------------------------------------------------------------------------*/
 
-void usb_hid_destroy(usb_hid_dev_t *hid_dev)
-{
-	int i;
-
-	if (hid_dev == NULL) {
-		return;
-	}
+void usb_hid_deinit(usb_hid_dev_t *hid_dev)
+{
+	assert(hid_dev);
+	assert(hid_dev->subdrivers != NULL || hid_dev->subdriver_count == 0);
+
 
 	usb_log_debug("Subdrivers: %p, subdriver count: %d\n", 
 	    hid_dev->subdrivers, hid_dev->subdriver_count);
 
-	assert(hid_dev->subdrivers != NULL 
-	    || hid_dev->subdriver_count == 0);
-
-	for (i = 0; i < hid_dev->subdriver_count; ++i) {
+	for (int i = 0; i < hid_dev->subdriver_count; ++i) {
 		if (hid_dev->subdrivers[i].deinit != NULL) {
 			hid_dev->subdrivers[i].deinit(hid_dev,
@@ -657,7 +582,5 @@
 
 	/* Destroy the parser */
-	if (hid_dev->report != NULL) {
-		usb_hid_free_report(hid_dev->report);
-	}
+	usb_hid_report_deinit(&hid_dev->report);
 
 }
Index: uspace/drv/bus/usb/usbhid/usbhid.h
===================================================================
--- uspace/drv/bus/usb/usbhid/usbhid.h	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhid/usbhid.h	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -119,5 +119,5 @@
 
 	/** HID Report parser. */
-	usb_hid_report_t *report;
+	usb_hid_report_t report;
 
 	uint8_t report_id;
@@ -141,5 +141,5 @@
 };
 
-extern usb_endpoint_description_t *usb_hid_endpoints[];
+extern const usb_endpoint_description_t *usb_hid_endpoints[];
 
 /*----------------------------------------------------------------------------*/
@@ -147,15 +147,14 @@
 int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev);
 
-bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer, 
-    size_t buffer_size, void *arg);
+void usb_hid_deinit(usb_hid_dev_t *hid_dev);
 
-void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, 
-     void *arg);
+bool usb_hid_polling_callback(usb_device_t *dev,
+    uint8_t *buffer, size_t buffer_size, void *arg);
+
+void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, void *arg);
 
 void usb_hid_new_report(usb_hid_dev_t *hid_dev);
 
-int usb_hid_report_number(usb_hid_dev_t *hid_dev);
-
-void usb_hid_destroy(usb_hid_dev_t *hid_dev);
+int usb_hid_report_number(const usb_hid_dev_t *hid_dev);
 
 #endif /* USB_HID_USBHID_H_ */
Index: uspace/drv/bus/usb/usbhub/main.c
===================================================================
--- uspace/drv/bus/usb/usbhub/main.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbhub/main.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -67,5 +67,5 @@
 
 /** Hub endpoints, excluding control endpoint. */
-static usb_endpoint_description_t *usb_hub_endpoints[] = {
+static const usb_endpoint_description_t *usb_hub_endpoints[] = {
 	&hub_status_change_endpoint_description,
 	NULL,
Index: uspace/drv/bus/usb/usbmast/main.c
===================================================================
--- uspace/drv/bus/usb/usbmast/main.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbmast/main.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -72,5 +72,5 @@
 };
 
-usb_endpoint_description_t *mast_endpoints[] = {
+static const usb_endpoint_description_t *mast_endpoints[] = {
 	&bulk_in_ep,
 	&bulk_out_ep,
Index: uspace/drv/bus/usb/usbmouse/init.c
===================================================================
--- uspace/drv/bus/usb/usbmouse/init.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbmouse/init.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -44,5 +44,5 @@
 
 /** Mouse polling endpoint description for boot protocol subclass. */
-usb_endpoint_description_t poll_endpoint_description = {
+const usb_endpoint_description_t poll_endpoint_description = {
 	.transfer_type = USB_TRANSFER_INTERRUPT,
 	.direction = USB_DIRECTION_IN,
Index: uspace/drv/bus/usb/usbmouse/main.c
===================================================================
--- uspace/drv/bus/usb/usbmouse/main.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbmouse/main.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -83,5 +83,5 @@
 };
 
-static usb_endpoint_description_t *endpoints[] = {
+static const usb_endpoint_description_t *endpoints[] = {
 	&poll_endpoint_description,
 	NULL
Index: uspace/drv/bus/usb/usbmouse/mouse.c
===================================================================
--- uspace/drv/bus/usb/usbmouse/mouse.c	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbmouse/mouse.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -124,5 +124,5 @@
 	mouse->console_sess = NULL;
 	
-	usb_device_destroy(dev);
+	usb_device_deinit(dev);
 }
 
Index: uspace/drv/bus/usb/usbmouse/mouse.h
===================================================================
--- uspace/drv/bus/usb/usbmouse/mouse.h	(revision f8dfb40e4825d7bc700afd6df75981fc2bc4c435)
+++ uspace/drv/bus/usb/usbmouse/mouse.h	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
@@ -61,5 +61,5 @@
 } usb_mouse_t;
 
-extern usb_endpoint_description_t poll_endpoint_description;
+extern const usb_endpoint_description_t poll_endpoint_description;
 
 extern int usb_mouse_create(usb_device_t *);
