Changeset 1564c4b in mainline for uspace/srv/devman/devman.c


Ignore:
Timestamp:
2011-06-08T19:39:52Z (14 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2af29ed
Parents:
e686889c (diff), 0eff68e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline

File:
1 edited

Legend:

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

    re686889c r1564c4b  
    3939#include <devmap.h>
    4040#include <str_error.h>
     41#include <stdio.h>
    4142
    4243#include "devman.h"
     
    563564        dev_node_t *dev;
    564565        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         phone = async_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
    573 
    574         if (phone < 0) {
     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) {
    575578                fibril_mutex_unlock(&driver->driver_mutex);
    576579                return;
     
    601604                fibril_mutex_unlock(&driver->driver_mutex);
    602605
    603                 add_device(phone, driver, dev, tree);
     606                add_device(sess, driver, dev, tree);
    604607
    605608                /*
     
    622625        }
    623626
    624         async_hangup(phone);
     627        async_hangup(sess);
    625628
    626629        /*
     
    672675        list_initialize(&drv->devices);
    673676        fibril_mutex_initialize(&drv->driver_mutex);
    674         drv->phone = -1;
     677        drv->sess = NULL;
    675678}
    676679
     
    736739 * @param node          The device's node in the device tree.
    737740 */
    738 void add_device(int phone, driver_t *drv, dev_node_t *dev, dev_tree_t *tree)
     741void add_device(async_sess_t *sess, driver_t *drv, dev_node_t *dev,
     742    dev_tree_t *tree)
    739743{
    740744        /*
     
    745749            drv->name, dev->pfun->name);
    746750       
    747         sysarg_t rc;
    748         ipc_call_t answer;
    749        
    750751        /* Send the device to the driver. */
    751752        devman_handle_t parent_handle;
     
    755756                parent_handle = 0;
    756757        }
    757 
    758         aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, dev->handle,
     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,
    759763            parent_handle, &answer);
    760764       
    761         /* Send the device's name to the driver. */
    762         rc = async_data_write_start(phone, dev->pfun->name,
     765        /* Send the device name to the driver. */
     766        sysarg_t rc = async_data_write_start(exch, dev->pfun->name,
    763767            str_size(dev->pfun->name) + 1);
     768       
     769        async_exchange_end(exch);
     770       
    764771        if (rc != EOK) {
    765772                /* TODO handle error */
     
    822829        if (is_running) {
    823830                /* Notify the driver about the new device. */
    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);
     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);
    828839                }
    829840        }
Note: See TracChangeset for help on using the changeset viewer.