Ignore:
File:
1 edited

Legend:

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

    r79ae36dd r3ad7b1c  
    3939#include <devmap.h>
    4040#include <str_error.h>
    41 #include <stdio.h>
    4241
    4342#include "devman.h"
     
    564563        dev_node_t *dev;
    565564        link_t *link;
     565        int phone;
    566566
    567567        log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
     
    569569
    570570        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) {
     571
     572        phone = async_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
     573
     574        if (phone < 0) {
    578575                fibril_mutex_unlock(&driver->driver_mutex);
    579576                return;
     
    604601                fibril_mutex_unlock(&driver->driver_mutex);
    605602
    606                 add_device(sess, driver, dev, tree);
     603                add_device(phone, driver, dev, tree);
    607604
    608605                /*
     
    625622        }
    626623
    627         async_hangup(sess);
     624        async_hangup(phone);
    628625
    629626        /*
     
    675672        list_initialize(&drv->devices);
    676673        fibril_mutex_initialize(&drv->driver_mutex);
    677         drv->sess = NULL;
     674        drv->phone = -1;
    678675}
    679676
     
    739736 * @param node          The device's node in the device tree.
    740737 */
    741 void add_device(async_sess_t *sess, driver_t *drv, dev_node_t *dev,
    742     dev_tree_t *tree)
     738void add_device(int phone, driver_t *drv, dev_node_t *dev, dev_tree_t *tree)
    743739{
    744740        /*
     
    749745            drv->name, dev->pfun->name);
    750746       
     747        sysarg_t rc;
     748        ipc_call_t answer;
     749       
    751750        /* Send the device to the driver. */
    752751        devman_handle_t parent_handle;
     
    756755                parent_handle = 0;
    757756        }
    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,
     757
     758        aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, dev->handle,
    763759            parent_handle, &answer);
    764760       
    765         /* Send the device name to the driver. */
    766         sysarg_t rc = async_data_write_start(exch, dev->pfun->name,
     761        /* Send the device's name to the driver. */
     762        rc = async_data_write_start(phone, dev->pfun->name,
    767763            str_size(dev->pfun->name) + 1);
    768        
    769         async_exchange_end(exch);
    770        
    771764        if (rc != EOK) {
    772765                /* TODO handle error */
     
    829822        if (is_running) {
    830823                /* 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);
     824                int phone = async_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0);
     825                if (phone >= 0) {
     826                        add_device(phone, drv, dev, tree);
     827                        async_hangup(phone);
    839828                }
    840829        }
Note: See TracChangeset for help on using the changeset viewer.