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

Changeset 2fd26bb in mainline


Ignore:
Timestamp:
2017-10-08T20:17:59Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
d15797d
Parents:
82cbf8c6
Message:

Make it simpler to get parent function session repeatedly without having to cache it.

Location:
uspace
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/hdaudio/hdaudio.c

    r82cbf8c6 r2fd26bb  
    175175
    176176        ddf_msg(LVL_NOTE, "create parent sess");
    177         hda->parent_sess = ddf_dev_parent_sess_create(dev);
     177        hda->parent_sess = ddf_dev_parent_sess_get(dev);
    178178        if (hda->parent_sess == NULL) {
    179179                ddf_msg(LVL_ERROR, "Failed connecting parent driver.\n");
  • uspace/drv/block/ahci/ahci.c

    r82cbf8c6 r2fd26bb  
    11401140       
    11411141        /* Connect to parent device */
    1142         ahci->parent_sess = ddf_dev_parent_sess_create(dev);
     1142        ahci->parent_sess = ddf_dev_parent_sess_get(dev);
    11431143        if (ahci->parent_sess == NULL)
    11441144                return NULL;
  • uspace/drv/block/ata_bd/main.c

    r82cbf8c6 r2fd26bb  
    6868        int rc;
    6969
    70         parent_sess = ddf_dev_parent_sess_create(dev);
     70        parent_sess = ddf_dev_parent_sess_get(dev);
    7171        if (parent_sess == NULL)
    7272                return ENOMEM;
  • uspace/drv/block/ddisk/ddisk.c

    r82cbf8c6 r2fd26bb  
    288288        int rc;
    289289
    290         parent_sess = ddf_dev_parent_sess_create(dev);
     290        parent_sess = ddf_dev_parent_sess_get(dev);
    291291        if (parent_sess == NULL)
    292292                return ENOMEM;
  • uspace/drv/bus/adb/cuda_adb/main.c

    r82cbf8c6 r2fd26bb  
    6868        int rc;
    6969
    70         parent_sess = ddf_dev_parent_sess_create(dev);
     70        parent_sess = ddf_dev_parent_sess_get(dev);
    7171        if (parent_sess == NULL)
    7272                return ENOMEM;
  • uspace/drv/bus/isa/isa.c

    r82cbf8c6 r2fd26bb  
    643643        list_initialize(&isa->functions);
    644644
    645         sess = ddf_dev_parent_sess_create(dev);
     645        sess = ddf_dev_parent_sess_get(dev);
    646646        if (sess == NULL) {
    647647                ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the "
  • uspace/drv/bus/pci/pciintel/pci.c

    r82cbf8c6 r2fd26bb  
    683683        bus->dnode = dnode;
    684684       
    685         sess = ddf_dev_parent_sess_create(dnode);
     685        sess = ddf_dev_parent_sess_get(dnode);
    686686        if (sess == NULL) {
    687687                ddf_msg(LVL_ERROR, "pci_dev_add failed to connect to the "
  • uspace/drv/char/atkbd/atkbd.c

    r82cbf8c6 r2fd26bb  
    366366       
    367367        kbd->client_sess = NULL;
    368         kbd->parent_sess = ddf_dev_parent_sess_create(dev);
     368        kbd->parent_sess = ddf_dev_parent_sess_get(dev);
    369369       
    370370        if (!kbd->parent_sess) {
  • uspace/drv/char/i8042/main.c

    r82cbf8c6 r2fd26bb  
    6060        assert(dev);
    6161       
    62         async_sess_t *parent_sess = ddf_dev_parent_sess_create(dev);
     62        async_sess_t *parent_sess = ddf_dev_parent_sess_get(dev);
    6363        if (parent_sess == NULL)
    6464                return ENOMEM;
  • uspace/drv/char/ns8250/ns8250.c

    r82cbf8c6 r2fd26bb  
    391391       
    392392        /* Connect to the parent's driver. */
    393         parent_sess = ddf_dev_parent_sess_create(ns->dev);
     393        parent_sess = ddf_dev_parent_sess_get(ns->dev);
    394394        if (parent_sess == NULL) {
    395395                ddf_msg(LVL_ERROR, "Failed to connect to parent driver of "
  • uspace/drv/char/pl050/pl050.c

    r82cbf8c6 r2fd26bb  
    167167        pl050->buf_rp = pl050->buf_wp = 0;
    168168
    169         pl050->parent_sess = ddf_dev_parent_sess_create(pl050->dev);
     169        pl050->parent_sess = ddf_dev_parent_sess_get(pl050->dev);
    170170        if (pl050->parent_sess == NULL) {
    171171                ddf_msg(LVL_ERROR, "Failed connecitng parent driver.");
  • uspace/drv/char/ps2mouse/ps2mouse.c

    r82cbf8c6 r2fd26bb  
    116116{
    117117        mouse->client_sess = NULL;
    118         mouse->parent_sess = ddf_dev_parent_sess_create(dev);
     118        mouse->parent_sess = ddf_dev_parent_sess_get(dev);
    119119        if (!mouse->parent_sess)
    120120                return ENOMEM;
  • uspace/drv/char/xtkbd/xtkbd.c

    r82cbf8c6 r2fd26bb  
    417417       
    418418        kbd->client_sess = NULL;
    419         kbd->parent_sess = ddf_dev_parent_sess_create(dev);
     419        kbd->parent_sess = ddf_dev_parent_sess_get(dev);
    420420       
    421421        if (!kbd->parent_sess) {
  • uspace/drv/time/cmos-rtc/cmos-rtc.c

    r82cbf8c6 r2fd26bb  
    213213        /* Connect to the parent's driver */
    214214
    215         parent_sess = ddf_dev_parent_sess_create(rtc->dev);
    216         if (!parent_sess) {
     215        parent_sess = ddf_dev_parent_sess_get(rtc->dev);
     216        if (parent_sess == NULL) {
    217217                ddf_msg(LVL_ERROR, "Failed to connect to parent driver\
    218218                    of device %s.", ddf_dev_get_name(rtc->dev));
  • uspace/lib/drv/generic/driver.c

    r82cbf8c6 r2fd26bb  
    599599}
    600600
    601 /** Create session with the parent function.
    602  *
    603  * The session will be automatically closed when @a dev is destroyed.
    604  *
    605  * @param dev Device
    606  *
    607  * @return New session or NULL if session could not be created
    608  *
    609  */
    610 async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *dev)
    611 {
    612         assert(dev->parent_sess == NULL);
    613         dev->parent_sess = devman_parent_device_connect(dev->handle,
    614             IPC_FLAG_BLOCKING);
    615 
    616         return dev->parent_sess;
    617 }
    618 
    619601/** Return existing session with the parent function.
    620602 *
    621603 * @param dev   Device
    622  * @return      Existing session or NULL if there is no session
     604 * @return      Session with parent function or NULL upon failure
    623605 */
    624606async_sess_t *ddf_dev_parent_sess_get(ddf_dev_t *dev)
    625607{
     608        if (dev->parent_sess == NULL) {
     609                dev->parent_sess = devman_parent_device_connect(dev->handle,
     610                    IPC_FLAG_BLOCKING);
     611        }
     612
    626613        return dev->parent_sess;
    627614}
  • uspace/lib/drv/include/ddf/driver.h

    r82cbf8c6 r2fd26bb  
    117117extern devman_handle_t ddf_dev_get_handle(ddf_dev_t *);
    118118extern const char *ddf_dev_get_name(ddf_dev_t *);
    119 extern async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *);
    120119extern async_sess_t *ddf_dev_parent_sess_get(ddf_dev_t *);
    121120extern ddf_fun_t *ddf_fun_create(ddf_dev_t *, fun_type_t, const char *);
  • uspace/lib/nic/src/nic_driver.c

    r82cbf8c6 r2fd26bb  
    249249       
    250250        /* Connect to the parent's driver. */
    251         parent_sess = ddf_dev_parent_sess_create(dev);
     251        parent_sess = ddf_dev_parent_sess_get(dev);
    252252        if (parent_sess == NULL)
    253                 return EPARTY;
     253                return EIO;
    254254       
    255255        return hw_res_get_list_parsed(parent_sess, resources, 0);
Note: See TracChangeset for help on using the changeset viewer.