Index: uspace/srv/hw/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 74864ac490f3a00ce10100d8c028bfb72b246a54)
+++ uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 0777f4c53180eac85f3c0c202bca4bf031b12b99)
@@ -61,15 +61,11 @@
  *  @param[in] call The interrupt call.
  */
-#define IRQ_GET_DEVICE(call)			(device_id_t) IPC_GET_IMETHOD(*call)
-
-/** Returns the interrupt status register from the interrupt call.
- *  @param[in] call The interrupt call.
- */
-#define IPC_GET_ISR(call)				(int) IPC_GET_ARG2(*call)
+#define IRQ_GET_DEVICE(call)  (device_id_t) IPC_GET_IMETHOD(*call)
 
 /** DP8390 kernel interrupt command sequence.
  */
-static irq_cmd_t	dp8390_cmds[] = {
-	{	.cmd = CMD_PIO_READ_8,
+static irq_cmd_t dp8390_cmds[] = {
+	{
+		.cmd = CMD_PIO_READ_8,
 		.addr = NULL,
 		.dstarg = 2
@@ -87,5 +83,5 @@
 /** DP8390 kernel interrupt code.
  */
-static irq_code_t	dp8390_code = {
+static irq_code_t dp8390_code = {
 	sizeof(dp8390_cmds) / sizeof(irq_cmd_t),
 	dp8390_cmds
@@ -97,27 +93,32 @@
  *  @param[in] call The interrupt message.
  */
-static void irq_handler(ipc_callid_t iid, ipc_call_t * call)
-{
-	netif_device_t * device;
-	dpeth_t * dep;
+static void irq_handler(ipc_callid_t iid, ipc_call_t *call)
+{
+	netif_device_t *device;
+	dpeth_t *dep;
 	packet_t *received;
 	device_id_t device_id;
 	int phone;
-
+	
 	device_id = IRQ_GET_DEVICE(call);
 	fibril_rwlock_write_lock(&netif_globals.lock);
-	if(find_device(device_id, &device) != EOK){
+	
+	if (find_device(device_id, &device) != EOK) {
 		fibril_rwlock_write_unlock(&netif_globals.lock);
 		return;
 	}
+	
 	dep = (dpeth_t *) device->specific;
-	if (dep->de_mode != DEM_ENABLED){
+	if (dep->de_mode != DEM_ENABLED) {
 		fibril_rwlock_write_unlock(&netif_globals.lock);
 		return;
 	}
-	assert(dep->de_flags &DEF_ENABLED);
+	
+	assert(dep->de_flags & DEF_ENABLED);
+	
 	dep->de_int_pending = 0;
-	dp_check_ints(dep, IPC_GET_ISR(call));
-	if(dep->received_queue){
+	dp_check_ints(dep);
+	
+	if (dep->received_queue) {
 		received = dep->received_queue;
 		phone = device->nil_phone;
@@ -126,7 +127,6 @@
 		fibril_rwlock_write_unlock(&netif_globals.lock);
 		nil_received_msg(phone, device_id, received, SERVICE_NONE);
-	}else{
+	} else
 		fibril_rwlock_write_unlock(&netif_globals.lock);
-	}
 }
 
@@ -136,5 +136,5 @@
  *  @returns The new state.
  */
-static int change_state(netif_device_t * device, device_state_t state)
+static int change_state(netif_device_t *device, device_state_t state)
 {
 	if (device->state != state) {
@@ -150,5 +150,7 @@
 }
 
-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;
 }
@@ -159,12 +161,14 @@
 	eth_stat_t * de_stat;
 	int rc;
-
-	if(! stats){
+	
+	if (!stats)
 		return EBADMEM;
-	}
+	
 	rc = find_device(device_id, &device);
 	if (rc != EOK)
 		return rc;
+	
 	de_stat = &((dpeth_t *) device->specific)->de_stat;
+	
 	null_device_stats(stats);
 	stats->receive_errors = de_stat->ets_recvErr;
@@ -180,17 +184,20 @@
 	stats->send_heartbeat_errors = de_stat->ets_CDheartbeat;
 	stats->send_window_errors = de_stat->ets_OWC;
-	return EOK;
-}
-
-int netif_get_addr_message(device_id_t device_id, measured_string_t *address){
-	netif_device_t * device;
-	int rc;
-
-	if(! address){
+	
+	return EOK;
+}
+
+int netif_get_addr_message(device_id_t device_id, measured_string_t *address)
+{
+	netif_device_t *device;
+	int rc;
+	
+	if (!address)
 		return EBADMEM;
-	}
+	
 	rc = find_device(device_id, &device);
 	if (rc != EOK)
 		return rc;
+	
 	address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
 	address->length = sizeof(ether_addr_t);
@@ -198,20 +205,20 @@
 }
 
-
-
-int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
-	netif_device_t * device;
-	dpeth_t * dep;
-	int rc;
-
+int netif_probe_message(device_id_t device_id, int irq, uintptr_t io)
+{
+	netif_device_t *device;
+	dpeth_t *dep;
+	int rc;
+	
 	device = (netif_device_t *) malloc(sizeof(netif_device_t));
-	if(! device){
+	if (!device)
 		return ENOMEM;
-	}
+	
 	dep = (dpeth_t *) malloc(sizeof(dpeth_t));
-	if(! dep){
+	if (!dep) {
 		free(device);
 		return ENOMEM;
 	}
+	
 	bzero(device, sizeof(netif_device_t));
 	bzero(dep, sizeof(dpeth_t));
@@ -222,4 +229,5 @@
 	dep->de_irq = irq;
 	dep->de_mode = DEM_DISABLED;
+	
 	//TODO address?
 	rc = pio_enable((void *) io, DP8390_IO_SIZE, (void **) &dep->de_base_port);
@@ -228,5 +236,6 @@
 		free(device);
 		return rc;
-	}	
+	}
+	
 	rc = do_probe(dep);
 	if (rc != EOK) {
@@ -235,49 +244,61 @@
 		return rc;
 	}
+	
 	rc = netif_device_map_add(&netif_globals.device_map, device->device_id, device);
-	if (rc != EOK){
+	if (rc != EOK) {
 		free(dep);
 		free(device);
 		return rc;
 	}
-	return EOK;
-}
-
-int netif_send_message(device_id_t device_id, packet_t *packet, services_t sender){
-	netif_device_t * device;
-	dpeth_t * dep;
+	
+	return EOK;
+}
+
+int netif_send_message(device_id_t device_id, packet_t *packet,
+    services_t sender)
+{
+	netif_device_t *device;
+	dpeth_t *dep;
 	packet_t *next;
 	int rc;
-
+	
 	rc = find_device(device_id, &device);
 	if (rc != EOK)
 		return rc;
-	if(device->state != NETIF_ACTIVE){
+	
+	if (device->state != NETIF_ACTIVE){
 		netif_pq_release(packet_get_id(packet));
 		return EFORWARD;
 	}
+	
 	dep = (dpeth_t *) device->specific;
-	// process packet queue
-	do{
+	
+	/* Process packet queue */
+	do {
 		next = pq_detach(packet);
-		if(do_pwrite(dep, packet, false) != EBUSY){
-			netif_pq_release(packet_get_id(packet));
-		}
+		
+		if (do_pwrite(dep, packet, false) != EBUSY)
+			netif_pq_release(packet_get_id(packet));\
+		
 		packet = next;
-	}while(packet);
-	return EOK;
-}
-
-int netif_start_message(netif_device_t * device){
-	dpeth_t * dep;
-	int rc;
-
-	if(device->state != NETIF_ACTIVE){
+	} while(packet);
+	
+	return EOK;
+}
+
+int netif_start_message(netif_device_t * device)
+{
+	dpeth_t *dep;
+	int rc;
+	
+	if (device->state != NETIF_ACTIVE) {
 		dep = (dpeth_t *) device->specific;
 		dp8390_cmds[0].addr = (void *) (uintptr_t) (dep->de_dp8390_port + DP_ISR);
 		dp8390_cmds[2].addr = dp8390_cmds[0].addr;
+		
 		rc = ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code);
 		if (rc != EOK)
 			return rc;
+		
 		rc = do_init(dep, DL_BROAD_REQ);
 		if (rc != EOK) {
@@ -285,13 +306,16 @@
 			return rc;
 		}
+		
 		return change_state(device, NETIF_ACTIVE);
 	}
-	return EOK;
-}
-
-int netif_stop_message(netif_device_t * device){
-	dpeth_t * dep;
-
-	if(device->state != NETIF_STOPPED){
+	
+	return EOK;
+}
+
+int netif_stop_message(netif_device_t * device)
+{
+	dpeth_t *dep;
+	
+	if (device->state != NETIF_STOPPED) {
 		dep = (dpeth_t *) device->specific;
 		do_stop(dep);
@@ -299,12 +323,12 @@
 		return change_state(device, NETIF_STOPPED);
 	}
-	return EOK;
-}
-
-int netif_initialize(void){
+	
+	return EOK;
+}
+
+int netif_initialize(void)
+{
 	sysarg_t phonehash;
-
 	async_set_interrupt_received(irq_handler);
-
 	return ipc_connect_to_me(PHONE_NS, SERVICE_DP8390, 0, 0, &phonehash);
 }
@@ -316,5 +340,5 @@
  *
  */
-static void netif_client_connection(ipc_callid_t iid, ipc_call_t * icall)
+static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)
 {
 	/*
@@ -324,5 +348,5 @@
 	ipc_answer_0(iid, EOK);
 	
-	while(true) {
+	while (true) {
 		ipc_call_t answer;
 		int answer_count;
@@ -348,5 +372,5 @@
 }
 
-/** Starts the module.
+/** Start the module.
  *
  *  @param argc The count of the command line arguments. Ignored parameter.
@@ -359,9 +383,6 @@
 int main(int argc, char *argv[])
 {
-	int rc;
-	
 	/* Start the module */
-	rc = netif_module_start(netif_client_connection);
-	return rc;
+	return netif_module_start(netif_client_connection);
 }
 
