Ignore:
File:
1 edited

Legend:

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

    r228e490 r0b5a4131  
    3636 */
    3737
    38 #include <inttypes.h>
    3938#include <assert.h>
    4039#include <ipc/services.h>
     
    7473       
    7574        iid = async_get_call(&icall);
    76         if (IPC_GET_IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) {
     75        if (IPC_GET_METHOD(icall) != DEVMAN_DRIVER_REGISTER) {
    7776                ipc_answer_0(iid, EREFUSED);
    7877                return NULL;
     
    109108        ipc_call_t call;
    110109        ipc_callid_t callid = async_get_call(&call);
    111         if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) {
     110        if (IPC_GET_METHOD(call) != IPC_M_CONNECT_TO_ME) {
    112111                ipc_answer_0(callid, ENOTSUP);
    113112                ipc_answer_0(iid, ENOTSUP);
     
    141140       
    142141        callid = async_get_call(&call);
    143         if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) {
     142        if (DEVMAN_ADD_MATCH_ID != IPC_GET_METHOD(call)) {
    144143                printf(NAME ": ERROR: devman_receive_match_id - invalid "
    145144                    "protocol.\n");
     
    184183 * @return              Zero on success, negative error code otherwise.
    185184 */
    186 static int devman_receive_match_ids(sysarg_t match_count,
     185static int devman_receive_match_ids(ipcarg_t match_count,
    187186    match_id_list_t *match_ids)
    188187{
     
    197196}
    198197
    199 static int assign_driver_fibril(void *arg)
    200 {
    201         node_t *node = (node_t *) arg;
    202         assign_driver(node, &drivers_list, &device_tree);
    203         return EOK;
    204 }
    205 
    206198/** Handle child device registration.
    207199 *
     
    211203{
    212204        devman_handle_t parent_handle = IPC_GET_ARG1(*call);
    213         sysarg_t match_count = IPC_GET_ARG2(*call);
     205        ipcarg_t match_count = IPC_GET_ARG2(*call);
    214206        dev_tree_t *tree = &device_tree;
    215207       
     
    244236       
    245237        devman_receive_match_ids(match_count, &node->match_ids);
    246 
    247         /*
    248          * Try to find a suitable driver and assign it to the device.  We do
    249          * not want to block the current fibril that is used for processing
    250          * incoming calls: we will launch a separate fibril to handle the
    251          * driver assigning. That is because assign_driver can actually include
    252          * task spawning which could take some time.
    253          */
    254         fid_t assign_fibril = fibril_create(assign_driver_fibril, node);
    255         if (assign_fibril == 0) {
    256                 /*
    257                  * Fallback in case we are out of memory.
    258                  * Probably not needed as we will die soon anyway ;-).
    259                  */
    260                 (void) assign_driver_fibril(node);
    261         } else {
    262                 fibril_add_ready(assign_fibril);
    263         }
    264 
     238       
    265239        /* Return device handle to parent's driver. */
    266240        ipc_answer_1(callid, EOK, node->handle);
     241       
     242        /* Try to find suitable driver and assign it to the device. */
     243        assign_driver(node, &drivers_list, &device_tree);
    267244}
    268245
     
    319296        printf(NAME ": device '%s' added to class '%s', class name '%s' was "
    320297            "asigned to it\n", dev->pathname, class_name, class_info->dev_name);
    321 
     298       
    322299        ipc_answer_0(callid, EOK);
    323300}
     
    367344                callid = async_get_call(&call);
    368345               
    369                 switch (IPC_GET_IMETHOD(call)) {
     346                switch (IPC_GET_METHOD(call)) {
    370347                case IPC_M_PHONE_HUNGUP:
    371348                        cont = false;
     
    420397                ipc_callid_t callid = async_get_call(&call);
    421398               
    422                 switch (IPC_GET_IMETHOD(call)) {
     399                switch (IPC_GET_METHOD(call)) {
    423400                case IPC_M_PHONE_HUNGUP:
    424401                        cont = false;
     
    428405                        break;
    429406                default:
    430                         ipc_answer_0(callid, ENOENT);
     407                        if (!(callid & IPC_CALLID_NOTIFICATION))
     408                                ipc_answer_0(callid, ENOENT);
    431409                }
    432410        }
     
    440418        node_t *dev = find_dev_node(&device_tree, handle);
    441419        if (dev == NULL) {
    442                 printf(NAME ": devman_forward error - no device with handle %" PRIun
    443                     " was found.\n", handle);
     420                printf(NAME ": devman_forward error - no device with handle %x "
     421                    "was found.\n", handle);
    444422                ipc_answer_0(iid, ENOENT);
    445423                return;
     
    457435       
    458436        if (driver == NULL) {
    459                 printf(NAME ": devman_forward error - the device is not in %" PRIun
    460                     " usable state.\n", handle);
     437                printf(NAME ": devman_forward error - the device is not in "
     438                    "usable state.\n", handle);
    461439                ipc_answer_0(iid, ENOENT);
    462440                return;
     
    472450                printf(NAME ": devman_forward: cound not forward to driver %s ",
    473451                    driver->name);
    474                 printf("the driver's phone is %" PRIun ").\n", driver->phone);
     452                printf("the driver's phone is %x).\n", driver->phone);
    475453                ipc_answer_0(iid, EINVAL);
    476454                return;
     
    486464static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall)
    487465{
    488         devmap_handle_t devmap_handle = IPC_GET_IMETHOD(*icall);
     466        devmap_handle_t devmap_handle = IPC_GET_METHOD(*icall);
    489467        node_t *dev;
    490468
     
    521499         * passes device handle to the driver as an ipc method.)
    522500         */
    523         if (IPC_GET_IMETHOD(*icall) != IPC_M_CONNECT_ME_TO)
     501        if (IPC_GET_METHOD(*icall) != IPC_M_CONNECT_ME_TO)
    524502                devman_connection_devmapper(iid, icall);
    525503
     
    531509       
    532510        /* Select interface. */
    533         switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     511        switch ((ipcarg_t) (IPC_GET_ARG1(*icall))) {
    534512        case DEVMAN_DRIVER:
    535513                devman_connection_driver(iid, icall);
     
    599577
    600578        /* Register device manager at naming service. */
    601         sysarg_t phonead;
     579        ipcarg_t phonead;
    602580        if (ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAN, 0, 0, &phonead) != 0)
    603581                return -1;
Note: See TracChangeset for help on using the changeset viewer.