Index: uspace/drv/nic/rtl8139/driver.c
===================================================================
--- uspace/drv/nic/rtl8139/driver.c	(revision 9d58539899ea3bf36d74e87b391c0a986e338e26)
+++ uspace/drv/nic/rtl8139/driver.c	(revision f0a27206432178f35b698468a34f870a546b2d4a)
@@ -27,4 +27,7 @@
  */
 
+/* XXX Fix this */
+#define _DDF_DATA_IMPLANT
+
 #include <assert.h>
 #include <errno.h>
@@ -44,6 +47,4 @@
 #include <sysinfo.h>
 #include <ipc/ns.h>
-
-#include <net_checksum.h>
 
 #include <str.h>
@@ -214,13 +215,12 @@
 	rtl8139_regs_lock(rtl8139->io_port);
 
+	async_sess_t *pci_sess =
+		ddf_dev_parent_sess_get(nic_get_ddf_dev(rtl8139->nic_data));
+
 	if (bit_val) {
-		async_sess_t *pci_sess =
-			nic_get_ddf_dev(rtl8139->nic_data)->parent_sess;
 		uint8_t pmen;
 		pci_config_space_read_8(pci_sess, 0x55, &pmen);
 		pci_config_space_write_8(pci_sess, 0x55, pmen | 1 | (1 << 7));
 	} else {
-		async_sess_t *pci_sess =
-			nic_get_ddf_dev(rtl8139->nic_data)->parent_sess;
 		uint8_t pmen;
 		pci_config_space_read_8(pci_sess, 0x55, &pmen);
@@ -620,6 +620,6 @@
 		/* Check if the header is valid, otherwise we are lost in the buffer */
 		if (size == 0 || size > RTL8139_FRAME_MAX_LENGTH) {
-			ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (size: %4"PRIu16", "
-			    "header 0x%4"PRIx16". Offset: %zu)", size, frame_header, 
+			ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (size: %4" PRIu16 ", "
+			    "header 0x%4" PRIx16 ". Offset: %d)", size, frame_header,
 			    rx_offset);
 			goto rx_err;
@@ -1054,11 +1054,6 @@
 	assert(dev);
 
-	if (dev->driver_data)
+	if (ddf_dev_data_get(dev))
 		nic_unbind_and_destroy(dev);
-
-	if (dev->parent_sess != NULL) {
-		async_hangup(dev->parent_sess);
-		dev->parent_sess = NULL;
-	}
 }
 
@@ -1082,22 +1077,22 @@
 
 	if (hw_resources->irqs.count != 1) {
-		ddf_msg(LVL_ERROR, "%s device: unexpected irq count", dev->name);
+		ddf_msg(LVL_ERROR, "%s device: unexpected irq count", ddf_dev_get_name(dev));
 		return EINVAL;
 	};
 	if (hw_resources->io_ranges.count != 1) {
-		ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", dev->name);
+		ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", ddf_dev_get_name(dev));
 		return EINVAL;
 	}
 
 	rtl8139->irq = hw_resources->irqs.irqs[0];
-	ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", dev->name, rtl8139->irq);
+	ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", ddf_dev_get_name(dev), rtl8139->irq);
 
 	rtl8139->io_addr = IOADDR_TO_PTR(hw_resources->io_ranges.ranges[0].address);
 	if (hw_resources->io_ranges.ranges[0].size < RTL8139_IO_SIZE) {
 		ddf_msg(LVL_ERROR, "i/o range assigned to the device "
-		    "%s is too small.", dev->name);
+		    "%s is too small.", ddf_dev_get_name(dev));
 		return EINVAL;
 	}
-	ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", dev->name, rtl8139->io_addr);
+	ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", ddf_dev_get_name(dev), rtl8139->io_addr);
 
 	return EOK;
@@ -1167,5 +1162,5 @@
 
 	/* Allocate buffer for receiver */
-	ddf_msg(LVL_DEBUG, "Allocating receiver buffer of the size %zu bytes",
+	ddf_msg(LVL_DEBUG, "Allocating receiver buffer of the size %d bytes",
 	    RxBUF_TOT_LENGTH);
 
@@ -1194,5 +1189,5 @@
 static int rtl8139_device_initialize(ddf_dev_t *dev)
 {
-	ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", dev->name);
+	ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev));
 
 	int ret = EOK;
@@ -1203,5 +1198,5 @@
 	rtl8139_t *rtl8139 = rtl8139_create_dev_data(dev);
 	if (rtl8139 == NULL) {
-		ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", dev->name);
+		ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", ddf_dev_get_name(dev));
 		return ENOMEM;
 	}
@@ -1248,5 +1243,5 @@
 static int rtl8139_pio_enable(ddf_dev_t *dev)
 {
-	ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", dev->name);
+	ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev));
 
 	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_dev(dev));
@@ -1254,6 +1249,6 @@
 	/* Gain control over port's registers. */
 	if (pio_enable(rtl8139->io_addr, RTL8139_IO_SIZE, &rtl8139->io_port)) {
-		ddf_msg(LVL_ERROR, "Cannot gain the port %lx for device %s.", rtl8139->io_addr,
-		    dev->name);
+		ddf_msg(LVL_ERROR, "Cannot gain the port %p for device %s.", rtl8139->io_addr,
+		    ddf_dev_get_name(dev));
 		return EADDRNOTAVAIL;
 	}
@@ -1301,5 +1296,6 @@
 
 	assert(dev);
-	ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %d)", dev->name, dev->handle);
+	ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %zu)",
+	    ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
 
 	/* Init device structure for rtl8139 */
@@ -1332,5 +1328,5 @@
 	rc = nic_connect_to_services(nic_data);
 	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to connect to services", rc);
+		ddf_msg(LVL_ERROR, "Failed to connect to services (%d)", rc);
 		goto err_irq;
 	}
@@ -1342,6 +1338,6 @@
 	}
 	nic_set_ddf_fun(nic_data, fun);
-	fun->ops = &rtl8139_dev_ops;
-	fun->driver_data = nic_data;
+	ddf_fun_set_ops(fun, &rtl8139_dev_ops);
+	ddf_fun_data_implant(fun, nic_data);
 
 	rc = ddf_fun_bind(fun);
@@ -1357,5 +1353,5 @@
 
 	ddf_msg(LVL_NOTE, "The %s device has been successfully initialized.",
-	    dev->name);
+	    ddf_dev_get_name(dev));
 
 	return EOK;
@@ -2143,7 +2139,8 @@
 		pio_write_32(rtl8139->io_port + TCTR, 0);
 
-		ddf_msg(LVL_DEBUG, "Periodic mode. Interrupt mask %"PRIx16", poll.full_skips %"
-		    PRIu32", last timer %"PRIu32".", rtl8139->int_mask, 
-		    rtl8139->poll_timer.full_skips, rtl8139->poll_timer.last_val);
+		ddf_msg(LVL_DEBUG, "Periodic mode. Interrupt mask %" PRIx16 ", "
+		    "poll.full_skips %zu, last timer %" PRIu32,
+		    rtl8139->int_mask, rtl8139->poll_timer.full_skips,
+		    rtl8139->poll_timer.last_val);
 		break;
 	default:
