Ignore:
File:
1 edited

Legend:

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

    racdb5bac r9cd8165  
    5454int nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state)
    5555{
    56         nic_t *nic_data = nic_get_from_ddf_fun(fun);
     56        nic_t *nic_data = (nic_t *) fun->driver_data;
    5757        fibril_rwlock_read_lock(&nic_data->main_lock);
    5858        *state = nic_data->state;
     
    7878        }
    7979
    80         nic_t *nic_data = nic_get_from_ddf_fun(fun);
     80        nic_t *nic_data = (nic_t *) fun->driver_data;
    8181
    8282        fibril_rwlock_write_lock(&nic_data->main_lock);
     
    129129
    130130                fibril_rwlock_write_lock(&nic_data->stats_lock);
    131                 memset(&nic_data->stats, 0, sizeof(nic_device_stats_t));
     131                bzero(&nic_data->stats, sizeof (nic_device_stats_t));
    132132                fibril_rwlock_write_unlock(&nic_data->stats_lock);
    133133
     
    170170int nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size)
    171171{
    172         nic_t *nic_data = nic_get_from_ddf_fun(fun);
     172        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     194        nic_t *nic = (nic_t *) fun->driver_data;
    195195        fibril_rwlock_write_lock(&nic->main_lock);
    196196       
     
    218218{
    219219        assert(address);
    220         nic_t *nic_data = nic_get_from_ddf_fun(fun);
     220        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     238        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     261        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     293        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     328        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     360        nic_t *nic_data = (nic_t *) fun->dev->driver_data;
    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_get_from_ddf_fun(fun);
     384        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     404        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     431        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     454        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     476        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     494        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     522        nic_t *nic_data = (nic_t *) fun->driver_data;
    523523        if (nic_data->on_wol_virtue_add == NULL
    524524                || nic_data->on_wol_virtue_remove == NULL) {
     
    535535                return ENOMEM;
    536536        }
    537         memset(virtue, 0, sizeof(nic_wol_virtue_t));
     537        bzero(virtue, sizeof (nic_wol_virtue_t));
    538538        if (length != 0) {
    539539                virtue->data = malloc(length);
     
    594594int nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id)
    595595{
    596         nic_t *nic_data = nic_get_from_ddf_fun(fun);
     596        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     633        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     671        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     691        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     714        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     737        nic_t *nic_data = (nic_t *) fun->driver_data;
    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_get_from_ddf_fun(fun);
     785        nic_t *nic_data = (nic_t *) fun->driver_data;
    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.