Index: uspace/lib/c/generic/device/char.c
===================================================================
--- uspace/lib/c/generic/device/char.c	(revision d47279b2f0d838ae7529b29470835aa5a33ddc2b)
+++ uspace/lib/c/generic/device/char.c	(revision ffdd2b9afd6d3b78a707162fa964d15a14ab2888)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
  /** @addtogroup libc
  * @{
@@ -40,44 +40,48 @@
 #include <stdio.h>
 
-/** Read to or write from the device using its character interface.
- * 
- * Helper function.
- * 
- * @param dev_phone phone to the device.
- * @param buf the buffer for the data read from or written to the device.
- * @param len the maximum length of the data to be read or written.
- * @param read read from the device if true, write to it otherwise.
- * 
- * @return non-negative number of bytes actually read from or written to the device on success,
- * negative error number otherwise.
- * 
+/** Read to or write from device.
+ *
+ * Helper function to read to or write from a device
+ * using its character interface.
+ *
+ * @param dev_phone Phone to the device.
+ * @param buf       Buffer for the data read
+ *                  from or written to the device.
+ * @param len       Maximum length of the data to be
+ *                  read or written.
+ * @param read      Read from the device if true,
+ *                  write to it otherwise.
+ *
+ * @return Non-negative number of bytes actually read
+ *         from or written to the device on success,
+ *         negative error number otherwise.
+ *
  */
-static int rw_dev(int dev_phone, void *buf, size_t len, bool read) 
+static ssize_t rw_dev(int dev_phone, void *buf, size_t len, bool read)
 {
-	ipc_call_t answer;
-	
 	async_serialize_start();
 	
+	ipc_call_t answer;
 	aid_t req;
 	int ret;
 	
 	if (read) {
-		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE), CHAR_READ_DEV, &answer);
-		ret = async_data_read_start(dev_phone, buf, len);		
+		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE),
+		    CHAR_READ_DEV, &answer);
+		ret = async_data_read_start(dev_phone, buf, len);
 	} else {
-		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE), CHAR_WRITE_DEV, &answer);
+		req = async_send_1(dev_phone, DEV_IFACE_ID(CHAR_DEV_IFACE),
+		    CHAR_WRITE_DEV, &answer);
 		ret = async_data_write_start(dev_phone, buf, len);
 	}
 	
 	ipcarg_t rc;
-	if (ret != EOK) {		
+	if (ret != EOK) {
 		async_wait_for(req, &rc);
 		async_serialize_end();
-		if (rc == EOK) {
-			return ret;
-		}
-		else {
-			return (int) rc;
-		}
+		if (rc == EOK)
+			return (ssize_t) ret;
+			
+		return (ssize_t) rc;
 	}
 	
@@ -85,39 +89,45 @@
 	async_serialize_end();
 	
-	ret = (int)rc;
-	if (EOK != ret) {
-		return ret;
-	}
+	ret = (int) rc;
+	if (ret != EOK)
+		return (ssize_t) ret;
 	
-	return IPC_GET_ARG1(answer);	
+	return (ssize_t) IPC_GET_ARG1(answer);
 }
 
-/** Read from the device using its character interface.
- * 
- * @param dev_phone phone to the device.
- * @param buf the output buffer for the data read from the device.
- * @param len the maximum length of the data to be read.
- * 
- * @return non-negative number of bytes actually read from the device on success, negative error number otherwise.
+/** Read from device using its character interface.
+ *
+ * @param dev_phone Phone to the device.
+ * @param buf       Output buffer for the data
+ *                  read from the device.
+ * @param len       Maximum length of the data to be read.
+ *
+ * @return Non-negative number of bytes actually read
+ *         from the device on success, negative error
+ *         number otherwise.
+ *
  */
-int read_dev(int dev_phone, void *buf, size_t len)
-{	
+ssize_t read_dev(int dev_phone, void *buf, size_t len)
+{
 	return rw_dev(dev_phone, buf, len, true);
 }
 
-/** Write to the device using its character interface.
- * 
- * @param dev_phone phone to the device.
- * @param buf the input buffer containg the data to be written to the device.
- * @param len the maximum length of the data to be written.
- * 
- * @return non-negative number of bytes actually written to the device on success, negative error number otherwise.
+/** Write to device using its character interface.
+ *
+ * @param dev_phone Phone to the device.
+ * @param buf       Input buffer containg the data
+ *                  to be written to the device.
+ * @param len       Maximum length of the data to be written.
+ *
+ * @return Non-negative number of bytes actually written
+ *         to the device on success, negative error number
+ *         otherwise.
+ *
  */
-int write_dev(int dev_phone, void *buf, size_t len)
+ssize_t write_dev(int dev_phone, void *buf, size_t len)
 {
 	return rw_dev(dev_phone, buf, len, false);
 }
 
-  
- /** @}
+/** @}
  */
Index: uspace/lib/c/include/device/char.h
===================================================================
--- uspace/lib/c/include/device/char.h	(revision d47279b2f0d838ae7529b29470835aa5a33ddc2b)
+++ uspace/lib/c/include/device/char.h	(revision ffdd2b9afd6d3b78a707162fa964d15a14ab2888)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
+
  /** @addtogroup libc
  * @{
@@ -32,5 +32,5 @@
 /** @file
  */
- 
+
 #ifndef LIBC_DEVICE_HW_RES_H_
 #define LIBC_DEVICE_HW_RES_H_
@@ -38,9 +38,9 @@
 typedef enum {
 	CHAR_READ_DEV = 0,
-	CHAR_WRITE_DEV	
+	CHAR_WRITE_DEV
 } hw_res_funcs_t;
 
-int read_dev(int dev_phone, void *buf, size_t len);
-int write_dev(int dev_phone, void *buf, size_t len);
+ssize_t read_dev(int dev_phone, void *buf, size_t len);
+ssize_t write_dev(int dev_phone, void *buf, size_t len);
 
 #endif
