Index: uspace/drv/time/cmos-rtc/cmos-rtc.c
===================================================================
--- uspace/drv/time/cmos-rtc/cmos-rtc.c	(revision 17890231992fbe145333a954a411919a9d0c24c9)
+++ uspace/drv/time/cmos-rtc/cmos-rtc.c	(revision 6f445a67491000572da4fa7897f93fdff426b03f)
@@ -48,5 +48,4 @@
 #include <fibril_synch.h>
 #include <device/hw_res.h>
-#include <devman.h>
 #include <macros.h>
 #include <ipc/clock_ctl.h>
@@ -58,7 +57,4 @@
 
 #define REG_COUNT 2
-
-#define RTC_FROM_FNODE(fnode)  ((rtc_t *) ((fnode)->dev->driver_data))
-#define RTC_FROM_DEV(devnode)  ((rtc_t *) ((devnode)->driver_data))
 
 typedef struct rtc {
@@ -77,4 +73,6 @@
 } rtc_t;
 
+static rtc_t *dev_rtc(ddf_dev_t *dev);
+static rtc_t *fun_rtc(ddf_fun_t *fun);
 static int  rtc_time_get(ddf_fun_t *fun, struct tm *t);
 static int  rtc_time_set(ddf_fun_t *fun, struct tm *t);
@@ -116,4 +114,18 @@
 };
 
+/** Obtain soft state structure from device node */
+static rtc_t *
+dev_rtc(ddf_dev_t *dev)
+{
+	return ddf_dev_data_get(dev);
+}
+
+/** Obtain soft state structure from function node */
+static rtc_t *
+fun_rtc(ddf_fun_t *fun)
+{
+	return dev_rtc(ddf_fun_get_dev(fun));
+}
+
 /** Initialize the RTC driver */
 static void
@@ -136,8 +148,4 @@
 rtc_dev_cleanup(rtc_t *rtc)
 {
-	if (rtc->dev->parent_sess) {
-		async_hangup(rtc->dev->parent_sess);
-		rtc->dev->parent_sess = NULL;
-	}
 }
 
@@ -155,5 +163,5 @@
 
 		ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32
-		    " for device %s", rtc->io_addr, rtc->dev->name);
+		    " for device %s", rtc->io_addr, ddf_dev_get_name(rtc->dev));
 		return false;
 	}
@@ -175,6 +183,7 @@
 	hw_resource_t *res;
 	bool ioport = false;
-
-	ddf_msg(LVL_DEBUG, "rtc_dev_initialize %s", rtc->dev->name);
+	async_sess_t *parent_sess;
+
+	ddf_msg(LVL_DEBUG, "rtc_dev_initialize %s", ddf_dev_get_name(rtc->dev));
 
 	hw_resource_list_t hw_resources;
@@ -183,9 +192,8 @@
 	/* Connect to the parent's driver */
 
-	rtc->dev->parent_sess = devman_parent_device_connect(EXCHANGE_SERIALIZE,
-	    rtc->dev->handle, IPC_FLAG_BLOCKING);
-	if (!rtc->dev->parent_sess) {
+	parent_sess = ddf_dev_parent_sess_create(rtc->dev, EXCHANGE_SERIALIZE);
+	if (!parent_sess) {
 		ddf_msg(LVL_ERROR, "Failed to connect to parent driver\
-		    of device %s.", rtc->dev->name);
+		    of device %s.", ddf_dev_get_name(rtc->dev));
 		rc = ENOENT;
 		goto error;
@@ -193,8 +201,8 @@
 
 	/* Get the HW resources */
-	rc = hw_res_get_resource_list(rtc->dev->parent_sess, &hw_resources);
+	rc = hw_res_get_resource_list(parent_sess, &hw_resources);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Failed to get HW resources\
-		    for device %s", rtc->dev->name);
+		    for device %s", ddf_dev_get_name(rtc->dev));
 		goto error;
 	}
@@ -206,5 +214,6 @@
 			if (res->res.io_range.size < REG_COUNT) {
 				ddf_msg(LVL_ERROR, "I/O range assigned to \
-				    device %s is too small", rtc->dev->name);
+				    device %s is too small",
+				    ddf_dev_get_name(rtc->dev));
 				rc = ELIMIT;
 				goto error;
@@ -213,5 +222,5 @@
 			ioport = true;
 			ddf_msg(LVL_NOTE, "Device %s was assigned I/O address \
-			    0x%x", rtc->dev->name, rtc->io_addr);
+			    0x%x", ddf_dev_get_name(rtc->dev), rtc->io_addr);
 		}
 	}
@@ -220,5 +229,5 @@
 		/* No I/O address assigned to this device */
 		ddf_msg(LVL_ERROR, "Missing HW resource for device %s",
-		    rtc->dev->name);
+		    ddf_dev_get_name(rtc->dev));
 		rc = ENOENT;
 		goto error;
@@ -287,5 +296,5 @@
 	bool bcd_mode;
 	bool pm_mode = false;
-	rtc_t *rtc = RTC_FROM_FNODE(fun);
+	rtc_t *rtc = fun_rtc(fun);
 
 	if (boottime != 0) {
@@ -389,5 +398,5 @@
 	int  reg_a;
 	int  epoch;
-	rtc_t *rtc = RTC_FROM_FNODE(fun);
+	rtc_t *rtc = fun_rtc(fun);
 
 	/* Try to normalize the content of the tm structure */
@@ -486,5 +495,5 @@
 
 	ddf_msg(LVL_DEBUG, "rtc_dev_add %s (handle = %d)",
-	    dev->name, (int) dev->handle);
+	    ddf_dev_get_name(dev), (int) ddf_dev_get_handle(dev));
 
 	rtc = ddf_dev_data_alloc(dev, sizeof(rtc_t));
@@ -513,5 +522,5 @@
 	}
 
-	fun->ops = &rtc_dev_ops;
+	ddf_fun_set_ops(fun, &rtc_dev_ops);
 	rc = ddf_fun_bind(fun);
 	if (rc != EOK) {
@@ -525,5 +534,5 @@
 
 	ddf_msg(LVL_NOTE, "Device %s successfully initialized",
-	    dev->name);
+	    ddf_dev_get_name(dev));
 
 	return rc;
@@ -546,5 +555,5 @@
 rtc_dev_remove(ddf_dev_t *dev)
 {
-	rtc_t *rtc = RTC_FROM_DEV(dev);
+	rtc_t *rtc = dev_rtc(dev);
 	int rc;
 
@@ -573,5 +582,5 @@
 {
 	sysarg_t method = IPC_GET_IMETHOD(*call);
-	rtc_t *rtc = RTC_FROM_FNODE(fun);
+	rtc_t *rtc = fun_rtc(fun);
 	bool batt_ok;
 
@@ -598,5 +607,5 @@
 {
 	int rc;
-	rtc_t *rtc = RTC_FROM_FNODE(fun);
+	rtc_t *rtc = fun_rtc(fun);
 
 	fibril_mutex_lock(&rtc->mutex);
