Index: uspace/drv/char/ps2mouse/ps2mouse.c
===================================================================
--- uspace/drv/char/ps2mouse/ps2mouse.c	(revision a455321ecc56b9c24a97830fbdeaa114844e4ce4)
+++ uspace/drv/char/ps2mouse/ps2mouse.c	(revision 2f79a38dd6a40386b181045cc2e754875bf24fec)
@@ -74,5 +74,5 @@
 do { \
 	uint8_t data = 0; \
-	const ssize_t size = chardev_read(session, &data, 1); \
+	const ssize_t size = chardev_read(sess, &data, 1); \
 	if (size != 1) { \
 		ddf_msg(LVL_ERROR, "Failed reading byte: %d)", size);\
@@ -89,5 +89,5 @@
 do { \
 	uint8_t data = (value); \
-	const ssize_t size = chardev_write(session, &data, 1); \
+	const ssize_t size = chardev_write(sess, &data, 1); \
 	if (size < 0 ) { \
 		ddf_msg(LVL_ERROR, "Failed writing byte: %hhx", value); \
@@ -98,5 +98,5 @@
 static int polling_ps2(void *);
 static int polling_intellimouse(void *);
-static int probe_intellimouse(async_sess_t *, bool);
+static int probe_intellimouse(async_exch_t *, bool);
 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
 
@@ -148,15 +148,17 @@
 	/* Probe IntelliMouse extensions. */
 	int (*polling_f)(void*) = polling_ps2;
-	if (probe_intellimouse(mouse->parent_sess, false) == EOK) {
+	async_exch_t *exch = async_exchange_begin(mouse->parent_sess);
+	if (probe_intellimouse(exch, false) == EOK) {
 		ddf_msg(LVL_NOTE, "Enabled IntelliMouse extensions");
 		polling_f = polling_intellimouse;
-		if (probe_intellimouse(mouse->parent_sess, true) == EOK)
+		if (probe_intellimouse(exch, true) == EOK)
 			ddf_msg(LVL_NOTE, "Enabled 4th and 5th button.");
 	}
 	/* Enable mouse data reporting. */
 	uint8_t report = PS2_MOUSE_ENABLE_DATA_REPORT;
-	ssize_t size = chardev_write(mouse->parent_sess, &report, 1);
+	ssize_t size = chardev_write(exch, &report, 1);
 	if (size != 1) {
 		ddf_msg(LVL_ERROR, "Failed to enable data reporting.");
+		async_exchange_end(exch);
 		async_hangup(mouse->parent_sess);
 		ddf_fun_unbind(mouse->mouse_fun);
@@ -166,5 +168,6 @@
 	}
 
-	size = chardev_read(mouse->parent_sess, &report, 1);
+	size = chardev_read(exch, &report, 1);
+	async_exchange_end(exch);
 	if (size != 1 || report != PS2_MOUSE_ACK) {
 		ddf_msg(LVL_ERROR, "Failed to confirm data reporting: %hhx.",
@@ -200,9 +203,10 @@
 	assert(mouse->parent_sess);
 	bool buttons[PS2_BUTTON_COUNT] = {};
+	async_exch_t *parent_exch = async_exchange_begin(mouse->parent_sess);
 	while (1) {
 
 		uint8_t packet[PS2_BUFSIZE] = {};
 		const ssize_t size =
-		    chardev_read(mouse->parent_sess, packet, PS2_BUFSIZE);
+		    chardev_read(parent_exch, packet, PS2_BUFSIZE);
 
 		if (size != PS2_BUFSIZE) {
@@ -242,4 +246,5 @@
 		async_exchange_end(exch);
 	}
+	async_exchange_end(parent_exch);
 }
 
@@ -255,9 +260,12 @@
 	assert(mouse->parent_sess);
 	bool buttons[INTELLIMOUSE_BUTTON_COUNT] = {};
+	async_exch_t *parent_exch = NULL;
 	while (1) {
+		if (!parent_exch)
+			parent_exch = async_exchange_begin(mouse->parent_sess);
 
 		uint8_t packet[INTELLIMOUSE_BUFSIZE] = {};
 		const ssize_t size = chardev_read(
-		    mouse->parent_sess, packet, INTELLIMOUSE_BUFSIZE);
+		    parent_exch, packet, INTELLIMOUSE_BUFSIZE);
 
 		if (size != INTELLIMOUSE_BUFSIZE) {
@@ -316,34 +324,35 @@
 		async_exchange_end(exch);
 	}
+	async_exchange_end(parent_exch);
 }
 
 /** Send magic sequence to initialize IntelliMouse extensions.
- * @param session IPC session to the parent device.
+ * @param exch IPC exchange to the parent device.
  * @param buttons True selects magic sequence for 4th and 5th button,
  * false selects wheel support magic sequence.
  * See http://www.computer-engineering.org/ps2mouse/ for details.
  */
-static int probe_intellimouse(async_sess_t *session, bool buttons)
+static int probe_intellimouse(async_exch_t *exch, bool buttons)
 {
-	assert(session);
-
-	MOUSE_WRITE_BYTE(session, PS2_MOUSE_SET_SAMPLE_RATE);
-	MOUSE_READ_BYTE_TEST(session, PS2_MOUSE_ACK);
-	MOUSE_WRITE_BYTE(session, 200);
-	MOUSE_READ_BYTE_TEST(session, PS2_MOUSE_ACK);
-
-	MOUSE_WRITE_BYTE(session, PS2_MOUSE_SET_SAMPLE_RATE);
-	MOUSE_READ_BYTE_TEST(session, PS2_MOUSE_ACK);
-	MOUSE_WRITE_BYTE(session, buttons ? 200 : 100);
-	MOUSE_READ_BYTE_TEST(session, PS2_MOUSE_ACK);
-
-	MOUSE_WRITE_BYTE(session, PS2_MOUSE_SET_SAMPLE_RATE);
-	MOUSE_READ_BYTE_TEST(session, PS2_MOUSE_ACK);
-	MOUSE_WRITE_BYTE(session, 80);
-	MOUSE_READ_BYTE_TEST(session, PS2_MOUSE_ACK);
-
-	MOUSE_WRITE_BYTE(session, PS2_MOUSE_GET_DEVICE_ID);
-	MOUSE_READ_BYTE_TEST(session, PS2_MOUSE_ACK);
-	MOUSE_READ_BYTE_TEST(session, buttons ? 4 : 3);
+	assert(exch);
+
+	MOUSE_WRITE_BYTE(exch, PS2_MOUSE_SET_SAMPLE_RATE);
+	MOUSE_READ_BYTE_TEST(exch, PS2_MOUSE_ACK);
+	MOUSE_WRITE_BYTE(exch, 200);
+	MOUSE_READ_BYTE_TEST(exch, PS2_MOUSE_ACK);
+
+	MOUSE_WRITE_BYTE(exch, PS2_MOUSE_SET_SAMPLE_RATE);
+	MOUSE_READ_BYTE_TEST(exch, PS2_MOUSE_ACK);
+	MOUSE_WRITE_BYTE(exch, buttons ? 200 : 100);
+	MOUSE_READ_BYTE_TEST(exch, PS2_MOUSE_ACK);
+
+	MOUSE_WRITE_BYTE(exch, PS2_MOUSE_SET_SAMPLE_RATE);
+	MOUSE_READ_BYTE_TEST(exch, PS2_MOUSE_ACK);
+	MOUSE_WRITE_BYTE(exch, 80);
+	MOUSE_READ_BYTE_TEST(exch, PS2_MOUSE_ACK);
+
+	MOUSE_WRITE_BYTE(exch, PS2_MOUSE_GET_DEVICE_ID);
+	MOUSE_READ_BYTE_TEST(exch, PS2_MOUSE_ACK);
+	MOUSE_READ_BYTE_TEST(exch, buttons ? 4 : 3);
 
 	return EOK;
