Ignore:
File:
1 edited

Legend:

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

    r8d7ec69d r01380b1  
    4040#include <ns.h>
    4141#include "nic_driver.h"
    42 #include "nic_ev.h"
    4342#include "nic_impl.h"
    4443
     
    8685        }
    8786        if (state == NIC_STATE_ACTIVE) {
    88                 if (nic_data->client_session == NULL || nic_data->device_id < 0) {
     87                if (nic_data->nil_session == NULL || nic_data->device_id < 0) {
    8988                        fibril_rwlock_write_unlock(&nic_data->main_lock);
    9089                        return EINVAL;
     
    116115        if (state == NIC_STATE_STOPPED) {
    117116                /* Notify upper layers that we are reseting the MAC */
    118                 int rc = nic_ev_addr_changed(nic_data->client_session,
     117                int rc = nil_addr_changed_msg(nic_data->nil_session,
    119118                        nic_data->device_id, &nic_data->default_mac);
    120119                nic_data->poll_mode = nic_data->default_poll_mode;
     
    149148        nic_data->state = state;
    150149
    151         nic_ev_device_state(nic_data->client_session, nic_data->device_id, state);
     150        nil_device_state_msg(nic_data->nil_session, nic_data->device_id, state);
    152151
    153152        fibril_rwlock_write_unlock(&nic_data->main_lock);
     
    182181
    183182/**
    184  * Default implementation of the connect_client method.
    185  * Creates callback connection to the client.
     183 * Default implementation of the connect_to_nil method.
     184 * Connects the driver to the NIL service.
    186185 *
    187186 * @param       fun
     187 * @param       nil_service     ID of the server implementing the NIL service
    188188 * @param       device_id       ID of the device as used in higher layers
    189189 *
    190  * @return EOK          On success, or negative error code.
    191  */
    192 int nic_callback_create_impl(ddf_fun_t *fun, nic_device_id_t device_id)
    193 {
    194         nic_t *nic = (nic_t *) fun->driver_data;
    195         fibril_rwlock_write_lock(&nic->main_lock);
     190 * @return EOK          If the services were bound
     191 * @return                      Negative error code from service_connect_blocking
     192 */
     193int nic_connect_to_nil_impl(ddf_fun_t *fun, services_t nil_service,
     194    nic_device_id_t device_id)
     195{
     196        nic_t *nic_data = (nic_t *) fun->driver_data;
     197        fibril_rwlock_write_lock(&nic_data->main_lock);
    196198       
    197         nic->device_id = device_id;
     199        nic_data->device_id = device_id;
    198200       
    199         nic->client_session = async_callback_receive(EXCHANGE_SERIALIZE);
    200         if (nic->client_session == NULL) {
    201                 fibril_rwlock_write_unlock(&nic->main_lock);
    202                 return ENOMEM;
     201        nic_data->nil_session = service_connect_blocking(EXCHANGE_SERIALIZE,
     202            nil_service, 0, 0);
     203        if (nic_data->nil_session != NULL) {
     204                fibril_rwlock_write_unlock(&nic_data->main_lock);
     205                return EOK;
    203206        }
    204207       
    205         fibril_rwlock_write_unlock(&nic->main_lock);
    206         return EOK;
     208        fibril_rwlock_write_unlock(&nic_data->main_lock);
     209        return EHANGUP;
    207210}
    208211
Note: See TracChangeset for help on using the changeset viewer.