Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_impl.c

    r9d58539 r56fd7cf  
    5454int nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state)
    5555{
    56         nic_t *nic_data = (nic_t *) fun->driver_data;
     56        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    5757        fibril_rwlock_read_lock(&nic_data->main_lock);
    5858        *state = nic_data->state;
     
    7878        }
    7979
    80         nic_t *nic_data = (nic_t *) fun->driver_data;
     80        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    8181
    8282        fibril_rwlock_write_lock(&nic_data->main_lock);
     
    170170int nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size)
    171171{
    172         nic_t *nic_data = (nic_t *) fun->driver_data;
     172        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    173173
    174174        fibril_rwlock_read_lock(&nic_data->main_lock);
     
    192192int nic_callback_create_impl(ddf_fun_t *fun)
    193193{
    194         nic_t *nic = (nic_t *) fun->driver_data;
     194        nic_t *nic = nic_get_from_ddf_fun(fun);
    195195        fibril_rwlock_write_lock(&nic->main_lock);
    196196       
     
    218218{
    219219        assert(address);
    220         nic_t *nic_data = (nic_t *) fun->driver_data;
     220        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    221221        fibril_rwlock_read_lock(&nic_data->main_lock);
    222222        memcpy(address, &nic_data->mac, sizeof (nic_address_t));
     
    236236int nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats)
    237237{
    238         nic_t *nic_data = (nic_t *) fun->driver_data;
     238        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    239239        assert (stats != NULL);
    240240        fibril_rwlock_read_lock(&nic_data->stats_lock);
     
    259259        size_t max_count, nic_address_t *addr_list, size_t *addr_count)
    260260{
    261         nic_t *nic_data = (nic_t *) fun->driver_data;
     261        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    262262        fibril_rwlock_read_lock(&nic_data->rxc_lock);
    263263        nic_rxc_unicast_get_mode(&nic_data->rx_control, mode, max_count,
     
    291291        }
    292292
    293         nic_t *nic_data = (nic_t *) fun->driver_data;
     293        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    294294        fibril_rwlock_write_lock(&nic_data->rxc_lock);
    295295        int rc = ENOTSUP;
     
    326326        size_t max_count, nic_address_t *addr_list, size_t *addr_count)
    327327{
    328         nic_t *nic_data = (nic_t *) fun->driver_data;
     328        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    329329        fibril_rwlock_read_lock(&nic_data->rxc_lock);
    330330        nic_rxc_multicast_get_mode(&nic_data->rx_control, mode, max_count,
     
    358358        }
    359359
    360         nic_t *nic_data = (nic_t *) fun->dev->driver_data;
     360        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    361361        fibril_rwlock_write_lock(&nic_data->rxc_lock);
    362362        int rc = ENOTSUP;
     
    382382int nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode)
    383383{
    384         nic_t *nic_data = (nic_t *) fun->driver_data;
     384        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    385385        fibril_rwlock_read_lock(&nic_data->rxc_lock);
    386386        nic_rxc_broadcast_get_mode(&nic_data->rx_control, mode);
     
    402402int nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode)
    403403{
    404         nic_t *nic_data = (nic_t *) fun->driver_data;
     404        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    405405        fibril_rwlock_write_lock(&nic_data->rxc_lock);
    406406        int rc = ENOTSUP;
     
    429429        size_t max_count, nic_address_t *addr_list, size_t *addr_count)
    430430{
    431         nic_t *nic_data = (nic_t *) fun->driver_data;
     431        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    432432        fibril_rwlock_read_lock(&nic_data->rxc_lock);
    433433        nic_rxc_blocked_sources_get(&nic_data->rx_control,
     
    452452        const nic_address_t *addr_list, size_t addr_count)
    453453{
    454         nic_t *nic_data = (nic_t *) fun->driver_data;
     454        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    455455        fibril_rwlock_write_lock(&nic_data->rxc_lock);
    456456        if (nic_data->on_blocked_sources_change) {
     
    474474int nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask)
    475475{
    476         nic_t *nic_data = (nic_t *) fun->driver_data;
     476        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    477477        fibril_rwlock_read_lock(&nic_data->rxc_lock);
    478478        int rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask);
     
    492492int nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask)
    493493{
    494         nic_t *nic_data = (nic_t *) fun->driver_data;
     494        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    495495        fibril_rwlock_write_lock(&nic_data->rxc_lock);
    496496        int rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask);
     
    520520        const void *data, size_t length, nic_wv_id_t *new_id)
    521521{
    522         nic_t *nic_data = (nic_t *) fun->driver_data;
     522        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    523523        if (nic_data->on_wol_virtue_add == NULL
    524524                || nic_data->on_wol_virtue_remove == NULL) {
     
    594594int nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id)
    595595{
    596         nic_t *nic_data = (nic_t *) fun->driver_data;
     596        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    597597        if (nic_data->on_wol_virtue_add == NULL
    598598                || nic_data->on_wol_virtue_remove == NULL) {
     
    631631        nic_wv_type_t *type, size_t max_length, void *data, size_t *length)
    632632{
    633         nic_t *nic_data = (nic_t *) fun->driver_data;
     633        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    634634        fibril_rwlock_read_lock(&nic_data->wv_lock);
    635635        const nic_wol_virtue_t *virtue =
     
    669669        size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
    670670{
    671         nic_t *nic_data = (nic_t *) fun->driver_data;
     671        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    672672        fibril_rwlock_read_lock(&nic_data->wv_lock);
    673673        int rc = nic_wol_virtues_list(&nic_data->wol_virtues, type,
     
    689689int nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count)
    690690{
    691         nic_t *nic_data = (nic_t *) fun->driver_data;
     691        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    692692        fibril_rwlock_read_lock(&nic_data->wv_lock);
    693693        *count = nic_data->wol_virtues.caps_max[type]
     
    712712        nic_poll_mode_t *mode, struct timeval *period)
    713713{
    714         nic_t *nic_data = (nic_t *) fun->driver_data;
     714        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    715715        fibril_rwlock_read_lock(&nic_data->main_lock);
    716716        *mode = nic_data->poll_mode;
     
    735735        nic_poll_mode_t mode, const struct timeval *period)
    736736{
    737         nic_t *nic_data = (nic_t *) fun->driver_data;
     737        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    738738        /* If the driver does not implement the poll mode change handler it cannot
    739739         * switch off interrupts and this is not supported. */
     
    783783 */
    784784int 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);
    786786        fibril_rwlock_read_lock(&nic_data->main_lock);
    787787        if (nic_data->poll_mode != NIC_POLL_ON_DEMAND) {
Note: See TracChangeset for help on using the changeset viewer.