Changes in uspace/lib/nic/src/nic_impl.c [9d58539:56fd7cf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_impl.c
r9d58539 r56fd7cf 54 54 int nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state) 55 55 { 56 nic_t *nic_data = (nic_t *) fun->driver_data;56 nic_t *nic_data = nic_get_from_ddf_fun(fun); 57 57 fibril_rwlock_read_lock(&nic_data->main_lock); 58 58 *state = nic_data->state; … … 78 78 } 79 79 80 nic_t *nic_data = (nic_t *) fun->driver_data;80 nic_t *nic_data = nic_get_from_ddf_fun(fun); 81 81 82 82 fibril_rwlock_write_lock(&nic_data->main_lock); … … 170 170 int nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size) 171 171 { 172 nic_t *nic_data = (nic_t *) fun->driver_data;172 nic_t *nic_data = nic_get_from_ddf_fun(fun); 173 173 174 174 fibril_rwlock_read_lock(&nic_data->main_lock); … … 192 192 int nic_callback_create_impl(ddf_fun_t *fun) 193 193 { 194 nic_t *nic = (nic_t *) fun->driver_data;194 nic_t *nic = nic_get_from_ddf_fun(fun); 195 195 fibril_rwlock_write_lock(&nic->main_lock); 196 196 … … 218 218 { 219 219 assert(address); 220 nic_t *nic_data = (nic_t *) fun->driver_data;220 nic_t *nic_data = nic_get_from_ddf_fun(fun); 221 221 fibril_rwlock_read_lock(&nic_data->main_lock); 222 222 memcpy(address, &nic_data->mac, sizeof (nic_address_t)); … … 236 236 int nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats) 237 237 { 238 nic_t *nic_data = (nic_t *) fun->driver_data;238 nic_t *nic_data = nic_get_from_ddf_fun(fun); 239 239 assert (stats != NULL); 240 240 fibril_rwlock_read_lock(&nic_data->stats_lock); … … 259 259 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 260 260 { 261 nic_t *nic_data = (nic_t *) fun->driver_data;261 nic_t *nic_data = nic_get_from_ddf_fun(fun); 262 262 fibril_rwlock_read_lock(&nic_data->rxc_lock); 263 263 nic_rxc_unicast_get_mode(&nic_data->rx_control, mode, max_count, … … 291 291 } 292 292 293 nic_t *nic_data = (nic_t *) fun->driver_data;293 nic_t *nic_data = nic_get_from_ddf_fun(fun); 294 294 fibril_rwlock_write_lock(&nic_data->rxc_lock); 295 295 int rc = ENOTSUP; … … 326 326 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 327 327 { 328 nic_t *nic_data = (nic_t *) fun->driver_data;328 nic_t *nic_data = nic_get_from_ddf_fun(fun); 329 329 fibril_rwlock_read_lock(&nic_data->rxc_lock); 330 330 nic_rxc_multicast_get_mode(&nic_data->rx_control, mode, max_count, … … 358 358 } 359 359 360 nic_t *nic_data = (nic_t *) fun->dev->driver_data;360 nic_t *nic_data = nic_get_from_ddf_fun(fun); 361 361 fibril_rwlock_write_lock(&nic_data->rxc_lock); 362 362 int rc = ENOTSUP; … … 382 382 int nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode) 383 383 { 384 nic_t *nic_data = (nic_t *) fun->driver_data;384 nic_t *nic_data = nic_get_from_ddf_fun(fun); 385 385 fibril_rwlock_read_lock(&nic_data->rxc_lock); 386 386 nic_rxc_broadcast_get_mode(&nic_data->rx_control, mode); … … 402 402 int nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode) 403 403 { 404 nic_t *nic_data = (nic_t *) fun->driver_data;404 nic_t *nic_data = nic_get_from_ddf_fun(fun); 405 405 fibril_rwlock_write_lock(&nic_data->rxc_lock); 406 406 int rc = ENOTSUP; … … 429 429 size_t max_count, nic_address_t *addr_list, size_t *addr_count) 430 430 { 431 nic_t *nic_data = (nic_t *) fun->driver_data;431 nic_t *nic_data = nic_get_from_ddf_fun(fun); 432 432 fibril_rwlock_read_lock(&nic_data->rxc_lock); 433 433 nic_rxc_blocked_sources_get(&nic_data->rx_control, … … 452 452 const nic_address_t *addr_list, size_t addr_count) 453 453 { 454 nic_t *nic_data = (nic_t *) fun->driver_data;454 nic_t *nic_data = nic_get_from_ddf_fun(fun); 455 455 fibril_rwlock_write_lock(&nic_data->rxc_lock); 456 456 if (nic_data->on_blocked_sources_change) { … … 474 474 int nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask) 475 475 { 476 nic_t *nic_data = (nic_t *) fun->driver_data;476 nic_t *nic_data = nic_get_from_ddf_fun(fun); 477 477 fibril_rwlock_read_lock(&nic_data->rxc_lock); 478 478 int rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask); … … 492 492 int nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask) 493 493 { 494 nic_t *nic_data = (nic_t *) fun->driver_data;494 nic_t *nic_data = nic_get_from_ddf_fun(fun); 495 495 fibril_rwlock_write_lock(&nic_data->rxc_lock); 496 496 int rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask); … … 520 520 const void *data, size_t length, nic_wv_id_t *new_id) 521 521 { 522 nic_t *nic_data = (nic_t *) fun->driver_data;522 nic_t *nic_data = nic_get_from_ddf_fun(fun); 523 523 if (nic_data->on_wol_virtue_add == NULL 524 524 || nic_data->on_wol_virtue_remove == NULL) { … … 594 594 int nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id) 595 595 { 596 nic_t *nic_data = (nic_t *) fun->driver_data;596 nic_t *nic_data = nic_get_from_ddf_fun(fun); 597 597 if (nic_data->on_wol_virtue_add == NULL 598 598 || nic_data->on_wol_virtue_remove == NULL) { … … 631 631 nic_wv_type_t *type, size_t max_length, void *data, size_t *length) 632 632 { 633 nic_t *nic_data = (nic_t *) fun->driver_data;633 nic_t *nic_data = nic_get_from_ddf_fun(fun); 634 634 fibril_rwlock_read_lock(&nic_data->wv_lock); 635 635 const nic_wol_virtue_t *virtue = … … 669 669 size_t max_count, nic_wv_id_t *id_list, size_t *id_count) 670 670 { 671 nic_t *nic_data = (nic_t *) fun->driver_data;671 nic_t *nic_data = nic_get_from_ddf_fun(fun); 672 672 fibril_rwlock_read_lock(&nic_data->wv_lock); 673 673 int rc = nic_wol_virtues_list(&nic_data->wol_virtues, type, … … 689 689 int nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count) 690 690 { 691 nic_t *nic_data = (nic_t *) fun->driver_data;691 nic_t *nic_data = nic_get_from_ddf_fun(fun); 692 692 fibril_rwlock_read_lock(&nic_data->wv_lock); 693 693 *count = nic_data->wol_virtues.caps_max[type] … … 712 712 nic_poll_mode_t *mode, struct timeval *period) 713 713 { 714 nic_t *nic_data = (nic_t *) fun->driver_data;714 nic_t *nic_data = nic_get_from_ddf_fun(fun); 715 715 fibril_rwlock_read_lock(&nic_data->main_lock); 716 716 *mode = nic_data->poll_mode; … … 735 735 nic_poll_mode_t mode, const struct timeval *period) 736 736 { 737 nic_t *nic_data = (nic_t *) fun->driver_data;737 nic_t *nic_data = nic_get_from_ddf_fun(fun); 738 738 /* If the driver does not implement the poll mode change handler it cannot 739 739 * switch off interrupts and this is not supported. */ … … 783 783 */ 784 784 int nic_poll_now_impl(ddf_fun_t *fun) { 785 nic_t *nic_data = (nic_t *) fun->driver_data;785 nic_t *nic_data = nic_get_from_ddf_fun(fun); 786 786 fibril_rwlock_read_lock(&nic_data->main_lock); 787 787 if (nic_data->poll_mode != NIC_POLL_ON_DEMAND) {
Note:
See TracChangeset
for help on using the changeset viewer.