Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision dd14362138754b744f271e387ae68de736b21fea)
+++ 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);
