Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/devman.c

    r79ae36dd rc7bbf029  
    564564        dev_node_t *dev;
    565565        link_t *link;
     566        int phone;
    566567
    567568        log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
     
    569570
    570571        fibril_mutex_lock(&driver->driver_mutex);
    571        
    572         async_exch_t *exch = async_exchange_begin(driver->sess);
    573         async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch,
    574             DRIVER_DEVMAN, 0, 0);
    575         async_exchange_end(exch);
    576 
    577         if (!sess) {
     572
     573        phone = async_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
     574
     575        if (phone < 0) {
    578576                fibril_mutex_unlock(&driver->driver_mutex);
    579577                return;
     
    604602                fibril_mutex_unlock(&driver->driver_mutex);
    605603
    606                 add_device(sess, driver, dev, tree);
     604                add_device(phone, driver, dev, tree);
    607605
    608606                /*
     
    625623        }
    626624
    627         async_hangup(sess);
     625        async_hangup(phone);
    628626
    629627        /*
     
    675673        list_initialize(&drv->devices);
    676674        fibril_mutex_initialize(&drv->driver_mutex);
    677         drv->sess = NULL;
     675        drv->phone = -1;
    678676}
    679677
     
    739737 * @param node          The device's node in the device tree.
    740738 */
    741 void add_device(async_sess_t *sess, driver_t *drv, dev_node_t *dev,
    742     dev_tree_t *tree)
     739void add_device(int phone, driver_t *drv, dev_node_t *dev, dev_tree_t *tree)
    743740{
    744741        /*
     
    749746            drv->name, dev->pfun->name);
    750747       
     748        sysarg_t rc;
     749        ipc_call_t answer;
     750       
    751751        /* Send the device to the driver. */
    752752        devman_handle_t parent_handle;
     
    756756                parent_handle = 0;
    757757        }
    758        
    759         async_exch_t *exch = async_exchange_begin(sess);
    760        
    761         ipc_call_t answer;
    762         aid_t req = async_send_2(exch, DRIVER_ADD_DEVICE, dev->handle,
     758
     759        aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, dev->handle,
    763760            parent_handle, &answer);
    764761       
    765         /* Send the device name to the driver. */
    766         sysarg_t rc = async_data_write_start(exch, dev->pfun->name,
     762        /* Send the device's name to the driver. */
     763        rc = async_data_write_start(phone, dev->pfun->name,
    767764            str_size(dev->pfun->name) + 1);
    768        
    769         async_exchange_end(exch);
    770        
    771765        if (rc != EOK) {
    772766                /* TODO handle error */
     
    829823        if (is_running) {
    830824                /* Notify the driver about the new device. */
    831                 async_exch_t *exch = async_exchange_begin(drv->sess);
    832                 async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch,
    833                     DRIVER_DEVMAN, 0, 0);
    834                 async_exchange_end(exch);
    835                
    836                 if (sess) {
    837                         add_device(sess, drv, dev, tree);
    838                         async_hangup(sess);
     825                int phone = async_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0);
     826                if (phone >= 0) {
     827                        add_device(phone, drv, dev, tree);
     828                        async_hangup(phone);
    839829                }
    840830        }
Note: See TracChangeset for help on using the changeset viewer.