Index: uspace/app/test_serial/test_serial.c
===================================================================
--- uspace/app/test_serial/test_serial.c	(revision 7bbc389b6ab1bab814d90a950f90c3a5af4f623d)
+++ uspace/app/test_serial/test_serial.c	(revision 663f41c465b5ccd70664cc4423f19a9fe2351eee)
@@ -30,5 +30,5 @@
  * @brief	test the serial port driver - read from the serial port
  * @{
- */ 
+ */
 /**
  * @file
@@ -51,7 +51,8 @@
 
 
-static void print_usage()
+static void print_usage(void)
 {
-	printf("Usage: \n test_serial count \n where count is the number of characters to be read\n");	
+	printf("Usage: \n test_serial count \n where count is the number of "
+	    "characters to be read\n");
 }
 
@@ -61,5 +62,5 @@
 		printf(NAME ": incorrect number of arguments.\n");
 		print_usage();
-		return 0;		
+		return 0;
 	}
 	
@@ -70,19 +71,24 @@
 	device_handle_t handle;
 	
-	if (EOK != (res = devman_device_get_handle("/hw/pci0/00:01.0/com1", &handle, IPC_FLAG_BLOCKING))) {
-		printf(NAME ": could not get the device handle, errno = %d.\n", -res);
+	res = devman_device_get_handle("/hw/pci0/00:01.0/com1", &handle,
+	    IPC_FLAG_BLOCKING);
+	if (EOK != res) {
+		printf(NAME ": could not get the device handle, errno = %d.\n",
+		    -res);
 		return 1;
 	}
 	
-	printf(NAME ": trying to read %d characters from device with handle %d.\n", cnt, handle);	
+	printf(NAME ": trying to read %d characters from device with handle "
+	    "%d.\n", cnt, handle);
 	
-	int phone;
-	if (0 >= (phone = devman_device_connect(handle, IPC_FLAG_BLOCKING))) {
-		printf(NAME ": could not connect to the device, errno = %d.\n", -res);
-		devman_hangup_phone(DEVMAN_CLIENT);		
+	int phone = devman_device_connect(handle, IPC_FLAG_BLOCKING);
+	if (0 > phone) {
+		printf(NAME ": could not connect to the device, errno = %d.\n",
+		    -res);
+		devman_hangup_phone(DEVMAN_CLIENT);
 		return 2;
 	}
 	
-	char *buf = (char *)malloc(cnt+1);
+	char *buf = (char *) malloc(cnt + 1);
 	if (NULL == buf) {
 		printf(NAME ": failed to allocate the input buffer\n");
@@ -94,7 +100,9 @@
 	ipcarg_t old_baud, old_par, old_stop, old_word_size;
 	
-	res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud, &old_par, &old_word_size, &old_stop);	
+	res = ipc_call_sync_0_4(phone, SERIAL_GET_COM_PROPS, &old_baud,
+	    &old_par, &old_word_size, &old_stop);
 	if (EOK != res) {
-		printf(NAME ": failed to get old communication parameters, errno = %d.\n", -res);
+		printf(NAME ": failed to get old communication parameters, "
+		    "errno = %d.\n", -res);
 		devman_hangup_phone(DEVMAN_CLIENT);
 		ipc_hangup(phone);
@@ -103,7 +111,9 @@
 	}
 	
-	res = ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, 1200, SERIAL_NO_PARITY, 8, 1);	
+	res = ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, 1200,
+	    SERIAL_NO_PARITY, 8, 1);
 	if (EOK != res) {
-		printf(NAME ": failed to set communication parameters, errno = %d.\n", -res);
+		printf(NAME ": failed to set communication parameters, errno = "
+		    "%d.\n", -res);
 		devman_hangup_phone(DEVMAN_CLIENT);
 		ipc_hangup(phone);
@@ -112,25 +122,29 @@
 	}
 	
-	
 	int total = 0;
 	int read = 0;
-	while (total < cnt) {		
+	while (total < cnt) {
 		read = read_dev(phone, buf, cnt - total);
 		if (0 > read) {
-			printf(NAME ": failed read from device, errno = %d.\n", -read);
-			ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, old_par, old_word_size, old_stop);	
+			printf(NAME ": failed read from device, errno = %d.\n",
+			    -read);
+			ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
+			    old_par, old_word_size, old_stop);
 			ipc_hangup(phone);
 			devman_hangup_phone(DEVMAN_CLIENT);
 			free(buf);
 			return 5;
-		}		
+		}
 		total += read;
-		if (read > 0) {			
+		if (read > 0) {
 			buf[read] = 0;
-			printf(buf);	
-			// write data back to the device to test the opposite direction of data transfer
+			printf(buf);
+			/*
+			 * Write data back to the device to test the opposite
+			 * direction of data transfer.
+			 */
 			write_dev(phone, buf, read);
-		} else {	
-			usleep(100000);			
+		} else {
+			usleep(100000);
 		}	
 	}
@@ -139,6 +153,7 @@
 	write_dev(phone, (void *)the_end, str_size(the_end));
 	
-	// restore original communication settings
-	ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, old_par, old_word_size, old_stop);	
+	/* restore original communication settings */
+	ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud, old_par,
+	    old_word_size, old_stop);
 	devman_hangup_phone(DEVMAN_CLIENT);
 	ipc_hangup(phone);
@@ -148,5 +163,4 @@
 }
 
-
 /** @}
  */
