Index: uspace/lib/nic/src/nic_impl.c
===================================================================
--- uspace/lib/nic/src/nic_impl.c	(revision 9cd81655f6cba65cbde69068b36eff82d99f80b8)
+++ uspace/lib/nic/src/nic_impl.c	(revision 034c4202bb5b0bac8287593257471bb34ca29e2e)
@@ -54,5 +54,5 @@
 int nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->main_lock);
 	*state = nic_data->state;
@@ -78,5 +78,5 @@
 	}
 
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 
 	fibril_rwlock_write_lock(&nic_data->main_lock);
@@ -170,5 +170,5 @@
 int nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 
 	fibril_rwlock_read_lock(&nic_data->main_lock);
@@ -192,5 +192,5 @@
 int nic_callback_create_impl(ddf_fun_t *fun)
 {
-	nic_t *nic = (nic_t *) fun->driver_data;
+	nic_t *nic = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic->main_lock);
 	
@@ -218,5 +218,5 @@
 {
 	assert(address);
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->main_lock);
 	memcpy(address, &nic_data->mac, sizeof (nic_address_t));
@@ -236,5 +236,5 @@
 int nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	assert (stats != NULL);
 	fibril_rwlock_read_lock(&nic_data->stats_lock);
@@ -259,5 +259,5 @@
 	size_t max_count, nic_address_t *addr_list, size_t *addr_count)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->rxc_lock);
 	nic_rxc_unicast_get_mode(&nic_data->rx_control, mode, max_count,
@@ -291,5 +291,5 @@
 	}
 
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
 	int rc = ENOTSUP;
@@ -326,5 +326,5 @@
 	size_t max_count, nic_address_t *addr_list, size_t *addr_count)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->rxc_lock);
 	nic_rxc_multicast_get_mode(&nic_data->rx_control, mode, max_count,
@@ -358,5 +358,5 @@
 	}
 
-	nic_t *nic_data = (nic_t *) fun->dev->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
 	int rc = ENOTSUP;
@@ -382,5 +382,5 @@
 int nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->rxc_lock);
 	nic_rxc_broadcast_get_mode(&nic_data->rx_control, mode);
@@ -402,5 +402,5 @@
 int nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
 	int rc = ENOTSUP;
@@ -429,5 +429,5 @@
 	size_t max_count, nic_address_t *addr_list, size_t *addr_count)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->rxc_lock);
 	nic_rxc_blocked_sources_get(&nic_data->rx_control,
@@ -452,5 +452,5 @@
 	const nic_address_t *addr_list, size_t addr_count)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
 	if (nic_data->on_blocked_sources_change) {
@@ -474,5 +474,5 @@
 int nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->rxc_lock);
 	int rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask);
@@ -492,5 +492,5 @@
 int nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_write_lock(&nic_data->rxc_lock);
 	int rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask);
@@ -520,5 +520,5 @@
 	const void *data, size_t length, nic_wv_id_t *new_id)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	if (nic_data->on_wol_virtue_add == NULL
 		|| nic_data->on_wol_virtue_remove == NULL) {
@@ -594,5 +594,5 @@
 int nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	if (nic_data->on_wol_virtue_add == NULL
 		|| nic_data->on_wol_virtue_remove == NULL) {
@@ -631,5 +631,5 @@
 	nic_wv_type_t *type, size_t max_length, void *data, size_t *length)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->wv_lock);
 	const nic_wol_virtue_t *virtue =
@@ -669,5 +669,5 @@
 	size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->wv_lock);
 	int rc = nic_wol_virtues_list(&nic_data->wol_virtues, type,
@@ -689,5 +689,5 @@
 int nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->wv_lock);
 	*count = nic_data->wol_virtues.caps_max[type]
@@ -712,5 +712,5 @@
 	nic_poll_mode_t *mode, struct timeval *period)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->main_lock);
 	*mode = nic_data->poll_mode;
@@ -735,5 +735,5 @@
 	nic_poll_mode_t mode, const struct timeval *period)
 {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	/* If the driver does not implement the poll mode change handler it cannot
 	 * switch off interrupts and this is not supported. */
@@ -783,5 +783,5 @@
  */
 int nic_poll_now_impl(ddf_fun_t *fun) {
-	nic_t *nic_data = (nic_t *) fun->driver_data;
+	nic_t *nic_data = nic_get_from_ddf_fun(fun);
 	fibril_rwlock_read_lock(&nic_data->main_lock);
 	if (nic_data->poll_mode != NIC_POLL_ON_DEMAND) {
