Changeset 7707954 in mainline for uspace/lib/libc/generic/devman.c


Ignore:
Timestamp:
2010-03-18T21:20:17Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bda60d9
Parents:
084ff99
Message:

child device registration - parts of code

File:
1 edited

Legend:

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

    r084ff99 r7707954  
    106106}
    107107
     108int devman_child_device_register(const char *name, long parent_handle, long *handle)
     109{       
     110        int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING);
     111       
     112        if (phone < 0)
     113                return phone;
     114       
     115        async_serialize_start();
     116       
     117        ipc_call_t answer;
     118        aid_t req = async_send_1(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, &answer);
     119
     120        ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
     121        if (retval != EOK) {
     122                async_wait_for(req, NULL);
     123                async_serialize_end();
     124                return retval;
     125        }
     126       
     127        async_wait_for(req, &retval);
     128       
     129        async_serialize_end();
     130       
     131        if (retval != EOK) {
     132                if (handle != NULL) {
     133                        *handle = -1;
     134                }
     135                return retval;
     136        }       
     137       
     138        if (handle != NULL)
     139                *handle = (int) IPC_GET_ARG1(answer);   
     140}
     141
    108142void devman_hangup_phone(devman_interface_t iface)
    109143{
Note: See TracChangeset for help on using the changeset viewer.