Index: uspace/srv/hw/bus/cuda_adb/cuda_adb.c
===================================================================
--- uspace/srv/hw/bus/cuda_adb/cuda_adb.c	(revision 943aaf1b5f329ccc9f76244a88cef32d566f8576)
+++ uspace/srv/hw/bus/cuda_adb/cuda_adb.c	(revision 7e55bed7fbb405bfe6a03433bffdbab93bb208e2)
@@ -55,23 +55,23 @@
 
 static void cuda_connection(ipc_callid_t, ipc_call_t *, void *);
-static int cuda_init(cuda_instance_t *);
+static int cuda_init(cuda_t *);
 static void cuda_irq_handler(ipc_callid_t, ipc_call_t *, void *);
 
-static void cuda_irq_listen(cuda_instance_t *);
-static void cuda_irq_receive(cuda_instance_t *);
-static void cuda_irq_rcv_end(cuda_instance_t *, void *, size_t *);
-static void cuda_irq_send_start(cuda_instance_t *);
-static void cuda_irq_send(cuda_instance_t *);
-
-static void cuda_packet_handle(cuda_instance_t *, uint8_t *, size_t);
-static void cuda_send_start(cuda_instance_t *);
-static void cuda_autopoll_set(cuda_instance_t *, bool);
-
-static void adb_packet_handle(cuda_instance_t *, uint8_t *, size_t, bool);
+static void cuda_irq_listen(cuda_t *);
+static void cuda_irq_receive(cuda_t *);
+static void cuda_irq_rcv_end(cuda_t *, void *, size_t *);
+static void cuda_irq_send_start(cuda_t *);
+static void cuda_irq_send(cuda_t *);
+
+static void cuda_packet_handle(cuda_t *, uint8_t *, size_t);
+static void cuda_send_start(cuda_t *);
+static void cuda_autopoll_set(cuda_t *, bool);
+
+static void adb_packet_handle(cuda_t *, uint8_t *, size_t, bool);
 
 static irq_pio_range_t cuda_ranges[] = {
 	{
 		.base = 0,
-		.size = sizeof(cuda_t)
+		.size = sizeof(cuda_regs_t)
 	}
 };
@@ -110,10 +110,10 @@
 {
 	service_id_t service_id;
-	cuda_instance_t cinst;
+	cuda_t cinst;
 	int rc;
 	int i;
 
 	printf(NAME ": VIA-CUDA Apple Desktop Bus driver\n");
-	
+
 	for (i = 0; i < ADB_MAX_ADDR; ++i) {
 		cinst.adb_dev[i].client_sess = NULL;
@@ -145,5 +145,5 @@
 	cinst.adb_dev[9].service_id = service_id;
 
-	if (cuda_init(&cinst) < 0) {
+	if (cuda_init(&cinst) != EOK) {
 		printf("cuda_init() failed\n");
 		return 1;
@@ -163,5 +163,5 @@
 	sysarg_t method;
 	service_id_t dsid;
-	cuda_instance_t *cuda = (cuda_instance_t *) arg;
+	cuda_t *cuda = (cuda_t *) arg;
 	int dev_addr, i;
 
@@ -187,5 +187,5 @@
 		callid = async_get_call(&call);
 		method = IPC_GET_IMETHOD(call);
-		
+
 		if (!method) {
 			/* The other side has hung up. */
@@ -193,5 +193,5 @@
 			return;
 		}
-		
+
 		async_sess_t *sess =
 		    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
@@ -199,5 +199,5 @@
 			if (cuda->adb_dev[dev_addr].client_sess == NULL) {
 				cuda->adb_dev[dev_addr].client_sess = sess;
-				
+
 				/*
 				 * A hack so that we send the data to the session
@@ -208,5 +208,5 @@
 						cuda->adb_dev[i].client_sess = sess;
 				}
-				
+
 				async_answer_0(callid, EOK);
 			} else
@@ -217,13 +217,17 @@
 }
 
-static int cuda_init(cuda_instance_t *cuda)
-{
+static int cuda_init(cuda_t *cuda)
+{
+	int rc;
+
 	if (sysinfo_get_value("cuda.address.physical", &(cuda->cuda_physical)) != EOK)
-		return -1;
-	
+		return EIO;
+
 	void *vaddr;
-	if (pio_enable((void *) cuda->cuda_physical, sizeof(cuda_t), &vaddr) != 0)
-		return -1;
-	
+	rc = pio_enable((void *) cuda->cuda_physical, sizeof(cuda_regs_t),
+	    &vaddr);
+	if (rc != EOK)
+		return rc;
+
 	cuda->regs = vaddr;
 	cuda->xstate = cx_listen;
@@ -237,5 +241,6 @@
 
 	cuda_irq_code.ranges[0].base = (uintptr_t) cuda->cuda_physical;
-	cuda_irq_code.cmds[0].addr = (void *) &((cuda_t *) cuda->cuda_physical)->ifr;
+	cuda_irq_code.cmds[0].addr = (void *) &((cuda_regs_t *)
+	    cuda->cuda_physical)->ifr;
 	async_irq_subscribe(10, cuda_irq_handler, cuda, &cuda_irq_code);
 
@@ -247,5 +252,5 @@
 	cuda_autopoll_set(cuda, true);
 
-	return 0;
+	return EOK;
 }
 
@@ -253,5 +258,5 @@
 {
 	uint8_t rbuf[CUDA_RCV_BUF_SIZE];
-	cuda_instance_t *cuda = (cuda_instance_t *)arg;
+	cuda_t *cuda = (cuda_t *)arg;
 	size_t len;
 	bool handle;
@@ -280,5 +285,5 @@
 		break;
 	}
-	
+
 	/* Lower IFR.SR_INT so that CUDA can generate next int by raising it. */
 	pio_write_8(&cuda->regs->ifr, SR_INT);
@@ -297,13 +302,13 @@
  * @param cuda CUDA instance
  */
-static void cuda_irq_listen(cuda_instance_t *cuda)
+static void cuda_irq_listen(cuda_t *cuda)
 {
 	uint8_t b = pio_read_8(&cuda->regs->b);
-	
+
 	if ((b & TREQ) != 0) {
 		printf("cuda_irq_listen: no TREQ?!\n");
 		return;
 	}
-	
+
 	pio_write_8(&cuda->regs->b, b & ~TIP);
 	cuda->xstate = cx_receive;
@@ -316,12 +321,12 @@
  * @param cuda CUDA instance
  */
-static void cuda_irq_receive(cuda_instance_t *cuda)
+static void cuda_irq_receive(cuda_t *cuda)
 {
 	uint8_t data = pio_read_8(&cuda->regs->sr);
 	if (cuda->bidx < CUDA_RCV_BUF_SIZE)
 		cuda->rcv_buf[cuda->bidx++] = data;
-	
+
 	uint8_t b = pio_read_8(&cuda->regs->b);
-	
+
 	if ((b & TREQ) == 0) {
 		pio_write_8(&cuda->regs->b, b ^ TACK);
@@ -341,8 +346,8 @@
  * @param len Place to store length of received packet
  */
-static void cuda_irq_rcv_end(cuda_instance_t *cuda, void *buf, size_t *len)
+static void cuda_irq_rcv_end(cuda_t *cuda, void *buf, size_t *len)
 {
 	uint8_t b = pio_read_8(&cuda->regs->b);
-	
+
 	if ((b & TREQ) == 0) {
 		cuda->xstate = cx_receive;
@@ -352,5 +357,5 @@
 		cuda_send_start(cuda);
 	}
-	
+
 	memcpy(buf, cuda->rcv_buf, cuda->bidx);
 	*len = cuda->bidx;
@@ -364,5 +369,5 @@
  * @param cuda CUDA instance
  */
-static void cuda_irq_send_start(cuda_instance_t *cuda)
+static void cuda_irq_send_start(cuda_t *cuda)
 {
 	uint8_t b;
@@ -394,5 +399,5 @@
  * @param cuda CUDA instance
  */
-static void cuda_irq_send(cuda_instance_t *cuda)
+static void cuda_irq_send(cuda_t *cuda)
 {
 	if (cuda->bidx < cuda->snd_bytes) {
@@ -416,5 +421,5 @@
 }
 
-static void cuda_packet_handle(cuda_instance_t *cuda, uint8_t *data, size_t len)
+static void cuda_packet_handle(cuda_t *cuda, uint8_t *data, size_t len)
 {
 	if (data[0] != PT_ADB)
@@ -426,6 +431,6 @@
 }
 
-static void adb_packet_handle(cuda_instance_t *cuda, uint8_t *data,
-    size_t size, bool autopoll)
+static void adb_packet_handle(cuda_t *cuda, uint8_t *data, size_t size,
+    bool autopoll)
 {
 	uint8_t dev_addr;
@@ -466,5 +471,5 @@
 }
 
-static void cuda_autopoll_set(cuda_instance_t *cuda, bool enable)
+static void cuda_autopoll_set(cuda_t *cuda, bool enable)
 {
 	cuda->snd_buf[0] = PT_CUDA;
@@ -477,5 +482,5 @@
 }
 
-static void cuda_send_start(cuda_instance_t *cuda)
+static void cuda_send_start(cuda_t *cuda)
 {
 	assert(cuda->xstate == cx_listen);
