Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 45059d6b in mainline


Ignore:
Timestamp:
2011-08-19T16:31:47Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
107f2e0, 16f9782, 1c99eae
Parents:
0fe52ef
Message:

Set connection handler for callback session from devman to driver
(driver→sess). Now devman does not need to create a new connection
every time it actually has some request.

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/devman.c

    r0fe52ef r45059d6b  
    195195       
    196196        exch = devman_exchange_begin(DEVMAN_DRIVER);
    197         async_connect_to_me(exch, 0, 0, 0, NULL, NULL);
     197        async_connect_to_me(exch, 0, 0, 0, conn, NULL);
    198198        devman_exchange_end(exch);
    199199       
  • uspace/lib/drv/generic/driver.c

    r0fe52ef r45059d6b  
    428428static void driver_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    429429{
     430        sysarg_t conn_type;
     431
     432        if (iid == 0) {
     433                /* Callback connection from devman */
     434                /* XXX Use separate handler for this type of connection */
     435                conn_type = DRIVER_DEVMAN;
     436        } else {
     437                conn_type = IPC_GET_ARG1(*icall);
     438        }
     439
    430440        /* Select interface */
    431         switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     441        switch (conn_type) {
    432442        case DRIVER_DEVMAN:
    433443                /* Handle request from device manager */
  • uspace/srv/devman/devman.c

    r0fe52ef r45059d6b  
    548548
    549549        fibril_mutex_lock(&driver->driver_mutex);
    550        
    551         async_exch_t *exch = async_exchange_begin(driver->sess);
    552         async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch,
    553             DRIVER_DEVMAN, 0, 0);
    554         async_exchange_end(exch);
    555 
    556         if (!sess) {
    557                 fibril_mutex_unlock(&driver->driver_mutex);
    558                 return;
    559         }
    560550
    561551        /*
     
    583573                fibril_mutex_unlock(&driver->driver_mutex);
    584574
    585                 add_device(sess, driver, dev, tree);
     575                add_device(driver, dev, tree);
    586576
    587577                /*
     
    603593                link = driver->devices.head.next;
    604594        }
    605 
    606         async_hangup(sess);
    607595
    608596        /*
     
    718706 * @param node          The device's node in the device tree.
    719707 */
    720 void add_device(async_sess_t *sess, driver_t *drv, dev_node_t *dev,
    721     dev_tree_t *tree)
     708void add_device(driver_t *drv, dev_node_t *dev, dev_tree_t *tree)
    722709{
    723710        /*
     
    736723        }
    737724       
    738         async_exch_t *exch = async_exchange_begin(sess);
     725        async_exch_t *exch = async_exchange_begin(drv->sess);
    739726       
    740727        ipc_call_t answer;
     
    806793        fibril_mutex_unlock(&drv->driver_mutex);
    807794
    808         if (is_running) {
    809                 /* Notify the driver about the new device. */
    810                 async_exch_t *exch = async_exchange_begin(drv->sess);
    811                 async_sess_t *sess = async_connect_me_to(EXCHANGE_SERIALIZE, exch,
    812                     DRIVER_DEVMAN, 0, 0);
    813                 async_exchange_end(exch);
    814                
    815                 if (sess) {
    816                         add_device(sess, drv, dev, tree);
    817                         async_hangup(sess);
    818                 }
    819         }
     795        /* Notify the driver about the new device. */
     796        if (is_running)
     797                add_device(drv, dev, tree);
    820798       
    821799        return true;
  • uspace/srv/devman/devman.h

    r0fe52ef r45059d6b  
    235235extern void add_driver(driver_list_t *, driver_t *);
    236236extern void attach_driver(dev_node_t *, driver_t *);
    237 extern void add_device(async_sess_t *, driver_t *, dev_node_t *, dev_tree_t *);
     237extern void add_device(driver_t *, dev_node_t *, dev_tree_t *);
    238238extern bool start_driver(driver_t *);
    239239
Note: See TracChangeset for help on using the changeset viewer.