Index: uspace/drv/usbhub/ports.c
===================================================================
--- uspace/drv/usbhub/ports.c	(revision a066122cd1a44f728a08c3f41f78cafe2444a01e)
+++ uspace/drv/usbhub/ports.c	(revision 5c1a65eaff89a7a535a118d7c745e903ae5f2eee)
@@ -47,5 +47,4 @@
 #include "port_status.h"
 
-
 /** Information for fibril for device discovery. */
 struct add_device_phase1 {
@@ -65,5 +64,5 @@
  * any function here and must be cleared by hand
  */
-static const int non_handled_changes[] =  {
+static const int non_handled_changes[] = {
 	USB_HUB_FEATURE_C_PORT_ENABLE,
 	USB_HUB_FEATURE_C_PORT_SUSPEND
@@ -71,11 +70,11 @@
 
 static void usb_hub_removed_device(
-	usb_hub_info_t * hub, uint16_t port);
-
-static void usb_hub_port_reset_completed(usb_hub_info_t * hub,
-	uint16_t port, uint32_t status);
-
-static void usb_hub_port_over_current(usb_hub_info_t * hub,
-	uint16_t port, uint32_t status);
+    usb_hub_info_t *hub, uint16_t port);
+
+static void usb_hub_port_reset_completed(usb_hub_info_t *hub,
+    uint16_t port, uint32_t status);
+
+static void usb_hub_port_over_current(usb_hub_info_t *hub,
+    uint16_t port, uint32_t status);
 
 static int get_port_status(usb_pipe_t *ctrl_pipe, size_t port,
@@ -96,7 +95,7 @@
  * @param port port number, starting from 1
  */
-void usb_hub_process_interrupt(usb_hub_info_t * hub,
-	uint16_t port) {
-	usb_log_debug("interrupt at port %zu\n", (size_t) port);
+void usb_hub_process_interrupt(usb_hub_info_t *hub,
+    uint16_t port) {
+	usb_log_debug("Interrupt at port %zu\n", (size_t) port);
 	//determine type of change
 	//usb_pipe_t *pipe = hub->control_pipe;
@@ -134,5 +133,5 @@
 	if (usb_port_is_status(status, USB_HUB_FEATURE_C_PORT_OVER_CURRENT)) {
 		//check if it was not auto-resolved
-		usb_log_debug("overcurrent change on port\n");
+		usb_log_debug("Overcurrent change on port\n");
 		usb_hub_port_over_current(hub, port, status);
 	}
@@ -141,23 +140,24 @@
 		usb_hub_port_reset_completed(hub, port, status);
 	}
-	usb_log_debug("status x%x : %d\n ", status, status);
+	usb_log_debug("Status x%x : %d\n ", status, status);
 
 	usb_port_status_set_bit(
-	    &status, USB_HUB_FEATURE_C_PORT_CONNECTION,false);
+	    &status, USB_HUB_FEATURE_C_PORT_CONNECTION, false);
 	usb_port_status_set_bit(
-	    &status, USB_HUB_FEATURE_C_PORT_RESET,false);
+	    &status, USB_HUB_FEATURE_C_PORT_RESET, false);
 	usb_port_status_set_bit(
-	    &status, USB_HUB_FEATURE_C_PORT_OVER_CURRENT,false);
-	
+	    &status, USB_HUB_FEATURE_C_PORT_OVER_CURRENT, false);
+
 	//clearing not yet handled changes	
 	unsigned int feature_idx;
-	for(feature_idx = 0;feature_idx<non_handled_changes_count;
-	    ++feature_idx){
+	for (feature_idx = 0;
+	    feature_idx < non_handled_changes_count;
+	    ++feature_idx) {
 		unsigned int bit_idx = non_handled_changes[feature_idx];
-		if(status & (1<<bit_idx)){
+		if (status & (1 << bit_idx)) {
 			usb_log_info(
-			    "there was not yet handled change on port %d: %d"
+			    "There was not yet handled change on port %d: %d"
 			    ";clearing it\n",
-			port, bit_idx);
+			    port, bit_idx);
 			int opResult = usb_hub_clear_port_feature(
 			    hub->control_pipe,
@@ -165,18 +165,17 @@
 			if (opResult != EOK) {
 				usb_log_warning(
-				    "could not clear port flag %d: %d\n",
-				    bit_idx, opResult
+				    "Could not clear port flag %d: %s\n",
+				    bit_idx, str_error(opResult)
 				    );
 			}
 			usb_port_status_set_bit(
-			    &status, bit_idx,false);
+			    &status, bit_idx, false);
 		}
 	}
-	if(status>>16){
-		usb_log_info("there is still some unhandled change %X\n",
+	if (status >> 16) {
+		usb_log_info("There is still some unhandled change %X\n",
 		    status);
 	}
 }
-
 
 /**
@@ -190,10 +189,10 @@
  */
 static void usb_hub_removed_device(
-	usb_hub_info_t * hub, uint16_t port) {
+    usb_hub_info_t *hub, uint16_t port) {
 
 	int opResult = usb_hub_clear_port_feature(hub->control_pipe,
-		port, USB_HUB_FEATURE_C_PORT_CONNECTION);
+	    port, USB_HUB_FEATURE_C_PORT_CONNECTION);
 	if (opResult != EOK) {
-		usb_log_warning("could not clear port-change-connection flag\n");
+		usb_log_warning("Could not clear port-change-connection flag\n");
 	}
 	/** \TODO remove device from device manager - not yet implemented in
@@ -231,5 +230,4 @@
 }
 
-
 /**
  * Process port reset change
@@ -241,6 +239,6 @@
  * @param status
  */
-static void usb_hub_port_reset_completed(usb_hub_info_t * hub,
-	uint16_t port, uint32_t status){
+static void usb_hub_port_reset_completed(usb_hub_info_t *hub,
+    uint16_t port, uint32_t status) {
 	usb_log_debug("Port %zu reset complete.\n", (size_t) port);
 	if (usb_port_is_status(status, USB_HUB_FEATURE_PORT_ENABLE)) {
@@ -274,20 +272,20 @@
  * @param port port number, starting from 1
  */
-static void usb_hub_port_over_current(usb_hub_info_t * hub,
-	uint16_t port, uint32_t status) {
+static void usb_hub_port_over_current(usb_hub_info_t *hub,
+    uint16_t port, uint32_t status) {
 	int opResult;
-	if(usb_port_is_status(status, USB_HUB_FEATURE_PORT_OVER_CURRENT)){
+	if (usb_port_is_status(status, USB_HUB_FEATURE_PORT_OVER_CURRENT)) {
 		opResult = usb_hub_clear_port_feature(hub->control_pipe,
-			port, USB_HUB_FEATURE_PORT_POWER);
+		    port, USB_HUB_FEATURE_PORT_POWER);
 		if (opResult != EOK) {
-			usb_log_error("cannot power off port %d;  %d\n",
-				port, opResult);
+			usb_log_error("Cannot power off port %d; %s\n",
+			    port, str_error(opResult));
 		}
-	}else{
+	} else {
 		opResult = usb_hub_set_port_feature(hub->control_pipe,
-			port, USB_HUB_FEATURE_PORT_POWER);
+		    port, USB_HUB_FEATURE_PORT_POWER);
 		if (opResult != EOK) {
-			usb_log_error("cannot power on port %d;  %d\n",
-				port, opResult);
+			usb_log_error("Cannot power on port %d; %s\n",
+			    port, str_error(opResult));
 		}
 	}
@@ -302,6 +300,5 @@
  */
 static int get_port_status(usb_pipe_t *ctrl_pipe, size_t port,
-    usb_port_status_t *status)
-{
+    usb_port_status_t *status) {
 	size_t recv_size;
 	usb_device_request_setup_packet_t request;
@@ -310,6 +307,6 @@
 	usb_hub_set_port_status_request(&request, port);
 	int rc = usb_pipe_control_read(ctrl_pipe,
-	    &request, sizeof(usb_device_request_setup_packet_t),
-	    &status_tmp, sizeof(status_tmp), &recv_size);
+	    &request, sizeof (usb_device_request_setup_packet_t),
+	    &status_tmp, sizeof (status_tmp), &recv_size);
 	if (rc != EOK) {
 		return rc;
@@ -336,6 +333,5 @@
  * @return Error code.
  */
-static int enable_port_callback(int port_no, void *arg)
-{
+static int enable_port_callback(int port_no, void *arg) {
 	usb_hub_info_t *hub = arg;
 	int rc;
@@ -345,5 +341,5 @@
 	usb_hub_set_reset_port_request(&request, port_no);
 	rc = usb_pipe_control_write(hub->control_pipe,
-	    &request, sizeof(request), NULL, 0);
+	    &request, sizeof (request), NULL, 0);
 	if (rc != EOK) {
 		usb_log_warning("Port reset failed: %s.\n", str_error(rc));
@@ -375,6 +371,5 @@
  * @return 0 Always.
  */
-static int add_device_phase1_worker_fibril(void *arg)
-{
+static int add_device_phase1_worker_fibril(void *arg) {
 	struct add_device_phase1 *data
 	    = (struct add_device_phase1 *) arg;
@@ -418,5 +413,4 @@
 }
 
-
 /** Start device adding when connection change is detected.
  *
@@ -429,8 +423,7 @@
  */
 static int create_add_device_fibril(usb_hub_info_t *hub, size_t port,
-    usb_speed_t speed)
-{
+    usb_speed_t speed) {
 	struct add_device_phase1 *data
-	    = malloc(sizeof(struct add_device_phase1));
+	    = malloc(sizeof (struct add_device_phase1));
 	if (data == NULL) {
 		return ENOMEM;
Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision a066122cd1a44f728a08c3f41f78cafe2444a01e)
+++ uspace/drv/usbhub/usbhub.c	(revision 5c1a65eaff89a7a535a118d7c745e903ae5f2eee)
@@ -56,21 +56,21 @@
 
 
-static usb_hub_info_t * usb_hub_info_create(usb_device_t * usb_dev);
-
-static int usb_hub_process_hub_specific_info(usb_hub_info_t * hub_info);
-
-static int usb_hub_set_configuration(usb_hub_info_t * hub_info);
-
-static int usb_hub_start_hub_fibril(usb_hub_info_t * hub_info);
-
-static int usb_process_hub_over_current(usb_hub_info_t * hub_info,
+static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev);
+
+static int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info);
+
+static int usb_hub_set_configuration(usb_hub_info_t *hub_info);
+
+static int usb_hub_start_hub_fibril(usb_hub_info_t *hub_info);
+
+static int usb_process_hub_over_current(usb_hub_info_t *hub_info,
     usb_hub_status_t status);
 
-static int usb_process_hub_local_power_change(usb_hub_info_t * hub_info,
+static int usb_process_hub_local_power_change(usb_hub_info_t *hub_info,
     usb_hub_status_t status);
 
-static void usb_hub_process_global_interrupt(usb_hub_info_t * hub_info);
-
-static void usb_hub_polling_terminated_callback(usb_device_t * device,
+static void usb_hub_process_global_interrupt(usb_hub_info_t *hub_info);
+
+static void usb_hub_polling_terminated_callback(usb_device_t *device,
     bool was_error, void * data);
 
@@ -90,7 +90,7 @@
  * @return error code
  */
-int usb_hub_add_device(usb_device_t * usb_dev) {
+int usb_hub_add_device(usb_device_t *usb_dev) {
 	if (!usb_dev) return EINVAL;
-	usb_hub_info_t * hub_info = usb_hub_info_create(usb_dev);
+	usb_hub_info_t *hub_info = usb_hub_info_create(usb_dev);
 	//create hc connection
 	usb_log_debug("Initializing USB wire abstraction.\n");
@@ -99,7 +99,7 @@
 	    hub_info->usb_device->ddf_dev);
 	if (opResult != EOK) {
-		usb_log_error("could not initialize connection to device, "
-		    "errno %d\n",
-		    opResult);
+		usb_log_error("Could not initialize connection to device, "
+		    " %s\n",
+		    str_error(opResult));
 		free(hub_info);
 		return opResult;
@@ -109,6 +109,6 @@
 	opResult = usb_hub_set_configuration(hub_info);
 	if (opResult != EOK) {
-		usb_log_error("could not set hub configuration, errno %d\n",
-		    opResult);
+		usb_log_error("Could not set hub configuration, %s\n",
+		    str_error(opResult));
 		free(hub_info);
 		return opResult;
@@ -117,6 +117,6 @@
 	opResult = usb_hub_process_hub_specific_info(hub_info);
 	if (opResult != EOK) {
-		usb_log_error("could process hub specific info, errno %d\n",
-		    opResult);
+		usb_log_error("Could process hub specific info, %s\n",
+		    str_error(opResult));
 		free(hub_info);
 		return opResult;
@@ -135,9 +135,8 @@
 
 	opResult = usb_hub_start_hub_fibril(hub_info);
-	if(opResult!=EOK)
+	if (opResult != EOK)
 		free(hub_info);
 	return opResult;
 }
-
 
 /** Callback for polling hub for changes.
@@ -193,6 +192,6 @@
  * @return basic usb_hub_info_t structure
  */
-static usb_hub_info_t * usb_hub_info_create(usb_device_t * usb_dev) {
-	usb_hub_info_t * result = malloc(sizeof(usb_hub_info_t));
+static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev) {
+	usb_hub_info_t * result = malloc(sizeof (usb_hub_info_t));
 	if (!result) return NULL;
 	result->usb_device = usb_dev;
@@ -202,5 +201,5 @@
 
 	result->ports = NULL;
-	result->port_count = (size_t) -1;
+	result->port_count = (size_t) - 1;
 	fibril_mutex_initialize(&result->port_mutex);
 
@@ -221,7 +220,7 @@
  * @return error code
  */
-static int usb_hub_process_hub_specific_info(usb_hub_info_t * hub_info) {
+static int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info) {
 	// get hub descriptor
-	usb_log_debug("creating serialized descriptor\n");
+	usb_log_debug("Creating serialized descriptor\n");
 	uint8_t serialized_descriptor[USB_HUB_MAX_DESCRIPTOR_SIZE];
 	usb_hub_descriptor_t * descriptor;
@@ -235,11 +234,11 @@
 
 	if (opResult != EOK) {
-		usb_log_error("failed when receiving hub descriptor, "
-		    "badcode = %d\n",
-		    opResult);
+		usb_log_error("Failed when receiving hub descriptor, "
+		    "%s\n",
+		    str_error(opResult));
 		free(serialized_descriptor);
 		return opResult;
 	}
-	usb_log_debug2("deserializing descriptor\n");
+	usb_log_debug2("Deserializing descriptor\n");
 	descriptor = usb_create_deserialized_hub_desriptor(
 	    serialized_descriptor);
@@ -252,10 +251,10 @@
 	/// \TODO this is not semantically correct
 	bool is_power_switched =
-	    ((descriptor->hub_characteristics & 1) ==0);
+	    ((descriptor->hub_characteristics & 1) == 0);
 	bool has_individual_port_powering =
-	    ((descriptor->hub_characteristics & 1) !=0);
+	    ((descriptor->hub_characteristics & 1) != 0);
 	hub_info->ports = malloc(
 	    sizeof (usb_hub_port_t) * (hub_info->port_count + 1));
-	if(!hub_info->ports){
+	if (!hub_info->ports) {
 		return ENOMEM;
 	}
@@ -264,13 +263,13 @@
 		usb_hub_port_init(&hub_info->ports[port]);
 	}
-	if(is_power_switched){
-		usb_log_debug("is_power_switched\n");
-		
-		if(!has_individual_port_powering){
-			usb_log_debug("!has_individual_port_powering\n");
+	if (is_power_switched) {
+		usb_log_debug("Hub power switched\n");
+
+		if (!has_individual_port_powering) {
+			usb_log_debug("Has_global powering\n");
 			opResult = usb_hub_set_feature(hub_info->control_pipe,
 			    USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
 			if (opResult != EOK) {
-				usb_log_error("cannot power hub: %s\n",
+				usb_log_error("Cannot power hub: %s\n",
 				    str_error(opResult));
 			}
@@ -278,5 +277,5 @@
 
 		for (port = 1; port <= hub_info->port_count; ++port) {
-			usb_log_debug("Powering port %zu.\n",port);
+			usb_log_debug("Powering port %zu.\n", port);
 			opResult = usb_hub_set_port_feature(hub_info->control_pipe,
 			    port, USB_HUB_FEATURE_PORT_POWER);
@@ -286,9 +285,9 @@
 			}
 		}
-		
-	}else{
-		usb_log_debug("!is_power_switched, not going to be powered\n");
-	}
-	usb_log_debug2("freeing data\n");
+
+	} else {
+		usb_log_debug("Power not switched, not going to be powered\n");
+	}
+	usb_log_debug2("Freeing data\n");
 	free(descriptor);
 	return EOK;
@@ -303,12 +302,12 @@
  * @return error code
  */
-static int usb_hub_set_configuration(usb_hub_info_t * hub_info) {
+static int usb_hub_set_configuration(usb_hub_info_t *hub_info) {
 	//device descriptor
 	usb_standard_device_descriptor_t *std_descriptor
 	    = &hub_info->usb_device->descriptors.device;
-	usb_log_debug("hub has %d configurations\n",
+	usb_log_debug("Hub has %d configurations\n",
 	    std_descriptor->configuration_count);
 	if (std_descriptor->configuration_count < 1) {
-		usb_log_error("there are no configurations available\n");
+		usb_log_error("There are no configurations available\n");
 		return EINVAL;
 	}
@@ -328,5 +327,5 @@
 		return opResult;
 	}
-	usb_log_debug("\tused configuration %d\n",
+	usb_log_debug("\tUsed configuration %d\n",
 	    config_descriptor->configuration_number);
 
@@ -343,5 +342,5 @@
  * @return error code
  */
-static int usb_hub_start_hub_fibril(usb_hub_info_t * hub_info){
+static int usb_hub_start_hub_fibril(usb_hub_info_t *hub_info) {
 	int rc;
 
@@ -367,5 +366,4 @@
 //*********************************************
 
-
 /**
  * process hub over current change
@@ -376,18 +374,18 @@
  * @return error code
  */
-static int usb_process_hub_over_current(usb_hub_info_t * hub_info,
+static int usb_process_hub_over_current(usb_hub_info_t *hub_info,
     usb_hub_status_t status) {
 	int opResult;
-	if (usb_hub_is_status(status,USB_HUB_FEATURE_HUB_OVER_CURRENT)){
+	if (usb_hub_is_status(status, USB_HUB_FEATURE_HUB_OVER_CURRENT)) {
 		//poweroff all ports
 		unsigned int port;
-		for(port = 1;port <= hub_info->port_count;++port){
+		for (port = 1; port <= hub_info->port_count; ++port) {
 			opResult = usb_hub_clear_port_feature(
-			    hub_info->control_pipe,port,
+			    hub_info->control_pipe, port,
 			    USB_HUB_FEATURE_PORT_POWER);
 			if (opResult != EOK) {
 				usb_log_warning(
-				    "cannot power off port %d;  %d\n",
-				    port, opResult);
+				    "Cannot power off port %d;  %s\n",
+				    port, str_error(opResult));
 			}
 		}
@@ -395,12 +393,12 @@
 		//power all ports
 		unsigned int port;
-		for(port = 1;port <= hub_info->port_count;++port){
+		for (port = 1; port <= hub_info->port_count; ++port) {
 			opResult = usb_hub_set_port_feature(
-			    hub_info->control_pipe,port,
+			    hub_info->control_pipe, port,
 			    USB_HUB_FEATURE_PORT_POWER);
 			if (opResult != EOK) {
 				usb_log_warning(
-				    "cannot power off port %d;  %d\n",
-				    port, opResult);
+				    "Cannot power off port %d;  %s\n",
+				    port, str_error(opResult));
 			}
 		}
@@ -417,13 +415,13 @@
  * @return error code
  */
-static int usb_process_hub_local_power_change(usb_hub_info_t * hub_info,
+static int usb_process_hub_local_power_change(usb_hub_info_t *hub_info,
     usb_hub_status_t status) {
 	int opResult = EOK;
 	opResult = usb_hub_clear_feature(hub_info->control_pipe,
 	    USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
-		if (opResult != EOK) {
-		usb_log_error("cannnot clear hub power change flag: "
-		    "%d\n",
-		    opResult);
+	if (opResult != EOK) {
+		usb_log_error("Cannnot clear hub power change flag: "
+		    "%s\n",
+		    str_error(opResult));
 	}
 	return opResult;
@@ -437,6 +435,6 @@
  * @param hub_info hub instance
  */
-static void usb_hub_process_global_interrupt(usb_hub_info_t * hub_info) {
-	usb_log_debug("global interrupt on a hub\n");
+static void usb_hub_process_global_interrupt(usb_hub_info_t *hub_info) {
+	usb_log_debug("Global interrupt on a hub\n");
 	usb_pipe_t *pipe = hub_info->control_pipe;
 	int opResult;
@@ -455,18 +453,19 @@
 	    );
 	if (opResult != EOK) {
-		usb_log_error("could not get hub status\n");
+		usb_log_error("Could not get hub status: %s\n",
+		    str_error(opResult));
 		return;
 	}
 	if (rcvd_size != sizeof (usb_port_status_t)) {
-		usb_log_error("received status has incorrect size\n");
+		usb_log_error("Received status has incorrect size\n");
 		return;
 	}
 	//port reset
 	if (
-	    usb_hub_is_status(status,16+USB_HUB_FEATURE_C_HUB_OVER_CURRENT)) {
+	    usb_hub_is_status(status, 16 + USB_HUB_FEATURE_C_HUB_OVER_CURRENT)) {
 		usb_process_hub_over_current(hub_info, status);
 	}
 	if (
-	    usb_hub_is_status(status,16+USB_HUB_FEATURE_C_HUB_LOCAL_POWER)) {
+	    usb_hub_is_status(status, 16 + USB_HUB_FEATURE_C_HUB_LOCAL_POWER)) {
 		usb_process_hub_local_power_change(hub_info, status);
 	}
@@ -481,6 +480,6 @@
  * @param data pointer to usb_hub_info_t structure
  */
-static void usb_hub_polling_terminated_callback(usb_device_t * device,
-    bool was_error, void * data){
+static void usb_hub_polling_terminated_callback(usb_device_t *device,
+    bool was_error, void *data) {
 	usb_hub_info_t * hub = data;
 	assert(hub);
