Index: uspace/lib/usbhost/include/usb/host/bandwidth.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/bandwidth.h	(revision bd05140d932d234ee044e634a47ef576a2dce904)
+++ uspace/lib/usbhost/include/usb/host/bandwidth.h	(revision 64d138bec5d6824306e69dd9350f6058fb4a56a0)
@@ -51,7 +51,7 @@
 typedef struct endpoint endpoint_t;
 
-extern size_t bandwidth_count_usb11(endpoint_t *, size_t);
+extern ssize_t bandwidth_count_usb11(endpoint_t *, size_t);
 
-extern size_t bandwidth_count_usb20(endpoint_t *, size_t);
+extern ssize_t bandwidth_count_usb20(endpoint_t *, size_t);
 
 #endif
Index: uspace/lib/usbhost/include/usb/host/bus.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/bus.h	(revision bd05140d932d234ee044e634a47ef576a2dce904)
+++ uspace/lib/usbhost/include/usb/host/bus.h	(revision 64d138bec5d6824306e69dd9350f6058fb4a56a0)
@@ -77,33 +77,50 @@
 	usb_address_t address;
 
+	/* Managing bus */
+	bus_t *bus;
+
 	/* This structure is meant to be extended by overriding. */
 } device_t;
 
-typedef struct {
-	int (*enumerate_device)(bus_t *, hcd_t *, device_t *);
-	int (*remove_device)(bus_t *, hcd_t *, device_t *);
+typedef struct bus_ops bus_ops_t;
 
-	int (*online_device)(bus_t *, hcd_t *, device_t *);			/**< Optional */
-	int (*offline_device)(bus_t *, hcd_t *, device_t *);			/**< Optional */
+/**
+ * Operations structure serving as an interface of hc driver for the library
+ * (and the rest of the system).
+ */
+struct bus_ops {
+	/* Undefined operations will be delegated to parent ops */
+	const bus_ops_t *parent;
 
-	/* The following operations are protected by a bus guard. */
-	endpoint_t *(*create_endpoint)(bus_t *);
-	int (*register_endpoint)(bus_t *, device_t *, endpoint_t *, const usb_endpoint_desc_t *);
-	int (*unregister_endpoint)(bus_t *, endpoint_t *);
-	endpoint_t *(*find_endpoint)(bus_t *, device_t*, usb_target_t, usb_direction_t);
-	void (*destroy_endpoint)(endpoint_t *);			/**< Optional */
+	/* Global operations on the bus */
+	int (*reserve_default_address)(bus_t *, usb_speed_t);
+	int (*release_default_address)(bus_t *);
+	int (*reset_toggle)(bus_t *, usb_target_t, toggle_reset_mode_t);
+
+	/* Operations on device */
+	int (*device_enumerate)(device_t *);
+	int (*device_remove)(device_t *);
+	int (*device_online)(device_t *);			/**< Optional */
+	int (*device_offline)(device_t *);			/**< Optional */
+	endpoint_t *(*device_find_endpoint)(device_t*, usb_target_t, usb_direction_t);
+	endpoint_t *(*endpoint_create)(device_t *, const usb_endpoint_desc_t *);
+
+	/* Operations on endpoint */
+	int (*endpoint_register)(endpoint_t *);
+	int (*endpoint_unregister)(endpoint_t *);
+	void (*endpoint_destroy)(endpoint_t *);			/**< Optional */
 	bool (*endpoint_get_toggle)(endpoint_t *);		/**< Optional */
 	void (*endpoint_set_toggle)(endpoint_t *, bool);	/**< Optional */
+	ssize_t (*endpoint_count_bw) (endpoint_t *, size_t);
+	usb_transfer_batch_t *(*batch_create)(endpoint_t *);	/**< Optional */
 
-	int (*reserve_default_address)(bus_t *, usb_speed_t);
-	int (*release_default_address)(bus_t *);
+	/* Operations on batch */
+	void (*batch_destroy)(usb_transfer_batch_t *);	/**< Optional */
+};
 
-	int (*reset_toggle)(bus_t *, usb_target_t, toggle_reset_mode_t);
-
-	size_t (*count_bw) (endpoint_t *, size_t);
-
-	usb_transfer_batch_t *(*create_batch)(bus_t *, endpoint_t *); /**< Optional */
-	void (*destroy_batch)(usb_transfer_batch_t *);	/**< Optional */
-} bus_ops_t;
+/**
+ * Use this macro to lookup virtual function.
+ */
+#define BUS_OPS_LOOKUP(start, fn) ({ bus_ops_t const * ops = (start); while (ops && ops->fn == NULL) ops = ops->parent; ops; })
 
 /** Endpoint management structure */
@@ -112,28 +129,29 @@
 	fibril_mutex_t guard;
 
+	/* TODO: get rid of this one. */
+	hcd_t *hcd;
+
 	size_t device_size;
 
 	/* Do not call directly, ops are synchronized. */
-	bus_ops_t ops;
+	const bus_ops_t *ops;
 
 	/* This structure is meant to be extended by overriding. */
 } bus_t;
 
-void bus_init(bus_t *, size_t);
-int device_init(device_t *);
+void bus_init(bus_t *, hcd_t *, size_t);
+int bus_device_init(device_t *, bus_t *);
 
-int device_set_default_name(device_t *);
+int bus_device_set_default_name(device_t *);
 
-int bus_enumerate_device(bus_t *, hcd_t *, device_t *);
-int bus_remove_device(bus_t *, hcd_t *, device_t *);
+int bus_device_enumerate(device_t *);
+int bus_device_remove(device_t *);
 
-int bus_online_device(bus_t *, hcd_t *, device_t *);
-int bus_offline_device(bus_t *, hcd_t *, device_t *);
+int bus_device_online(device_t *);
+int bus_device_offline(device_t *);
 
-int bus_add_endpoint(bus_t *, device_t *, const usb_endpoint_desc_t *, endpoint_t **);
-endpoint_t *bus_find_endpoint(bus_t *, device_t *, usb_target_t, usb_direction_t);
-int bus_remove_endpoint(bus_t *, endpoint_t *);
-
-size_t bus_count_bw(endpoint_t *, size_t);
+int bus_endpoint_add(device_t *, const usb_endpoint_desc_t *, endpoint_t **);
+endpoint_t *bus_find_endpoint(device_t *, usb_target_t, usb_direction_t);
+int bus_endpoint_remove(endpoint_t *);
 
 int bus_reserve_default_address(bus_t *, usb_speed_t);
Index: uspace/lib/usbhost/include/usb/host/ddf_helpers.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/ddf_helpers.h	(revision bd05140d932d234ee044e634a47ef576a2dce904)
+++ uspace/lib/usbhost/include/usb/host/ddf_helpers.h	(revision 64d138bec5d6824306e69dd9350f6058fb4a56a0)
@@ -81,7 +81,7 @@
 int hcd_setup_virtual_root_hub(hcd_t *, ddf_dev_t *);
 
-device_t *hcd_ddf_device_create(ddf_dev_t *, size_t);
+device_t *hcd_ddf_device_create(ddf_dev_t *, bus_t *);
 void hcd_ddf_device_destroy(device_t *);
-int hcd_ddf_device_explore(hcd_t *, device_t *);
+int hcd_ddf_device_explore(device_t *);
 int hcd_ddf_device_online(ddf_fun_t *);
 int hcd_ddf_device_offline(ddf_fun_t *);
Index: uspace/lib/usbhost/include/usb/host/endpoint.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/endpoint.h	(revision bd05140d932d234ee044e634a47ef576a2dce904)
+++ uspace/lib/usbhost/include/usb/host/endpoint.h	(revision 64d138bec5d6824306e69dd9350f6058fb4a56a0)
@@ -45,4 +45,5 @@
 #include <stdbool.h>
 #include <usb/usb.h>
+#include <usb/host/bus.h>
 
 typedef struct bus bus_t;
@@ -54,10 +55,8 @@
 	/** Part of linked list. */
 	link_t link;
-	/** Managing bus */
-	bus_t *bus;
+	/** USB device */
+	device_t *device;
 	/** Reference count. */
 	atomic_t refcnt;
-	/** USB device */
-	device_t *device;
 	/** Enpoint number */
 	usb_endpoint_t endpoint;
@@ -84,5 +83,5 @@
 } endpoint_t;
 
-extern void endpoint_init(endpoint_t *, bus_t *);
+extern void endpoint_init(endpoint_t *, device_t *, const usb_endpoint_desc_t *);
 
 extern void endpoint_add_ref(endpoint_t *);
@@ -103,6 +102,15 @@
 void endpoint_abort(endpoint_t *);
 
+/* Manage the toggle bit */
 extern int endpoint_toggle_get(endpoint_t *);
 extern void endpoint_toggle_set(endpoint_t *, bool);
+
+/* Calculate bandwidth */
+ssize_t endpoint_count_bw(endpoint_t *, size_t);
+
+static inline bus_t *endpoint_get_bus(endpoint_t *ep)
+{
+	return ep->device->bus;
+}
 
 /** list_get_instance wrapper.
Index: uspace/lib/usbhost/include/usb/host/usb2_bus.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/usb2_bus.h	(revision bd05140d932d234ee044e634a47ef576a2dce904)
+++ uspace/lib/usbhost/include/usb/host/usb2_bus.h	(revision 64d138bec5d6824306e69dd9350f6058fb4a56a0)
@@ -46,6 +46,4 @@
 typedef struct endpoint endpoint_t;
 
-typedef size_t (*count_bw_func_t)(endpoint_t *, size_t);
-
 /** Endpoint management structure */
 typedef struct usb2_bus {
@@ -66,5 +64,7 @@
 } usb2_bus_t;
 
-extern int usb2_bus_init(usb2_bus_t *, size_t, count_bw_func_t);
+extern const bus_ops_t usb2_bus_ops;
+
+extern int usb2_bus_init(usb2_bus_t *, hcd_t *, size_t);
 
 #endif
