Index: uspace/srv/hw/netif/dp8390/dp8390.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.c	(revision 74864ac490f3a00ce10100d8c028bfb72b246a54)
+++ uspace/srv/hw/netif/dp8390/dp8390.c	(revision 0777f4c53180eac85f3c0c202bca4bf031b12b99)
@@ -478,93 +478,79 @@
 }
 
-/*===========================================================================*
- *				dp_check_ints				     *
- *===========================================================================*/
-void dp_check_ints(dep, isr)
-dpeth_t *dep;
-int isr;
-{
-	int /*isr,*/ tsr;
+void dp_check_ints(dpeth_t *dep)
+{
+	int isr, tsr;
 	int size, sendq_tail;
-
-	if (!(dep->de_flags &DEF_ENABLED))
+	
+	if (!(dep->de_flags & DEF_ENABLED))
 		fprintf(stderr, "dp8390: got premature interrupt\n");
-
-	for(;;)
-	{
-//		isr = inb_reg0(dep, DP_ISR);
+	
+	for (;;) {
+		isr = inb_reg0(dep, DP_ISR);
 		if (!isr)
 			break;
+		
 		outb_reg0(dep, DP_ISR, isr);
-		if (isr &(ISR_PTX|ISR_TXE))
-		{
-			if (isr &ISR_TXE)
-			{
+		
+		if (isr & (ISR_PTX | ISR_TXE)) {
+			if (isr & ISR_TXE)
 				dep->de_stat.ets_sendErr++;
+			else {
+				tsr = inb_reg0(dep, DP_TSR);
+				
+				if (tsr & TSR_PTX)
+					dep->de_stat.ets_packetT++;
+				
+				if (tsr & TSR_COL)
+					dep->de_stat.ets_collision++;
+				
+				if (tsr & TSR_ABT)
+					dep->de_stat.ets_transAb++;
+				
+				if (tsr & TSR_CRS)
+					dep->de_stat.ets_carrSense++;
+				
+				if ((tsr & TSR_FU) && (++dep->de_stat.ets_fifoUnder <= 10))
+					printf("%s: fifo underrun\n", dep->de_name);
+				
+				if ((tsr & TSR_CDH) && (++dep->de_stat.ets_CDheartbeat <= 10))
+					printf("%s: CD heart beat failure\n", dep->de_name);
+				
+				if (tsr & TSR_OWC)
+					dep->de_stat.ets_OWC++;
 			}
-			else
-			{
-				tsr = inb_reg0(dep, DP_TSR);
-
-				if (tsr &TSR_PTX) dep->de_stat.ets_packetT++;
-#if 0	/* Reserved in later manuals, should be ignored */
-				if (!(tsr &TSR_DFR))
-				{
-					/* In most (all?) implementations of
-					 * the dp8390, this bit is set
-					 * when the packet is not deferred
-					 */
-					dep->de_stat.ets_transDef++;
-				}
-#endif
-				if (tsr &TSR_COL) dep->de_stat.ets_collision++;
-				if (tsr &TSR_ABT) dep->de_stat.ets_transAb++;
-				if (tsr &TSR_CRS) dep->de_stat.ets_carrSense++;
-				if (tsr &TSR_FU
-					&& ++dep->de_stat.ets_fifoUnder <= 10)
-				{
-					printf("%s: fifo underrun\n",
-						dep->de_name);
-				}
-				if (tsr &TSR_CDH
-					&& ++dep->de_stat.ets_CDheartbeat <= 10)
-				{
-					printf("%s: CD heart beat failure\n",
-						dep->de_name);
-				}
-				if (tsr &TSR_OWC) dep->de_stat.ets_OWC++;
-			}
-			sendq_tail= dep->de_sendq_tail;
-
-			if (!(dep->de_sendq[sendq_tail].sq_filled))
-			{
+			
+			sendq_tail = dep->de_sendq_tail;
+			
+			if (!(dep->de_sendq[sendq_tail].sq_filled)) {
 				/* Software bug? */
 				assert(false);
-
+				
 				/* Or hardware bug? */
-				printf(
-				"%s: transmit interrupt, but not sending\n",
-					dep->de_name);
+				printf("%s: transmit interrupt, but not sending\n", dep->de_name);
 				continue;
 			}
-			dep->de_sendq[sendq_tail].sq_filled= 0;
+			
+			dep->de_sendq[sendq_tail].sq_filled = 0;
+			
 			if (++sendq_tail == dep->de_sendq_nr)
-				sendq_tail= 0;
-			dep->de_sendq_tail= sendq_tail;
-			if (dep->de_sendq[sendq_tail].sq_filled)
-			{
-				size= dep->de_sendq[sendq_tail].sq_size;
+				sendq_tail = 0;
+			
+			dep->de_sendq_tail = sendq_tail;
+			
+			if (dep->de_sendq[sendq_tail].sq_filled) {
+				size = dep->de_sendq[sendq_tail].sq_size;
 				outb_reg0(dep, DP_TPSR,
-					dep->de_sendq[sendq_tail].sq_sendpage);
+				    dep->de_sendq[sendq_tail].sq_sendpage);
 				outb_reg0(dep, DP_TBCR1, size >> 8);
-				outb_reg0(dep, DP_TBCR0, size &0xff);
+				outb_reg0(dep, DP_TBCR0, size & 0xff);
 				outb_reg0(dep, DP_CR, CR_TXP | CR_EXTRA);
 			}
+			
 //			if (dep->de_flags &DEF_SEND_AVAIL)
 				dp_send(dep);
 		}
-
-		if (isr &ISR_PRX)
-		{
+		
+		if (isr & ISR_PRX) {
 			/* Only call dp_recv if there is a read request */
 //			if (dep->de_flags) &DEF_READING)
@@ -572,51 +558,42 @@
 		}
 		
-		if (isr &ISR_RXE) dep->de_stat.ets_recvErr++;
-		if (isr &ISR_CNT)
-		{
+		if (isr & ISR_RXE)
+			dep->de_stat.ets_recvErr++;
+		
+		if (isr & ISR_CNT) {
 			dep->de_stat.ets_CRCerr += inb_reg0(dep, DP_CNTR0);
 			dep->de_stat.ets_frameAll += inb_reg0(dep, DP_CNTR1);
 			dep->de_stat.ets_missedP += inb_reg0(dep, DP_CNTR2);
 		}
-		if (isr &ISR_OVW)
-		{
+		
+		if (isr & ISR_OVW) {
 			dep->de_stat.ets_OVW++;
-#if 0
-			{printW(); printf(
-				"%s: got overwrite warning\n", dep->de_name);}
-#endif
-/*			if (dep->de_flags &DEF_READING)
-			{
-				printf(
-"dp_check_ints: strange: overwrite warning and pending read request\n");
+/*			if (dep->de_flags & DEF_READING) {
+				printf("dp_check_ints: strange: overwrite warning and pending read request\n");
 				dp_recv(dep);
 			}
 */		}
-		if (isr &ISR_RDC)
-		{
+		
+		if (isr & ISR_RDC) {
 			/* Nothing to do */
 		}
-		if (isr &ISR_RST)
-		{
-			/* this means we got an interrupt but the ethernet 
+		
+		if (isr & ISR_RST) {
+			/*
+			 * This means we got an interrupt but the ethernet 
 			 * chip is shutdown. We set the flag DEF_STOPPED,
 			 * and continue processing arrived packets. When the
 			 * receive buffer is empty, we reset the dp8390.
 			 */
-#if 0
-			 {printW(); printf(
-				"%s: NIC stopped\n", dep->de_name);}
-#endif
 			dep->de_flags |= DEF_STOPPED;
 			break;
 		}
-		isr = inb_reg0(dep, DP_ISR);
-	}
-//	if ((dep->de_flags &(DEF_READING|DEF_STOPPED)) == 
-//						(DEF_READING|DEF_STOPPED))
-	if ((dep->de_flags &DEF_STOPPED) == DEF_STOPPED)
-	{
-		/* The chip is stopped, and all arrived packets are 
-		 * delivered.
+	}
+	
+//	if ((dep->de_flags & (DEF_READING | DEF_STOPPED)) == (DEF_READING | DEF_STOPPED))
+	if ((dep->de_flags & DEF_STOPPED) == DEF_STOPPED) {
+		/*
+		 * The chip is stopped, and all arrived packets
+		 * are delivered.
 		 */
 		dp_reset(dep);
Index: uspace/srv/hw/netif/dp8390/dp8390_drv.h
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_drv.h	(revision 74864ac490f3a00ce10100d8c028bfb72b246a54)
+++ uspace/srv/hw/netif/dp8390/dp8390_drv.h	(revision 0777f4c53180eac85f3c0c202bca4bf031b12b99)
@@ -55,7 +55,6 @@
 /** Processes the interrupt.
  *  @param[in,out] dep The network interface structure.
- *  @param[in] isr The interrupt status register.
  */
-void dp_check_ints(dpeth_t *dep, int isr);
+void dp_check_ints(dpeth_t *dep);
 
 /** Probes and initializes the network interface.
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);
 }
 
