Index: uspace/srv/net/netif/lo/lo.c
===================================================================
--- uspace/srv/net/netif/lo/lo.c	(revision f5a34791cdbb90f8f4348da69808cc7f01b94288)
+++ uspace/srv/net/netif/lo/lo.c	(revision c4fbf7fd3af07c642a663f9e2e6b0385ab91b64e)
@@ -28,9 +28,9 @@
 
 /** @addtogroup lo
- *  @{
+ * @{
  */
 
 /** @file
- *  Loopback network interface implementation.
+ * Loopback network interface implementation.
  */
 
@@ -53,45 +53,27 @@
 #include <netif_local.h>
 
-/** Default hardware address.
- */
+/** Default hardware address. */
 #define DEFAULT_ADDR		"\0\0\0\0\0\0"
 
-/** Default address length.
- */
+/** Default address length. */
 #define DEFAULT_ADDR_LEN	(sizeof(DEFAULT_ADDR) / sizeof(char))
 
-/** Loopback module name.
- */
+/** Loopback module name. */
 #define NAME  "lo"
 
-/** Network interface global data.
- */
+/** Network interface global data. */
 netif_globals_t	netif_globals;
 
-/** Changes the loopback state.
- *  @param[in] device The device structure.
- *  @param[in] state The new device state.
- *  @returns The new state if changed.
- *  @returns EOK otherwise.
- */
-int change_state_message(netif_device_t * device, device_state_t state);
-
-/** Creates and returns the loopback network interface structure.
- *  @param[in] device_id The new devce identifier.
- *  @param[out] device The device structure.
- *  @returns EOK on success.
- *  @returns EXDEV if one loopback network interface already exists.
- *  @returns ENOMEM if there is not enough memory left.
- */
-int create(device_id_t device_id, netif_device_t * * device);
-
-int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int
+netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count)
+{
 	return ENOTSUP;
 }
 
-int netif_get_addr_message(device_id_t device_id, measured_string_ref address){
-	if(! address){
+int netif_get_addr_message(device_id_t device_id, measured_string_ref address)
+{
+	if (!address)
 		return EBADMEM;
-	}
 	address->value = str_dup(DEFAULT_ADDR);
 	address->length = DEFAULT_ADDR_LEN;
@@ -99,18 +81,26 @@
 }
 
-int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){
-	ERROR_DECLARE;
-
-	netif_device_t * device;
-
-	if(! stats){
+int netif_get_device_stats(device_id_t device_id, device_stats_ref stats)
+{
+	ERROR_DECLARE;
+
+	netif_device_t *device;
+
+	if (!stats)
 		return EBADMEM;
-	}
 	ERROR_PROPAGATE(find_device(device_id, &device));
-	memcpy(stats, (device_stats_ref) device->specific, sizeof(device_stats_t));
-	return EOK;
-}
-
-int change_state_message(netif_device_t * device, device_state_t state)
+	memcpy(stats, (device_stats_ref) device->specific,
+	    sizeof(device_stats_t));
+	return EOK;
+}
+
+/** Changes the loopback state.
+ *
+ * @param[in] device	The device structure.
+ * @param[in] state	The new device state.
+ * @returns		The new state if changed.
+ * @returns		EOK otherwise.
+ */
+static int change_state_message(netif_device_t *device, device_state_t state)
 {
 	if (device->state != state) {
@@ -126,35 +116,45 @@
 }
 
-int create(device_id_t device_id, netif_device_t * * device){
+/** Creates and returns the loopback network interface structure.
+ *
+ * @param[in] device_id	The new devce identifier.
+ * @param[out] device	The device structure.
+ * @returns		EOK on success.
+ * @returns		EXDEV if one loopback network interface already exists.
+ * @returns		ENOMEM if there is not enough memory left.
+ */
+static int create(device_id_t device_id, netif_device_t **device)
+{
 	int index;
 
-	if(netif_device_map_count(&netif_globals.device_map) > 0){
+	if (netif_device_map_count(&netif_globals.device_map) > 0)
 		return EXDEV;
-	}else{
-		*device = (netif_device_t *) malloc(sizeof(netif_device_t));
-		if(!(*device)){
-			return ENOMEM;
-		}
-		(** device).specific = malloc(sizeof(device_stats_t));
-		if(! (** device).specific){
-			free(*device);
-			return ENOMEM;
-		}
-		null_device_stats((device_stats_ref)(** device).specific);
-		(** device).device_id = device_id;
-		(** device).nil_phone = -1;
-		(** device).state = NETIF_STOPPED;
-		index = netif_device_map_add(&netif_globals.device_map, (** device).device_id, * device);
-		if(index < 0){
-			free(*device);
-			free((** device).specific);
-			*device = NULL;
-			return index;
-		}
-	}
-	return EOK;
-}
-
-int netif_initialize(void){
+
+	*device = (netif_device_t *) malloc(sizeof(netif_device_t));
+	if (!*device)
+		return ENOMEM;
+	(*device)->specific = (device_stats_t *) malloc(sizeof(device_stats_t));
+	if (!(*device)->specific) {
+		free(*device);
+		return ENOMEM;
+	}
+	null_device_stats((device_stats_ref) (*device)->specific);
+	(*device)->device_id = device_id;
+	(*device)->nil_phone = -1;
+	(*device)->state = NETIF_STOPPED;
+	index = netif_device_map_add(&netif_globals.device_map,
+	    (*device)->device_id, *device);
+	if (index < 0) {
+		free(*device);
+		free((*device)->specific);
+		*device = NULL;
+		return index;
+	}
+	
+	return EOK;
+}
+
+int netif_initialize(void)
+{
 	ipcarg_t phonehash;
 
@@ -162,5 +162,6 @@
 }
 
-int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
+int netif_probe_message(device_id_t device_id, int irq, uintptr_t io)
+{
 	ERROR_DECLARE;
 
@@ -174,8 +175,9 @@
 }
 
-int netif_send_message(device_id_t device_id, packet_t packet, services_t sender){
-	ERROR_DECLARE;
-
-	netif_device_t * device;
+int netif_send_message(device_id_t device_id, packet_t packet, services_t sender)
+{
+	ERROR_DECLARE;
+
+	netif_device_t *device;
 	size_t length;
 	packet_t next;
@@ -183,29 +185,32 @@
 
 	ERROR_PROPAGATE(find_device(device_id, &device));
-	if(device->state != NETIF_ACTIVE){
+	if (device->state != NETIF_ACTIVE) {
 		netif_pq_release(packet_get_id(packet));
 		return EFORWARD;
 	}
 	next = packet;
-	do{
-		++ ((device_stats_ref) device->specific)->send_packets;
-		++ ((device_stats_ref) device->specific)->receive_packets;
+	do {
+		((device_stats_ref) device->specific)->send_packets++;
+		((device_stats_ref) device->specific)->receive_packets++;
 		length = packet_get_data_length(next);
 		((device_stats_ref) device->specific)->send_bytes += length;
 		((device_stats_ref) device->specific)->receive_bytes += length;
 		next = pq_next(next);
-	}while(next);
+	} while(next);
 	phone = device->nil_phone;
 	fibril_rwlock_write_unlock(&netif_globals.lock);
 	nil_received_msg(phone, device_id, packet, sender);
 	fibril_rwlock_write_lock(&netif_globals.lock);
-	return EOK;
-}
-
-int netif_start_message(netif_device_t * device){
+	
+	return EOK;
+}
+
+int netif_start_message(netif_device_t *device)
+{
 	return change_state_message(device, NETIF_ACTIVE);
 }
 
-int netif_stop_message(netif_device_t * device){
+int netif_stop_message(netif_device_t *device)
+{
 	return change_state_message(device, NETIF_STOPPED);
 }
@@ -213,7 +218,6 @@
 /** Default thread for new connections.
  *
- * @param[in] iid The initial message identifier.
- * @param[in] icall The initial message call structure.
- *
+ * @param[in] iid	The initial message identifier.
+ * @param[in] icall	The initial message call structure.
  */
 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)
@@ -225,5 +229,5 @@
 	ipc_answer_0(iid, EOK);
 	
-	while(true) {
+	while (true) {
 		ipc_call_t answer;
 		int answer_count;
@@ -240,6 +244,10 @@
 		    &answer_count);
 		
-		/* End if said to either by the message or the processing result */
-		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
+		/*
+		 * End if said to either by the message or the processing
+		 * result.
+		 */
+		if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		    (res == EHANGUP))
 			return;
 		
